Skip to content

Commit

Permalink
Maps left
Browse files Browse the repository at this point in the history
  • Loading branch information
deliciafernandes committed Nov 27, 2020
1 parent c7b4b28 commit 9ec2ed5
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ import 'package:flutter/material.dart';

class CheckIfUserLoggedIn extends ChangeNotifier {
bool _userLoggedIn = false;
FirebaseUser loggedInUser;

String getCurrentUserEmail() {
loggedInUser = _auth.currentUser;
return loggedInUser.email;
}

final _auth = FirebaseAuth.instance;
bool getCurrentUser() {
Expand Down
25 changes: 24 additions & 1 deletion lib/models/reminder_db.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import 'dart:collection';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'check_if_user_logged_in.dart';
import 'reminder.dart';

class ReminderDB extends ChangeNotifier {
final _firestore = Firestore.instance;
CheckIfUserLoggedIn checkIfUserLoggedIn = CheckIfUserLoggedIn();

List<Reminder> _reminderList = [
// Reminder(
// title: 'Reminder Title',
Expand All @@ -24,12 +29,28 @@ class ReminderDB extends ChangeNotifier {
final reminder = Reminder(
title: title,
description: description,
// date: 'Today',
date: date,
time: time,
);

_reminderList.add(reminder);
_firestore.collection('reminders').add({
'title': title,
'description': description,
'date': date,
'time': time,
});

// if (checkIfUserLoggedIn.getCurrentUserEmail() != null) {
// _reminderList.add(reminder);
// _firestore.collection('reminders').add({
// 'title': title,
// 'description': description,
// 'date': date,
// 'time': time,
// });
// }

notifyListeners();
}

Expand All @@ -40,6 +61,8 @@ class ReminderDB extends ChangeNotifier {

void deleteReminder(Reminder reminder) {
_reminderList.remove(reminder);

// _firestore.collection('reminders').document('wgbhYkrUEKDMnsvYTiHZ')
notifyListeners();
}
}
2 changes: 1 addition & 1 deletion lib/views/account_view.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:checklst/utilities/check_if_user_logged_in.dart';
import 'package:checklst/models/check_if_user_logged_in.dart';
import 'package:checklst/views/body_widgets/auth_body.dart';
import 'package:checklst/views/body_widgets/profile_body.dart';
import "package:flutter/material.dart";
Expand Down
2 changes: 1 addition & 1 deletion lib/views/body_widgets/auth_body.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:checklst/utilities/check_if_user_logged_in.dart';
import 'package:checklst/models/check_if_user_logged_in.dart';
import 'package:checklst/widgets/custom_text_form_field.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
Expand Down
4 changes: 2 additions & 2 deletions lib/views/index.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:checklst/utilities/check_if_user_logged_in.dart';
import 'package:checklst/widgets/bottom_reminder_sheet.dart';
import 'package:checklst/models/check_if_user_logged_in.dart';
import 'package:checklst/widgets/bottom_reminder_modal_sheet.dart';
import 'package:checklst/widgets/fab_bottom_app_bar.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
Expand Down
File renamed without changes.

0 comments on commit 9ec2ed5

Please sign in to comment.