Skip to content

Instantly share code, notes, and snippets.

@erluxman
Created April 12, 2020 01:49
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 erluxman/31ec967b140ac6a5795c38ea4bdfd9a2 to your computer and use it in GitHub Desktop.
Save erluxman/31ec967b140ac6a5795c38ea4bdfd9a2 to your computer and use it in GitHub Desktop.
ListViewbuilder with Separator
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