I want to have a sticky widget similar to the floating widgets in scaffolds, difference is that this widget would belong to a ListView, when it isn't on screen it would behave as a floating widget, when user scrolls so its position be visible it would start animating to stay on its position on the ListView.
Here is a visual example of what I am trying to achieve
https://miro.medium.com/max/1200/1*GsH-kEVNtoDZaM0ZjNYRpQ.gif (the 'MY STICKY BUTTON' widget)
is this even possible in flutter ? and if so how ?
Thanks in advance!
Related
In material 3 the AppBar changes elevation and color when there is something scrolled under it.
It works fine using CustomScrollView with a SliverList or ListView scrolling under a SliverAppBar.
The issue is when I try to use PageView instead. It works fine using a SliverFillRemaining over the PageView but the appBar won’t notice when the page is scrolled.
I tried many ways, using NestedScrollView and CustomScrollView with no success.
The only way I could achieve that was using the PageView onPageChanged to check the page and calling back the setState of my homePage to change the color and elevation programmatically but at the cost of rebuilding almost the whole tree when it reaches or leaves the 1st page.
Any insights would be appreciated.
I am making an app whose structure is very simple.
A ListView with Listtiles in it.
I want to add animation such that when the screen is opened the listtiles slide in.
Flutter provides a AnimatedList Widget.
Perhaps this native widget will give you the desired output
My question is similar to this How to make my page scrollable when i show overlay element, that have too many items in flutter? but it has no answers so I'll try to ask as well:
I have an Overlay showing a list of questions using ListView. The list of questions is long and I need to enable scrolling inside the Overlay.
Now it's static and part of it disappears at the bottom of the mobile device.
Why is not just scrollable (since the list inside the Overlay is inside a ListView) and is there a way to make it scrollable?
Thanks in advance for any help!
UPDATE (SOLVED) :
The problem was that the ListView widget is inside a Positioned widget and the top, left, bottom and width values (in my case) need to be set in order for the content to be scrollable.
The problem was that the ListView widget is inside a Positioned widget and the top, left,bottom and width values (in my case) need to be set in order for the content to be scrollable.
How can I combine a swiper action with a fade-in/fade-out action in another area of the screen?
My screen is divided into two halves: The Top is a text widget and the bottom is a swiper widget with two pages. My goal is to fade-out the text in the top half when I swipe to the second page in the bottom half.
I'm using this dependency for the swiper widget in the bottom half: https://pub.dev/packages/flutter_swiper
I solved it by using GestureDetector widget and updated the opacity via the state.
The GestureDetector needed two functions: onDragUpdate and onDragEnd. Both changed the state of the progress which is also used to update the opacity in the other half.
Quite some work for such a small interaction, however, it works.
Can a bottomsheet be made scrollable? For example it opens initially upto a particular height and scrolls up as the content is scrolled. If yes, please help!
The DraggableScrollableSheet is here for that purpose.
This widget can be dragged along the vertical axis between its minChildSize, which defaults to 0.25 and maxChildSize, which defaults to 1.0.
You can use any Scrollable widget as child of DraggableScrollableSheet.
See the official video from Flutter team.