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

[scrollable_positioned_list] Twitchy scroll animation #520

Open
subzero911 opened this issue Mar 22, 2024 · 0 comments
Open

[scrollable_positioned_list] Twitchy scroll animation #520

subzero911 opened this issue Mar 22, 2024 · 0 comments

Comments

@subzero911
Copy link

This package gives some crazy scrolling animation (looks like a big number of items has been scrolled, but it's only a few):

bad.scroll.mp4
late final ItemScrollController _itemScrollController;

  @override
  void initState() {
    super.initState();
    _itemScrollController = ItemScrollController();
    WidgetsBinding.instance.addPostFrameCallback((_) {
      if (controller.mode == TaskScreenMode.edit) {
        unawaited(
          _itemScrollController.scrollTo(index: controller.icon.index, duration: 400.ms),
        );
      }
    });

ScrollablePositionedList.separated(
                                itemScrollController: _itemScrollController,
                                padding: horizontalPadding,
                                scrollDirection: Axis.horizontal,
                                itemBuilder: (_, index) { ... }

Compare it to the standard library ScrollController animation:

good.scroll.mp4
 _iconsSc = ScrollController();
    WidgetsBinding.instance.addPostFrameCallback((_) {
      if (controller.mode == TaskScreenMode.edit) {
        _iconsSc.animateTo(52.0 * controller.icon.index, duration: 400.ms, curve: Curves.linear);
      }
    });

                           ListView.separated(
                                controller: _iconsSc,
...
@subzero911 subzero911 changed the title Twitchy scroll animation [scrollable_positioned_list] Twitchy scroll animation Oct 16, 2024
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