1- Wrap your FloatingActionButton in a Visibility widget. This allows you to toggle the visibility of the FloatingActionButton based on a boolean value
Visibility(
visible: _isVisible, // boolean value that controls visibility
child: FloatingActionButton(
onPressed: () {},
child: Icon(Icons.add),
),
);
2- Then Create a ScrollController and attach it to a ListView. This allows you to listen for changes in the scroll position.
3- Use the addListener method on the ScrollController to listen for changes in the scroll position and update the visibility of the FloatingActionButton accordingly.
2
Answers
You can make custom fab with scroll controller which is explained well in the below artile.
https://medium.com/@aakashpp/automatic-show-hide-fab-on-scroll-in-flutter-2c0abd94f3da
Please accept the solution if solved your problem
1- Wrap your
FloatingActionButton
in aVisibility
widget. This allows you to toggle the visibility of theFloatingActionButton
based on a boolean value2- Then Create a
ScrollController
and attach it to aListView
. This allows you to listen for changes in the scroll position.3- Use the
addListener
method on theScrollController
to listen for changes in the scroll position and update the visibility of theFloatingActionButton
accordingly.