Trying to add some widgets to before of a listview.... I searched and found to use expanded like:
return Scaffold(
appBar: AppBar(
title: Text('Test Listview'),
),
body: Container(
padding: const EdgeInsets.all(10.0),
child: Column(
children: <Widget>[
Text('header'),
Expanded(
child: ListView.builder(
itemCount: providerApp.domains.length,
itemBuilder: (BuildContext context, int index) {
return Container( ......
But the issue here is that the Text('header') will be fixed, looking for some way where the the widget scrolls together with listview...
Thanks !!!
Here's how you do it: Step 1: Wrap the Stack's child widget inside the Position widget. Step 2: Inside the Position widget, add the top , right , bottom , left property and give it a value. For example, setting top:15 and right:0 will position a widget on the top right of your screen with 15 px space from the top.
You can achieve this by using listview inside list view, below is sample code please check
body: ListView(
children: <Widget>[
Container(
height: 40,
color: Colors.deepOrange,
child: Center(
child: Text(
'Header',
style: TextStyle(color: Colors.white, fontSize: 16),
),
),
),
ListView.builder(
physics: ScrollPhysics(),
shrinkWrap: true,
itemCount: 50,
itemBuilder: (BuildContext context, int index) {
return Container(
color: Colors.lime,
height: 60,
child: Center(
child: Text(
'Child $index',
style: TextStyle(color: Colors.black, fontSize: 16),
),
),
);
},
),
Container(
height: 40,
color: Colors.deepOrange,
child: Center(
child: Text(
'Footer',
style: TextStyle(color: Colors.white, fontSize: 16),
),
),
),
],
),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With