From e08e43625ecf10aaaefa452a443745437d3d47bb Mon Sep 17 00:00:00 2001 From: Thomas Atkins Date: Sat, 9 Feb 2019 12:29:46 -0600 Subject: [PATCH] DB is looking a lot better now that she has all her data in order... time to try to dynamicly create view for diffrent lots --- flutter_app/lib/main.dart | 53 ++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/flutter_app/lib/main.dart b/flutter_app/lib/main.dart index 06e905b..7be6ec3 100644 --- a/flutter_app/lib/main.dart +++ b/flutter_app/lib/main.dart @@ -27,7 +27,7 @@ class _MyHomePageState extends State { return Scaffold( appBar: AppBar(title: Text('Lot 1')), body: _buildBody( - context, db.document('Test-Lot-46').collection('stalls')), + context, db.document('Lot1').collection('stalls')), ); } @@ -54,24 +54,41 @@ class _MyHomePageState extends State { Widget _buildListItem(BuildContext context, DocumentSnapshot data) { final record = Record.fromSnapshot(data); + if (record.open) { + return Card( + key: ValueKey(record.stall), + color: Colors.green[300], + child: Center( + child: Column( + children: [ + ListTile( + title: Text("Stall " + record.stall.toString(), + style: TextStyle(fontWeight: FontWeight.w500)), + subtitle: Text(record.open.toString()), + ), + ],), + ), + ); + } //if + else { + return Card( + key: ValueKey(record.stall), + color: Colors.red[100], + child: Center( + child: Column( + children: [ + ListTile( + title: Text("Stall " + record.stall.toString(), + style: TextStyle(fontWeight: FontWeight.w500)), + subtitle: Text(record.open.toString()), + ), + ],), + ), + + + ); + } - return Card( - key: ValueKey(record.stall), - color: Colors.blue, - - child: Center( - child: Column( - children: [ - ListTile( - title: Text("Stall " + record.stall.toString(), - style: TextStyle(fontWeight: FontWeight.w500)), - subtitle: Text(record.open.toString()), - ), - ],), - ), - - - ); } }