Skip to content

Commit

Permalink
v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
iamzaidsoomro committed Jul 24, 2022
1 parent 4bc406b commit e976777
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 17 deletions.
Binary file added food_recipe/assets/splashScreenImage.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added food_recipe/assets/splashScreenImage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 0 additions & 8 deletions food_recipe/lib/components/Drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ class MyDrawer extends StatelessWidget {
currentAccountPicture: const CircleAvatar(
backgroundImage: AssetImage('assets/userIcon.png'),
)),
const ListTile(
leading: Icon(Icons.home),
title: Text('Home'),
),
ListTile(
leading: const Icon(Icons.favorite),
title: const Text('Favorites'),
Expand All @@ -37,10 +33,6 @@ class MyDrawer extends StatelessWidget {
);
},
),
const ListTile(
leading: Icon(Icons.settings),
title: Text('Settings'),
),
ListTile(
onTap: () {
Navigator.pushAndRemoveUntil(
Expand Down
3 changes: 2 additions & 1 deletion food_recipe/lib/components/userbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ class UserBar extends StatelessWidget {

@override
Widget build(BuildContext context) {
var _userName = FirebaseAuth.instance.currentUser?.displayName;
var _userName =
FirebaseAuth.instance.currentUser?.displayName.toString().split(' ')[0];
return Padding(
padding: const EdgeInsets.all(20),
child: Container(
Expand Down
30 changes: 29 additions & 1 deletion food_recipe/lib/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:food_recipe/homepage.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:food_recipe/signup.dart';
import 'package:splashscreen/splashscreen.dart';

class Login extends StatelessWidget {
const Login({Key? key}) : super(key: key);
Expand Down Expand Up @@ -108,7 +109,34 @@ class Login extends StatelessWidget {
context,
MaterialPageRoute(
builder: ((context) =>
HomePage())),
SplashScreen(
seconds: 5,
navigateAfterSeconds:
HomePage(),
backgroundColor: Theme
.of(context)
.scaffoldBackgroundColor,
title: Text('Cookpad',
style: TextStyle(
fontSize: 50,
fontWeight:
FontWeight
.bold,
color: Colors
.white)),
gradientBackground:
LinearGradient(
colors: [
Color(0xff1e2757),
Color(0xff141a3a)
],
begin: Alignment
.topLeft,
end: Alignment
.bottomRight,
),
useLoader: false,
))),
(route) => false),
ScaffoldMessenger.of(context)
.clearSnackBars(),
Expand Down
55 changes: 55 additions & 0 deletions food_recipe/lib/settings.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import 'package:flutter/material.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:food_recipe/loginsignup.dart';

class Settings extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Settings",
style: TextStyle(color: Theme.of(context).primaryColor)),
centerTitle: true,
iconTheme: IconThemeData(color: Theme.of(context).primaryColor),
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
elevation: 0,
),
body: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
ListTile(
title: Text('Delete Account',
style: TextStyle(fontSize: 20, color: Colors.redAccent)),
onTap: () {
FirebaseFirestore.instance
.collection('users')
.doc(FirebaseAuth.instance.currentUser?.email)
.delete();
FirebaseAuth.instance.currentUser!.delete();
Navigator.pushAndRemoveUntil(
context,
PageRouteBuilder(pageBuilder: (BuildContext context,
Animation animation, Animation secondaryAnimation) {
return LoginSignup();
}, transitionsBuilder: (BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
Widget child) {
return new SlideTransition(
position: new Tween<Offset>(
begin: const Offset(1.0, 0.0),
end: Offset.zero,
).animate(animation),
child: child,
);
}),
(Route route) => false);
},
)
],
)),
);
}
}
33 changes: 26 additions & 7 deletions food_recipe/lib/signup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:food_recipe/login.dart';
import 'package:food_recipe/loginsignup.dart';
import 'package:group_radio_button/group_radio_button.dart';
import 'package:splashscreen/splashscreen.dart';

class SignUp extends StatefulWidget {
const SignUp({Key? key}) : super(key: key);
Expand Down Expand Up @@ -186,13 +187,31 @@ class _SignUpState extends State<SignUp> {
ScaffoldMessenger.of(
context)
.hideCurrentSnackBar(),
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder:
((context) =>
HomePage())),
(route) => false),
Navigator
.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder: ((context) =>
SplashScreen(
seconds:
5,
navigateAfterSeconds:
HomePage(),
backgroundColor:
Theme.of(context).scaffoldBackgroundColor,
image:
Image.asset('assets/logo.png'),
photoSize:
(MediaQuery.of(context).size.width * 0.3),
title:
Text('Cookpad', style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold, color: Theme.of(context).primaryColor)),
useLoader:
false,
loadingText:
Text("The Recipe Searching App", style: TextStyle(color: Theme.of(context).primaryColor, fontSize: 20)),
))),
(route) =>
false),
ScaffoldMessenger.of(
context)
.showSnackBar(
Expand Down
7 changes: 7 additions & 0 deletions food_recipe/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
splashscreen:
dependency: "direct main"
description:
name: splashscreen
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.5"
stack_trace:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions food_recipe/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ dependencies:
cloud_firestore: ^3.3.0
group_radio_button: ^1.2.0
flutter_launcher_icons: ^0.9.3
splashscreen: ^1.3.5

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit e976777

Please sign in to comment.