I am trying to make a PageView with only 2 items. But I want to see the card behind the first one. And when swipe it to the right I want it to animate to the back and the back card animate to the front.
I have found a similar solution but not quite it,
Flutter Swiper. It does allow me to see the card behind however it's not as much as I want and it doesn't animate to the back instead it just disappears to the right. Also, I want to make it "pop-out" on the right and not on the left.
Any help would be useful to point me in a direction. Thanks.
Simply change the order of the children of Stack when needed:
var children = <Widget>[Widget1(), Widget2()];
Stack(
children: children,
)
when Widget2()'s position has been animated to the edge:
setState((){
children = <Widget>[Widget2(), Widget1()];
});
Related
0
in my case I have a bunch of questions and each question have a list to choose one of the existing answers displayed in overlay widget.
for my list i used an overlay.
the problem is if there is other overlay, they will hide each other same as stack order its child (the last child widget will be overlapping above the other children of stack) the
the result of my code looks like:
before click the first overlay to animate to the big size
after click the overlay widget
I cant use the entry.remove() cause I want the overlay stay shown but only the size will change to small size after user choose one of the displayed answers. (I'm using animatedContainer for that)
I'm looking for a way to make the selected widget overlay above the other overlay widgets
so any suggestions to solve this? or maybe the way of implementation is wrong ? and thanks
something like this (the selected one will always shown at the top)
https://pub.dev/packages/indexed
I am looking to create in Flutter a modal dialog that slides in from the bottom and
Appears with a given height (eg. 1/3 of the screen)
Expands vertically if the user scrolls up on it (and shrinks until disappearing if the user scrolls down)
Provides some kind of callback or observable so that I can know when it reaches the top of the screen/parent. (I need this in order to create a back arrow on the top left corner of the panel itself)
Is there any way to achieve this?
I have found the package sliding_up_panel to be really nice, but lacking the third feature.
The SlidingUpPanel does actually have everything you need. You want to use the onPanelSlide property from it which will provide you the current % opened of the panel normalized ([0, 1.0]), so if you want to know when it reaches the top you, it's when its current position is at 1.0.
As an alternative, you may want to take a look at DraggableScrollableSheet widget, but IMO, SlidingUpPanel is more versatile.
I have stucked with an issue learning Flutter. I take a design from dribbble and try to implement it. The goal is to implement a horizontal scrollable list view but I want it to appear with padding and when I scroll it left it goes over the screen (see attachments). When I scroll left the items of the list should goes over the screen without padding. I tried to add empty sized box as first item of the list but it looks like incorrect approach. I am sure I am doing something wrong and it would be helpful if some one steer me in the right direction. .
ListView has a padding property you can use that.
ListView(
padding:EdgeInsets.only(left:10),
...
),
Hope this is what you are looking for.
Is it possible to add new elements into the top of the ListVeiw or CustomScrollView and keep the scroll position as it's with Flutter
I've tried the following
extentAfter = _scrollController.position.extentAfter;
_scrollController.jumpTo(_scrollController.position.maxScrollExtent - extentAfter);
but this won't work well with SliverAppBar - floating and its actually not optimal solution.
Actually the cleanest way would be to add those items only when user scrolls back to the top of the ListView. You can cache them in memory for the moment user is far enough from the top (in your case) of the list.
I am looking for this widget. When you swipe left or right, the card changes its order. (The one of front goes to the back)
If you're looking for a way to stack widgets and show only one at a time you can use the IndexedStack widget.
https://docs.flutter.io/flutter/widgets/IndexedStack-class.html