I trying to make two listView in one screen, but the second listView only show half screen(lot of space at the bottom).
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: darkBlue),
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: MyWidget(),
),
),
);
}
}
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Flexible(
child: Container(
color: Colors.red,
child: _showFirstListView(),
),
),
Expanded(
child: Container(
color: Colors.blue,
child: _showSecondListView(),
),
)
],
);
}
Widget _showFirstListView() {
return ListView.builder(
itemCount: 1,
shrinkWrap: true,
itemBuilder: (context, index) {
return Text("First ListView");
},
);
}
Widget _showSecondListView() {
return ListView.builder(
itemCount: 15,
itemBuilder: (BuildContext context, int index) {
return Container(
child: Column(
children: <Widget>[
SizedBox(
height: 15,
),
Text("FirstLine"),
SizedBox(
height: 15,
),
Text("SecondLine"),
SizedBox(
height: 15,
),
Text("ThirdLine"),
],
),
);
});
}
}
I have posted it on dartpad.
https://dartpad.dev/950d274dc06deb127d91d77b539c5db5
Expandedfor both, it will show both half screen. That not what I want. I want both listView inwrap_content.