Removed refrences to name and vote from db
This commit is contained in:
parent
9d1967a9f0
commit
f50380306b
42
flutter_app/android/app/google-services.json
Normal file
42
flutter_app/android/app/google-services.json
Normal file
@ -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"
|
||||||
|
}
|
@ -51,7 +51,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
final record = Record.fromSnapshot(data);
|
final record = Record.fromSnapshot(data);
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
key: ValueKey(record.name),
|
key: ValueKey(record.stall),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -59,15 +59,15 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
borderRadius: BorderRadius.circular(5.0),
|
borderRadius: BorderRadius.circular(5.0),
|
||||||
),
|
),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
title: Text(record.name),
|
title: Text(record.stall.toString()),
|
||||||
trailing: Text(record.votes.toString()),
|
trailing: Text(record.handicap.toString()),
|
||||||
onTap: () => Firestore.instance.runTransaction((transaction) async {
|
// onTap: () => Firestore.instance.runTransaction((transaction) async {
|
||||||
final freshSnapshot = await transaction.get(record.reference);
|
//// final freshSnapshot = await transaction.get(record.reference);
|
||||||
final fresh = Record.fromSnapshot(freshSnapshot);
|
//// final fresh = Record.fromSnapshot(freshSnapshot);
|
||||||
|
////
|
||||||
await transaction
|
//// await transaction
|
||||||
.update(record.reference, {'votes': fresh.votes + 1});
|
//// .update(record.reference, {'votes': fresh.votes + 1});
|
||||||
}),
|
//// }),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -75,19 +75,21 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Record {
|
class Record {
|
||||||
final String name;
|
final int stall;
|
||||||
final int votes;
|
final bool handicap;
|
||||||
final DocumentReference reference;
|
final DocumentReference reference;
|
||||||
|
|
||||||
Record.fromMap(Map<String, dynamic> map, {this.reference})
|
Record.fromMap(Map<String, dynamic> map, {this.reference})
|
||||||
: assert(map['name'] != null),
|
: assert(map['handicap'] != null),
|
||||||
assert(map['votes'] != null),
|
assert(map['Stall'] != null),
|
||||||
name = map['name'],
|
stall = map['Stall'],
|
||||||
votes = map['votes'];
|
handicap = map['handicap'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Record.fromSnapshot(DocumentSnapshot snapshot)
|
Record.fromSnapshot(DocumentSnapshot snapshot)
|
||||||
: this.fromMap(snapshot.data, reference: snapshot.reference);
|
: this.fromMap(snapshot.data, reference: snapshot.reference);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => "Record<$name:$votes>";
|
String toString() => "Record<$stall>";
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user