modified card and dissmiss padding

This commit is contained in:
andrei 2021-11-04 21:28:32 -04:00
parent b8c49132d7
commit a613292095
1 changed files with 76 additions and 66 deletions

View File

@ -43,6 +43,9 @@ class _MainListPageState extends State<MainListPage> {
int _selectedPage = data.Page.lists.index; int _selectedPage = data.Page.lists.index;
List<data.List> lists = []; List<data.List> lists = [];
final double _marginHorizontal = 10;
final double _cardSpacing = 4;
Future<void> _loadData(data.Page listType) async { Future<void> _loadData(data.Page listType) async {
lists.clear(); lists.clear();
var res = await DBHelper.dbHelper.getAllLists(listType); var res = await DBHelper.dbHelper.getAllLists(listType);
@ -66,6 +69,9 @@ class _MainListPageState extends State<MainListPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final EdgeInsets cardMargin =
EdgeInsets.symmetric(vertical: _cardSpacing, horizontal: 0);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(widget.title), title: Text(widget.title),
@ -83,7 +89,9 @@ class _MainListPageState extends State<MainListPage> {
tooltip: 'Add List', tooltip: 'Add List',
child: const Icon(Icons.add), child: const Icon(Icons.add),
), ),
body: RefreshIndicator( body: Container(
padding: EdgeInsets.symmetric(horizontal: _marginHorizontal),
child: RefreshIndicator(
onRefresh: () => _loadData(data.Page.values[_selectedPage]), onRefresh: () => _loadData(data.Page.values[_selectedPage]),
child: ListView.builder( child: ListView.builder(
itemCount: lists.length, itemCount: lists.length,
@ -92,6 +100,7 @@ class _MainListPageState extends State<MainListPage> {
direction: DismissDirection.startToEnd, direction: DismissDirection.startToEnd,
key: Key(lists[index].id.toString()), key: Key(lists[index].id.toString()),
background: Card( background: Card(
margin: cardMargin,
color: Colors.red, color: Colors.red,
child: Row( child: Row(
children: const [ children: const [
@ -137,6 +146,7 @@ class _MainListPageState extends State<MainListPage> {
}); });
}, },
child: Card( child: Card(
margin: cardMargin,
child: ListTile( child: ListTile(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
@ -152,7 +162,7 @@ class _MainListPageState extends State<MainListPage> {
), ),
), ),
); );
})), }))),
bottomNavigationBar: BottomNavigationBar( bottomNavigationBar: BottomNavigationBar(
elevation: 4, elevation: 4,
currentIndex: _selectedPage, currentIndex: _selectedPage,