From f50380306b1ec18cb028e8417ffe5ade410999f0 Mon Sep 17 00:00:00 2001 From: Thomas Atkins Date: Sat, 9 Feb 2019 00:06:20 -0600 Subject: [PATCH] Removed refrences to name and vote from db --- flutter_app/android/app/google-services.json | 42 ++++++++++++++++++++ flutter_app/lib/main.dart | 36 +++++++++-------- 2 files changed, 61 insertions(+), 17 deletions(-) create mode 100644 flutter_app/android/app/google-services.json diff --git a/flutter_app/android/app/google-services.json b/flutter_app/android/app/google-services.json new file mode 100644 index 0000000..f3ecf5b --- /dev/null +++ b/flutter_app/android/app/google-services.json @@ -0,0 +1,42 @@ +{ + "project_info": { + "project_number": "541811372013", + "firebase_url": "https://hackku.firebaseio.com", + "project_id": "hackku", + "storage_bucket": "hackku.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:541811372013:android:63dc196b5890f0e2", + "android_client_info": { + "package_name": "com.glmdev.waitnomore.flutterapp" + } + }, + "oauth_client": [ + { + "client_id": "541811372013-k0nheic39d5v6bbgokl0ajg06otf8rus.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyBoOxFcUyUsi2PW3QXw86FnQZ__1TCEI2s" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 1, + "other_platform_oauth_client": [] + }, + "ads_service": { + "status": 2 + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/flutter_app/lib/main.dart b/flutter_app/lib/main.dart index 79119a8..93c25e3 100644 --- a/flutter_app/lib/main.dart +++ b/flutter_app/lib/main.dart @@ -51,7 +51,7 @@ class _MyHomePageState extends State { final record = Record.fromSnapshot(data); return Padding( - key: ValueKey(record.name), + key: ValueKey(record.stall), padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), child: Container( decoration: BoxDecoration( @@ -59,15 +59,15 @@ class _MyHomePageState extends State { borderRadius: BorderRadius.circular(5.0), ), child: ListTile( - title: Text(record.name), - trailing: Text(record.votes.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(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}); +//// }), ), ), ); @@ -75,19 +75,21 @@ class _MyHomePageState extends State { } class Record { - final String name; - final int votes; + final int stall; + final bool handicap; final DocumentReference reference; Record.fromMap(Map map, {this.reference}) - : assert(map['name'] != null), - assert(map['votes'] != null), - name = map['name'], - votes = map['votes']; + : assert(map['handicap'] != null), + assert(map['Stall'] != null), + stall = map['Stall'], + handicap = map['handicap']; + + Record.fromSnapshot(DocumentSnapshot snapshot) : this.fromMap(snapshot.data, reference: snapshot.reference); @override - String toString() => "Record<$name:$votes>"; + String toString() => "Record<$stall>"; } \ No newline at end of file