'make a children not scroll inside listview
I made a Column widget which contains some Row inside it, and in the end I got a ListView widget, and It showing me some pixels error, So I changed the Column to ListView and the pixels error gone, But I need the first child inside the ListView to be in fixed position. Please help. the code below is sample.
SafeArea(
child: ListView(
children: [
Row(),
Row(),
Row(),
Row(),
Row(),
Row(),
]
)
)
Solution 1:[1]
Here an example of what you can do, enter the ListView inside a Column and put a the widget you want to fixed above it, then wrap the ListView in Expanded to prevent the overflow:
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Text('Title'),
Expanded(
child: ListView(
children: [
Text('Hello'),
Text('Hello'),
Text('Hello'),
Text('Hello'),
Text('Hello'),
Text('Hello'),
Text('Hello'),
Text('Hello'),
Text('Hello'),
Text('Hello'),
Text('Hello'),
Text('Hello'),
Text('Hello'),
Text('Hello'),
Text('Hello'),
Text('Hello'),
Text('Hello')
]
),
),
],
),
);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Wilson Toribio |
