|
|
|
@ -24,7 +24,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
appBar: AppBar(title: Text('Baby Name Votes')),
|
|
|
|
|
appBar: AppBar(title: Text('Lot 1')),
|
|
|
|
|
body: _buildBody(context),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
@ -55,19 +55,20 @@ class _MyHomePageState extends State<MyHomePage> {
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
|
|
|
|
child: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border: Border.all(color: Colors.grey),
|
|
|
|
|
border: Border.all(color: Colors.blue),
|
|
|
|
|
borderRadius: BorderRadius.circular(5.0),
|
|
|
|
|
),
|
|
|
|
|
child: ListTile(
|
|
|
|
|
title: Text(record.stall.toString()),
|
|
|
|
|
trailing: Text(record.handicap.toString()),
|
|
|
|
|
// onTap: () => Firestore.instance.runTransaction((transaction) async {
|
|
|
|
|
//// final freshSnapshot = await transaction.get(record.reference);
|
|
|
|
|
//// final fresh = Record.fromSnapshot(freshSnapshot);
|
|
|
|
|
////
|
|
|
|
|
//// await transaction
|
|
|
|
|
//// .update(record.reference, {'votes': fresh.votes + 1});
|
|
|
|
|
//// }),
|
|
|
|
|
title: Text("Stall #" + record.stall.toString()),
|
|
|
|
|
trailing: Text("Open: " + record.open.toString()),
|
|
|
|
|
|
|
|
|
|
// onTap: () => Firestore.instance.runTransaction((transaction) async {
|
|
|
|
|
// final freshSnapshot = await transaction.get(record.reference);
|
|
|
|
|
// final fresh = Record.fromSnapshot(freshSnapshot);
|
|
|
|
|
//
|
|
|
|
|
// await transaction
|
|
|
|
|
// .update(record.reference, {'votes': fresh.votes + 1});
|
|
|
|
|
// }),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
@ -76,13 +77,19 @@ class _MyHomePageState extends State<MyHomePage> {
|
|
|
|
|
|
|
|
|
|
class Record {
|
|
|
|
|
final int stall;
|
|
|
|
|
final int passID;
|
|
|
|
|
final bool open;
|
|
|
|
|
final bool handicap;
|
|
|
|
|
final DocumentReference reference;
|
|
|
|
|
|
|
|
|
|
Record.fromMap(Map<String, dynamic> map, {this.reference})
|
|
|
|
|
: assert(map['handicap'] != null),
|
|
|
|
|
assert(map['Stall'] != null),
|
|
|
|
|
stall = map['Stall'],
|
|
|
|
|
assert(map['stall'] != null),
|
|
|
|
|
assert(map['passID'] != null),
|
|
|
|
|
assert(map['open'] != null),
|
|
|
|
|
stall = map['stall'],
|
|
|
|
|
passID = map['passID'],
|
|
|
|
|
open = map['open'],
|
|
|
|
|
handicap = map['handicap'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|