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

This commit is contained in:
Thomas Atkins 2019-02-09 12:29:46 -06:00
parent 09caea9c3c
commit e08e43625e

View File

@ -27,7 +27,7 @@ class _MyHomePageState extends State<MyHomePage> {
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<MyHomePage> {
Widget _buildListItem(BuildContext context, DocumentSnapshot data) {
final record = Record.fromSnapshot(data);
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()),
),
],),
),
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()),
),
],),
),
);
);
}
}
}