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

thomas
Thomas Atkins 5 years ago
parent 09caea9c3c
commit e08e43625e

@ -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);
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()),
),
],),
),
);
}
}

Loading…
Cancel
Save