Created the [FirestoreProvider], added the id attribute to the user, event and task models
This commit is contained in:
parent
5c2375fb21
commit
c1a0487071
5 changed files with 146 additions and 19 deletions
|
|
@ -1,11 +1,30 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import './models/event_model.dart';
|
||||
import './models/task_model.dart';
|
||||
import './models/user_model.dart';
|
||||
import './resources/firebase_provider.dart';
|
||||
import './resources/firestore_provider.dart';
|
||||
|
||||
class App extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final fire = FirebaseProvider();
|
||||
final fire = FirestoreProvider();
|
||||
return MaterialApp(
|
||||
title: 'Do more',
|
||||
//home: Text('Start'),
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('DO>'),
|
||||
),
|
||||
body: Text('Tasks'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
class App extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final fire = FirestoreProvider();
|
||||
return MaterialApp(
|
||||
title: 'Do more',
|
||||
//home: Text('Start'),
|
||||
|
|
@ -14,22 +33,28 @@ class App extends StatelessWidget {
|
|||
title: Text('DO>'),
|
||||
),
|
||||
body: StreamBuilder(
|
||||
stream: fire.getUser('mariano159357'),
|
||||
builder:
|
||||
(BuildContext context, AsyncSnapshot<UserModel> userSnapshot) {
|
||||
stream: fire.getUserEvents('vBOvtmTeC8iPg8L4Hixh'),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<List<EventModel>> userSnapshot) {
|
||||
if (!userSnapshot.hasData) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
final children = <Widget>[
|
||||
MaterialButton(
|
||||
onPressed: () {},
|
||||
child: Text('Add task'),
|
||||
),
|
||||
];
|
||||
//children.add(Text(userSnapshot.data.text));
|
||||
|
||||
userSnapshot.data.forEach((EventModel task) {
|
||||
children.add(Text(task.name));
|
||||
});
|
||||
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
Text('${userSnapshot.data.pendingHigh}'),
|
||||
MaterialButton(
|
||||
onPressed: () {},
|
||||
child: Text('Add task'),
|
||||
),
|
||||
],
|
||||
children: children,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
|
@ -37,3 +62,4 @@ class App extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue