Skip to content

Instantly share code, notes, and snippets.

@bkhezry
Created July 31, 2020 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bkhezry/61c6a1f92779f865c6d47d8a49d64a59 to your computer and use it in GitHub Desktop.
Save bkhezry/61c6a1f92779f865c6d47d8a49d64a59 to your computer and use it in GitHub Desktop.
Half screen with two listview
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Expanded(
child: ListView.separated(
itemCount: 100,
itemBuilder: (context, index) {
return ListTile(
title: Text('$index sheep'),
);
},
separatorBuilder: (context, index) {
return Divider();
},
),
),
Container(
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: Colors.red.withOpacity(0.5),
),
child: Padding(
padding: EdgeInsets.all(8.0),
child: Text(
'Separator',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w900,
),
),
),
),
Expanded(
child: ListView.separated(
itemCount: 100,
itemBuilder: (context, index) {
return ListTile(
title: Text('$index sheep'),
);
},
separatorBuilder: (context, index) {
return Divider();
},
),
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment