I have a simple ListView with a scrollable child, which works as it should. But the issue is, when I scroll the items of ScrollableChild and it reaches its last child, it doesn't scroll the parent ListView. How can I achieve this behaviour?
ListView(children: [
...items(5),
ScrollableChild(),
...items(30),
])
I have tried to use the NestedScrollableWidget but unable to find any working solution.
Sample Code
I've tried to use the CustomScrollView, but unfortunately, the result is the same.
CustomScrollView(slivers: [
SliverList(delegate: SliverChildListDelegate(items(5))),
SliverToBoxAdapter(child: ScrollableChild()),
SliverList(delegate: SliverChildListDelegate(items(50))),
]),
Sample Code
The expected behavior can be viewed in this [Video].
the code I have shared works fine in a browser without any issue if you scroll it using the mouse wheel only.
When the blue child items scroll reaches at the end. it just scrolls the parent, that's what I am looking for.
Related
Is there a way in Flutter to show a scroll indicator only on a specific widget?
For instance, I have the following widget tree
CustomScrollView(
slivers: [
sliverAppBar(),
sliverToBoxAdapter(), // horizontal list view
SliverList(delegate: SliverChildBuilderDelegate()) // show scrollbar only for this widget
],
),
Here is a demonstration of the iOS app Telegram, I have something similar in my app, notice when the header collapses a gray scroll indicator shows up.
Any idea on how to implement this behavior will be highly appreciated
You can use Scrollable List which provide you the nice way to fulfill your requirements
Im working on my first flutter app so i am still learning possible widgets and how they react in certain structures.
So far I was doing well but cant figure out one thing I want to do.
I want to get a floating button inside of my cupertinopopusurface widget like this.
My structure is similar, on the home screen I have a listview builder that builds my cards and when you press on each one it opens a cupertinopopupsurface.
Inside I also built a Single child scroll view structure for all my contant and its scrollable but I would to get a button that overlays it all and is in a fixed placed.
My structure currently is
CupertinoPopupSurface/
Container/
SingleChildScrollView/
Column/
Children/
Row/ (all rows now with content)
I cant get the button fixed somewhere in the structure but then it follows the scrolling its now fixed overlaying the contant.
You can use stack widget inside cupertinopopupsurface like this:
CupertinoPopupSurface(
child: Stack(
children:[
your SingleChildScrollView,
Positioned(left: 16, right: 16, bottom: 16,child: yourbutton),
]
)
)
I have problem building one page with ListView and ExpansionTile.
I have DefaultTabController page, in one tab page I represent list of items.
When you reach end of this list there should be ExpansionTile, and when it openes it should appear another items list. Everything should be scroll-able and without height limitation (if it is possible).
Something like that:
Container(
child: Column(
children: [
Scrollbar(child: ListView.builder()),
ExpansionTile(children: [Scrollbar(child: ListView.builder())]
]
)
);
I have tried use Expanded Widget but received only errors. The main idea is for the page to be fully filled with items, and when reach the end, expand to another list and continue scrolling.
So I'm having some difficulty using the following Setup:
CustomScrollView(
slivers: [
SliverAppBar(...),
SliverToBoxAdapter(SomeRandomWidget),
SliverPersistentHeader(TabBar),
SliverFillRemaining(TabBarView)
])
So the TabBarView contains a Column on one tab, that overflows the screen. The issue is, that even though SliverFillRemaining is obviously not the right choice for the overflowing Widget but sadly as TabBarView looses the hasSize property of its children, I don't know what other Widget I could use to get the layout going. The goal is to achieve something like this (shows the current overflow):
EDIT: Here is a working example on DartPad: https://dartpad.dev/bda4cc5fd2aea292310fe05daa440760
try using extended_nested_scroll_view, maybe that's what you looking for
add floating: true, under pinned: true,
I need some help with a layout.
I need put some widgets inside a "Scrollview" but keep the buttoms in the bottom space of screen.
Image with a "Scrollview" with some textFields inside, and under de "Scrollview" a Rows containing two buttons
So if I change orientation the Layout will keep buttons at bottom and will scroll the widgets above.
How can I made it in flutter, I tried to use the Stack, Listview and others approaches, but i didn't have luck
Multiple ways. I recommend you either using a Scaffold or a Column:
If you are already using a Scaffold in your app, just add bottomNavigatorBar as a Parameter, your bar you want to have at the bottom in it and make sure the rest of your layout is located under it's body tag.
Otherwise you could use a Column:
Column(
children: <Widget> [
Expanded(child:ScrollView(..),),
yourBottomBar,
] )
Or Flutter also has a Positioned widget which you can use in combination with a Stack:
Stack(
children: [
// some stuff
Positioned(
bottom: 0,
child: yourBottomBar
),
],
)