rrousselGit / flutter_hooks

React hooks for Flutter. Hooks are a new kind of object that manages a Widget life-cycles. They are used to increase code sharing between widgets and as a complete replacement for StatefulWidget.
MIT License
3.07k stars 175 forks source link

How to use PrimaryScrollController in HookWidget #338

Closed dodatw closed 1 year ago

dodatw commented 1 year ago

I am using scrollControll by

    final scrollController = useScrollController()

But I have a case that I need use PrimaryScrollController. (tap status bar to trigger scroll-to-top)

    final scrollController = PrimaryScrollController.of(context);

Can it be used in HookWidget? Is there any best practice for this case ?

rrousselGit commented 1 year ago

There shouldn't be an issue with using PrimaryScrollController.of inside HookWidgets.