Skip to content

Commit

Permalink
v1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Antoine committed Aug 8, 2021
1 parent ffca8cb commit 04b8a81
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 0 additions & 2 deletions lib/services/google.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class Google {
final url = Uri.parse(rootUrl + 'lists/' + taskList.id + '/tasks');
final body = json.encode(item.toJson());
final headers = await header;
print('Body: $body');
await post(url, headers: headers, body: body);
}

Expand Down Expand Up @@ -84,6 +83,5 @@ class Google {
final GoogleSignInAuthentication? googleSignInAuthentication =
await googleSignInAccount?.authentication;
_token = googleSignInAuthentication?.accessToken;
print('Token = $_token');
}
}
3 changes: 1 addition & 2 deletions lib/view_models/view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ class ViewModel with ChangeNotifier {
}

Future getItems() async {
items.clear();
sources.values.forEach((source) async {
items.addAll(await source.getItems());
notifyListeners();
print('${source.name} is done.');
});
}

Expand All @@ -44,7 +44,6 @@ class ViewModel with ChangeNotifier {
}

Future<bool> add(Item item) async {
print('Time to create a new ${item.title}');
await sources[Source.Google]!.add(item);
await delete(item);
return false;
Expand Down
17 changes: 10 additions & 7 deletions lib/views/main_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ class MainScreen extends StatelessWidget {
.toList(),
),
Expanded(
child: ListView.builder(
itemCount: model.items.length,
itemBuilder: (_, index) => ItemWidget(
model.items[index],
onDelete: model.delete,
onDismiss: model.dismiss,
onAdd: model.add,
child: RefreshIndicator(
onRefresh: () => model.getItems(),
child: ListView.builder(
itemCount: model.items.length,
itemBuilder: (_, index) => ItemWidget(
model.items[index],
onDelete: model.delete,
onDismiss: model.dismiss,
onAdd: model.add,
),
),
),
)
Expand Down

0 comments on commit 04b8a81

Please sign in to comment.