Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Email Auth(#27) #147

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/promo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 4 additions & 5 deletions lib/dashboard.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import 'package:flutter/material.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
import 'package:provider/provider.dart';
import 'package:retro_shopping/views/login.dart';
import 'package:retro_shopping/views/cart.dart';
import 'package:retro_shopping/views/home.dart';
import 'package:retro_shopping/views/search.dart';
import 'package:retro_shopping/views/cart_view.dart';
import 'package:retro_shopping/views/home_view.dart';
import 'package:retro_shopping/views/search_view.dart';
import 'helpers/ad_state.dart';
import 'views/profile.dart';
import 'views/profile/profile_view.dart';
import 'widgets/bottom_nav_bar.dart';

class Dashboard extends StatefulWidget {
Expand Down
5 changes: 2 additions & 3 deletions lib/helpers/constants.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import 'package:flutter/material.dart';
import 'package:retro_shopping/model/product.dart';
import 'package:retro_shopping/model/product_model.dart';
import 'package:retro_shopping/widgets/product/product_card.dart';

// Route Names

class RouteConstant {
static const String SPLASH_SCREEN = '/';
static const String DASHBOARD_SCREEN = '/dashboard';
static const String HOME_SCREEN = '/home';
static const String LOGIN_SCREEN = '/auth';
Expand All @@ -16,7 +15,7 @@ class RouteConstant {
static const String CART_SCREEN = '/cart';
static const String ORDERS_SCREEN = '/orders';
static const String SETTINGS_SCREEN = '/settings';
static const String ABOUT_SCREEN = 'about';
static const String ABOUT_SCREEN = '/about';
}

class RelicColors {
Expand Down
16 changes: 12 additions & 4 deletions lib/helpers/route_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import 'package:retro_shopping/dashboard.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:retro_shopping/helpers/slide_route.dart';

import 'package:retro_shopping/views/cart.dart';
import 'package:retro_shopping/views/home.dart';
import 'package:retro_shopping/views/profile.dart';
import 'package:retro_shopping/views/search.dart';
import 'package:retro_shopping/views/cart_view.dart';
import 'package:retro_shopping/views/home_view.dart';
import 'package:retro_shopping/views/profile/profile_view.dart';
import 'package:retro_shopping/views/search_view.dart';
import 'package:retro_shopping/widgets/product/product_page.dart';

class RoutePage {
Expand All @@ -21,26 +21,31 @@ class RoutePage {
return SlideLeftRoute(
page: Home(),
);

case RouteConstant.LOGIN_SCREEN:
return SlideLeftRoute(
page: const SizedBox(
child: Text('Login Screen'),
),
);

case RouteConstant.PROFILE_SCREEN:
return SlideLeftRoute(
page: ProfilePage(),
);

case RouteConstant.SEARCH_SCREEN:
return SlideLeftRoute(
page: Search(),
);

case RouteConstant.ABOUT_SCREEN:
return SlideLeftRoute(
page: const SizedBox(
child: Text('About'),
),
);

case RouteConstant.DASHBOARD_SCREEN:
return SlideLeftRoute(
page: Dashboard(),
Expand All @@ -49,18 +54,21 @@ class RoutePage {
return SlideBottomRoute(
page: ProductPage(),
);

case RouteConstant.WISHLIST_SCREEN:
return SlideLeftRoute(
page: const SizedBox(
child: Text('Wishlist Screen'),
),
);

case RouteConstant.ORDERS_SCREEN:
return SlideLeftRoute(
page: const SizedBox(
child: Text('Orders Screen'),
),
);

case RouteConstant.SETTINGS_SCREEN:
return SlideLeftRoute(
page: const SizedBox(
Expand Down
5 changes: 2 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ import 'package:provider/provider.dart';
import 'package:retro_shopping/helpers/ad_state.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
import 'package:retro_shopping/views/login.dart';
import 'package:retro_shopping/views/auth/login_view.dart';
import 'dashboard.dart';



Future<void> main() async {
//firebase Initialization
WidgetsFlutterBinding.ensureInitialized();
Expand Down Expand Up @@ -55,6 +53,7 @@ class MyApp extends StatelessWidget {
GoogleFonts.poppinsTextTheme(Theme.of(context).textTheme)),
routes: <String, WidgetBuilder>{
'/login': (BuildContext context) => LoginScreen(),
'/dashboard': (BuildContext context) => Dashboard(),
},
home: LoginScreen(),
),
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 30 additions & 0 deletions lib/services/auth_service.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import 'package:google_sign_in/google_sign_in.dart';
import 'package:firebase_auth/firebase_auth.dart';

class AuthenticationService {
static Future<String> signInWithGoogle() async {
final GoogleSignInAccount googleSignInAccount =
await GoogleSignIn().signIn();
final GoogleSignInAuthentication googleSignInAuthentication =
await googleSignInAccount.authentication;

final AuthCredential credential = GoogleAuthProvider.credential(
accessToken: googleSignInAuthentication.accessToken,
idToken: googleSignInAuthentication.idToken,
);

final UserCredential authResult =
await FirebaseAuth.instance.signInWithCredential(credential);
final User user = authResult.user;
assert(!user.isAnonymous);

final User currentUser = FirebaseAuth.instance.currentUser;
assert(user.uid == currentUser.uid);

return '$user';
}

static Future<void> signOutGoogle() async {
await GoogleSignIn().signOut();
}
}
32 changes: 0 additions & 32 deletions lib/services/google_auth.dart

This file was deleted.

Loading