Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is a bug with the ScrollOnExpand widget, creator please fix it. #130

Open
fxgonzalez5 opened this issue Aug 13, 2024 · 0 comments
Open

Comments

@fxgonzalez5
Copy link

The widget with the default values it has in its parameters works correctly.

ExpandableNotifier(
  child: ScrollOnExpand(
    child: ExpandablePanel(
      header: Text('ScrollOnExpand Default'),
      collapsed: Text('Collapsed content'),
      expanded: Column(
        children: <Widget>[
          Text('Expand content'),
          Text('Ex sit dolor ullamco cillum nulla aliquip nulla. Mollit eiusmod laboris excepteur sint cupidatat. Dolor magna nisi sint enim nisi adipisicing fugiat. Voluptate proident dolore occaecat deserunt cupidatat. Laborum consectetur deserunt pariatur aliqua sint nisi ex veniam duis qui. Officia enim culpa non in elit excepteur nostrud nisi. Incididunt nulla laboris occaecat consequat proident excepteur.'),
        ],
      ),
    ),
  ),
),

The problem arises when the scrollOnExpand parameter is changed to false, the widget is not respecting the variable, since it still performs the scroll animation automatically when the content is not seen on the screen.

ExpandableNotifier(
  child: ScrollOnExpand(
    scrollOnExpand: false,
    scrollOnCollapse: true,
    child: ExpandablePanel(
      header: Text('ScrollOnExpand false'),
      collapsed: Text('Collapsed content'),
      expanded: Column(
        children: <Widget>[
          Text('Expand content'),
          Text('Ex sit dolor ullamco cillum nulla aliquip nulla. Mollit eiusmod laboris excepteur sint cupidatat. Dolor magna nisi sint enim nisi adipisicing fugiat. Voluptate proident dolore occaecat deserunt cupidatat. Laborum consectetur deserunt pariatur aliqua sint nisi ex veniam duis qui. Officia enim culpa non in elit excepteur nostrud nisi. Incididunt nulla laboris occaecat consequat proident excepteur.'),
        ],
      ),
    ),
  ),
),

In the case of the other parameter there is no problem, it works correctly, when the collapsed content is not seen on the screen and the assigned value is false, the widget does not perform the scroll animation.

ExpandableNotifier(
  child: ScrollOnExpand(
    scrollOnExpand: true,
    scrollOnCollapse: false,
    child: ExpandablePanel(
      header: Text('ScrollOnCollapse false'),
      collapsed: Text('Collapsed content'),
      expanded: Column(
        children: <Widget>[
          Text('Expand content'),
          Text('Ex sit dolor ullamco cillum nulla aliquip nulla. Mollit eiusmod laboris excepteur sint cupidatat. Dolor magna nisi sint enim nisi adipisicing fugiat. Voluptate proident dolore occaecat deserunt cupidatat. Laborum consectetur deserunt pariatur aliqua sint nisi ex veniam duis qui. Officia enim culpa non in elit excepteur nostrud nisi. Incididunt nulla laboris occaecat consequat proident excepteur.'),
        ],
      ),
    ),
  ),
),

You can perform the test with the examples that I have attached. Just remember to use a ListView and as a first child send a SizeBox or a Container with a size that allows the ExpandableNotifier to go high off the screen.

Note: If you currently do not want the scroll animation to be performed when expanding, simply do not use the ScrollOnExpand widget. But this also results in no scroll animation when collapsing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant