How to keep the scrolling position when adding a new elements in the top using ListView or CustomScrollView in Flutter - flutter

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.

Related

How to create a Fixed Scrollable portion in CusotmScrollView in flutter?

I am using a CustomScrollView and Slivers inside it and redendering the list using SliverChildBuilderDelegate. This works fine, but my requirement is to have a Fixed Container of height = height of screen/2 and inside that I want to render a list and and it can scroll as well, I am using CupertinoSliverNavigationBar [this cannot be replaced]. I am able to draw a Container and inside that I am able to show a list using Listview.builder, but the problem is I am unable to scroll the list, whenever I scroll it, it goes to top again, I want something Like, my CustomScrollView should be kept as it is, just I want to create a Scrollable Container of fixed height and the list inside that should scroll properly and CustomScrollView can also scroll, I have tried many widgets like Wrap, Rows, Columns, SingleChildScrollView, also tried NeverScrollPhysics() Behaviour for CustomScrollView but nothing is working out. Please Help!

Detect if there are items left to scroll in a flutter Listview

I have listview in a gridview in a flutter calendar app. I am trying to detect if a particular list view has half-visible or invisible items which need to be scrolled to be seen. If not, the user might not see that a day has an appointment/task unless they change resolution/view.
I'd like to add a little arrow, or overlay, just to warn the user there are extra items. Making the listview scrollable doesn't work well for me because then the gridview loses scrollability, unless I make the ListViews shrinkwrap, which causes its own problems.
Any help appreciated...
you can use an Text to tell the user there is more contact and if the list is on end you remove that text
by using this inview_notifier_list package
and check if onListEndReached

How to create build the next not visible widgets on the ListView?

We know that ListView.builder only build the widgets visible on the screen at the moment, but suppose we want to build those and the next fives widgets? So when we scroll, the next fives are already built?
How can we achieve that?
You can use the cacheExtent property to make the ListView build and layout the given size beyond the visible area.

Flutter Not able to achieve PageView like Swipeable Tabs inside Parent ListView

This is a Flutter Specific Query.
I Want to achieve the Layout Referenced in the Image above. Two Tabs
Below a Container.
The Tabs can be switched using Swipe Animation like that in a
Page View.
The Tabs Contain Dynamically Generated Widgets from Provider.
The Entire Page along with the Fixed Container must be
Scroll-able.
When Switching between the Tabs the fixed container should stay
in place and only tab Content(Column of Widgets) should swipe
left and right.
What I've Tried :
Using a Parent List View and Nesting the Fixed Container Child
and Using Tab Bar to switch the Widget using Animated Switcher and
Slide Animation. Here the Problem is i cannot swipe left and right
and create the Page View like Effect. I also tried Nesting Page-View
inside List-View but since the Page-View does not have a fixed height
( because the tab contents are dynamically generated ).
A few many more concepts i tried to tackle but the issue every time was
that the tab contents are not having a fixed height.
I really want to achieve this Layout and i want to know if there's any way.

How to proper structure Flutter design

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.