Created
April 12, 2020 01:49
-
-
Save erluxman/31ec967b140ac6a5795c38ea4bdfd9a2 to your computer and use it in GitHub Desktop.
ListViewbuilder with Separator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
body: Center( | |
child: MyWidget(), | |
), | |
), | |
); | |
} | |
} | |
class MyWidget extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return ListView.separated( | |
itemCount: 25, | |
separatorBuilder: (BuildContext context, int index) => Divider( | |
thickness: 1, | |
color: Colors.blue, | |
indent: 32, | |
endIndent: 8, | |
), | |
itemBuilder: (BuildContext context, int index) { | |
return ListTile( | |
title: Padding( | |
padding: const EdgeInsets.symmetric(horizontal: 8.0), | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: <Widget>[ | |
Text( | |
'Title Number $index', | |
style: TextStyle(fontSize: 20.0), | |
), | |
Text('Details of the item') | |
], | |
), | |
), | |
); | |
}, | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment