Skip to content

Commit

Permalink
Toast
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavya-ln committed Jul 30, 2021
1 parent dfd9559 commit 23440c3
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 2 deletions.
11 changes: 11 additions & 0 deletions lib/pages/item_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutterlogindesign/pages/donor_dashboard.dart';
import 'package:flutterlogindesign/pages/qr.dart';
import 'package:fluttertoast/fluttertoast.dart';

String generatedID;

Expand Down Expand Up @@ -95,6 +96,16 @@ class _State extends State<Itempage> {

generatedID = querySnapshot.id.toString() +
uidDonor.toString(); // Here we call the ID of the document
Fluttertoast.showToast(
msg: "Item added.",
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0
);


});

Expand Down
50 changes: 49 additions & 1 deletion lib/pages/signin_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:flutterlogindesign/widgets/btn_widget.dart';
import 'package:flutterlogindesign/widgets/Headdersignup.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:fluttertoast/fluttertoast.dart';

import 'donor_dashboard.dart';

Expand Down Expand Up @@ -142,6 +143,15 @@ class _LoginPageState extends State<LoginPage> {
check == "(2)" ||
check == "(0)") {
FirebaseAuth.instance.signOut();
Fluttertoast.showToast(
msg: "No account found",
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0
);
print("No account found");
} else {
Navigator.push(
Expand All @@ -165,6 +175,15 @@ class _LoginPageState extends State<LoginPage> {
check == "(1)" ||
check == "(0)") {
FirebaseAuth.instance.signOut();
Fluttertoast.showToast(
msg: "No account found",
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0
);
print("No account found");
} else {
Navigator.push(
Expand All @@ -188,6 +207,15 @@ class _LoginPageState extends State<LoginPage> {
check == "(1)" ||
check == "(0)") {
FirebaseAuth.instance.signOut();
Fluttertoast.showToast(
msg: "No account found",
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0
);
print("No account found");
} else {
Navigator.push(
Expand All @@ -198,8 +226,26 @@ class _LoginPageState extends State<LoginPage> {
}
} on FirebaseAuthException catch (e) {
if (e.code == 'user-not-found') {
Fluttertoast.showToast(
msg: "No user found for that email.",
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0
);
print('No user found for that email.');
} else if (e.code == 'wrong-password') {
Fluttertoast.showToast(
msg: "Wrong password provided for that user.",
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0
);
print('Wrong password provided for that user.');
}
}
Expand Down Expand Up @@ -231,6 +277,7 @@ class _LoginPageState extends State<LoginPage> {
color: Colors.black54,
decoration: TextDecoration.underline,
)),

]),
)
],
Expand All @@ -240,9 +287,10 @@ class _LoginPageState extends State<LoginPage> {
),
),
),

);
}

Widget _textInput({hint, icon, myController, obscure}) {
return Container(
margin: EdgeInsets.only(top: 10),
Expand Down
32 changes: 31 additions & 1 deletion lib/pages/signup_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:flutterlogindesign/pages/volunteer_page.dart';
import 'package:flutterlogindesign/widgets/btn_widget.dart';
import 'package:flutterlogindesign/widgets/Headdersignup.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:fluttertoast/fluttertoast.dart';

import 'donor_dashboard.dart';

Expand Down Expand Up @@ -127,12 +128,41 @@ class _RegPageState extends State<RegPage> {
}
} on FirebaseAuthException catch (e) {
if (e.code == 'weak-password') {
Fluttertoast.showToast(
msg: "The password provided is too weak.",
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0
);
print('The password provided is too weak.');
} else if (e.code == 'email-already-in-use') {
} else if (e.code == 'email-already-in-use') {
Fluttertoast.showToast(
msg: "The account already exists for that email.",
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0
);

print(
'The account already exists for that email.');
}
} catch (e) {
Fluttertoast.showToast(
msg: "$e",
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0
);

print(e);
}
},
Expand Down
7 changes: 7 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
fluttertoast:
dependency: "direct main"
description:
name: fluttertoast
url: "https://pub.dartlang.org"
source: hosted
version: "8.0.7"
http_parser:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ dependencies:
flutter:
sdk: flutter
firebase_core: "0.7.0"
fluttertoast: ^8.0.7



Expand Down

0 comments on commit 23440c3

Please sign in to comment.