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(),
]
)
)
CodePudding user response:
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')
]
),
),
],
),
);
}
