-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added Form widget to signup page * Added Form validation to signup page * Made Form Validation.dart * Added Form validation to all fields in signup page Moving forward, use flutter:validators library to conduct form field checks * Made Sign Up Page scrollable * Added proper sign up functionality * Completed half update of user data from sign up page * Added server-side signup functionality * Configured Firebase * Added sign in functoinality * Commented out supabase stuff * Bypassed splash page * Shifted user authstate flow to main_page.dart * reverted prev commit * Enabled login funcitonality * Added logout functionality to feed page * fixed setState before build issue * removed firebase auth logic for navigating through pages, for now * Added auth_services.dart * Added auth_provider.dart * Rearranged some files * Added home_controller.dart * configured main.dart to use hom controller * Added sign up functionality * minor edits
- Loading branch information
1 parent
48d9896
commit 70f3744
Showing
28 changed files
with
650 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
{ | ||
"project_info": { | ||
"project_number": "10879165640", | ||
"project_id": "justsharelah-6dca5", | ||
"storage_bucket": "justsharelah-6dca5.appspot.com" | ||
}, | ||
"client": [ | ||
{ | ||
"client_info": { | ||
"mobilesdk_app_id": "1:10879165640:android:c657eaf794db8614dff1fd", | ||
"android_client_info": { | ||
"package_name": "com.example.justsharelah_v1" | ||
} | ||
}, | ||
"oauth_client": [ | ||
{ | ||
"client_id": "10879165640-678p35fbbk6hq6upl2m32tl5mi54o8d7.apps.googleusercontent.com", | ||
"client_type": 3 | ||
} | ||
], | ||
"api_key": [ | ||
{ | ||
"current_key": "AIzaSyCp1VNKc82AuklUJVaLTWczmSflEcmYAzE" | ||
} | ||
], | ||
"services": { | ||
"appinvite_service": { | ||
"other_platform_oauth_client": [ | ||
{ | ||
"client_id": "10879165640-678p35fbbk6hq6upl2m32tl5mi54o8d7.apps.googleusercontent.com", | ||
"client_type": 3 | ||
}, | ||
{ | ||
"client_id": "10879165640-82ja20ouc8u9tu8id6cbr81nffqkd03p.apps.googleusercontent.com", | ||
"client_type": 2, | ||
"ios_info": { | ||
"bundle_id": "com.summer.justsharelah" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
"client_info": { | ||
"mobilesdk_app_id": "1:10879165640:android:387e1e6c8d037fd4dff1fd", | ||
"android_client_info": { | ||
"package_name": "com.summer.justsharelah" | ||
} | ||
}, | ||
"oauth_client": [ | ||
{ | ||
"client_id": "10879165640-ipqeaemtarv9h5kpgsr216su9r9pueqk.apps.googleusercontent.com", | ||
"client_type": 1, | ||
"android_info": { | ||
"package_name": "com.summer.justsharelah", | ||
"certificate_hash": "9b1b89208acdf122cea3ff6c734bd622640ee6aa" | ||
} | ||
}, | ||
{ | ||
"client_id": "10879165640-678p35fbbk6hq6upl2m32tl5mi54o8d7.apps.googleusercontent.com", | ||
"client_type": 3 | ||
} | ||
], | ||
"api_key": [ | ||
{ | ||
"current_key": "AIzaSyCp1VNKc82AuklUJVaLTWczmSflEcmYAzE" | ||
} | ||
], | ||
"services": { | ||
"appinvite_service": { | ||
"other_platform_oauth_client": [ | ||
{ | ||
"client_id": "10879165640-678p35fbbk6hq6upl2m32tl5mi54o8d7.apps.googleusercontent.com", | ||
"client_type": 3 | ||
}, | ||
{ | ||
"client_id": "10879165640-82ja20ouc8u9tu8id6cbr81nffqkd03p.apps.googleusercontent.com", | ||
"client_type": 2, | ||
"ios_info": { | ||
"bundle_id": "com.summer.justsharelah" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
], | ||
"configuration_version": "1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"file_generated_by": "FlutterFire CLI", | ||
"purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory", | ||
"GOOGLE_APP_ID": "1:10879165640:ios:f463674769a076dadff1fd", | ||
"FIREBASE_PROJECT_ID": "justsharelah-6dca5", | ||
"GCM_SENDER_ID": "10879165640" | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'auth_service.dart'; | ||
|
||
class Provider extends InheritedWidget { | ||
final AuthService auth; | ||
const Provider({ | ||
Key? key, | ||
required Widget child, | ||
required this.auth, | ||
}) : super(key: key, child: child); | ||
|
||
@override | ||
bool updateShouldNotify(InheritedWidget oldWiddget) { | ||
return true; | ||
} | ||
|
||
static Provider? of(BuildContext context) => | ||
(context.dependOnInheritedWidgetOfExactType<Provider>()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import 'package:firebase_auth/firebase_auth.dart'; | ||
import 'package:google_sign_in/google_sign_in.dart'; | ||
|
||
class AuthService { | ||
final FirebaseAuth _firebaseAuth = FirebaseAuth.instance; | ||
final GoogleSignIn _googleSignIn = GoogleSignIn(); | ||
|
||
Stream<User?> get onAuthStateChanged => _firebaseAuth.authStateChanges(); | ||
|
||
// GET UID | ||
Future<String?> getCurrentUID() async { | ||
return _firebaseAuth.currentUser?.uid; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// File generated by FlutterFire CLI. | ||
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members | ||
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; | ||
import 'package:flutter/foundation.dart' | ||
show defaultTargetPlatform, kIsWeb, TargetPlatform; | ||
|
||
/// Default [FirebaseOptions] for use with your Firebase apps. | ||
/// | ||
/// Example: | ||
/// ```dart | ||
/// import 'firebase_options.dart'; | ||
/// // ... | ||
/// ``` | ||
class DefaultFirebaseOptions { | ||
static FirebaseOptions get currentPlatform { | ||
if (kIsWeb) { | ||
return web; | ||
} | ||
switch (defaultTargetPlatform) { | ||
case TargetPlatform.android: | ||
return android; | ||
case TargetPlatform.iOS: | ||
return ios; | ||
case TargetPlatform.macOS: | ||
return macos; | ||
case TargetPlatform.windows: | ||
throw UnsupportedError( | ||
'DefaultFirebaseOptions have not been configured for windows - ' | ||
'you can reconfigure this by running the FlutterFire CLI again.', | ||
); | ||
case TargetPlatform.linux: | ||
throw UnsupportedError( | ||
'DefaultFirebaseOptions have not been configured for linux - ' | ||
'you can reconfigure this by running the FlutterFire CLI again.', | ||
); | ||
default: | ||
throw UnsupportedError( | ||
'DefaultFirebaseOptions are not supported for this platform.', | ||
); | ||
} | ||
} | ||
|
||
static const FirebaseOptions web = FirebaseOptions( | ||
apiKey: 'AIzaSyAmt6eFJ7rvE-ke6AVJ01wDzUwpbUqnVKI', | ||
appId: '1:10879165640:web:e8fc1af81bacce30dff1fd', | ||
messagingSenderId: '10879165640', | ||
projectId: 'justsharelah-6dca5', | ||
authDomain: 'justsharelah-6dca5.firebaseapp.com', | ||
storageBucket: 'justsharelah-6dca5.appspot.com', | ||
measurementId: 'G-G1LWCXS2T0', | ||
); | ||
|
||
static const FirebaseOptions android = FirebaseOptions( | ||
apiKey: 'AIzaSyCp1VNKc82AuklUJVaLTWczmSflEcmYAzE', | ||
appId: '1:10879165640:android:c657eaf794db8614dff1fd', | ||
messagingSenderId: '10879165640', | ||
projectId: 'justsharelah-6dca5', | ||
storageBucket: 'justsharelah-6dca5.appspot.com', | ||
); | ||
|
||
static const FirebaseOptions ios = FirebaseOptions( | ||
apiKey: 'AIzaSyDQsTMIfIVUGUi9bfyHjBpgQPzo-4vHPhc', | ||
appId: '1:10879165640:ios:f463674769a076dadff1fd', | ||
messagingSenderId: '10879165640', | ||
projectId: 'justsharelah-6dca5', | ||
storageBucket: 'justsharelah-6dca5.appspot.com', | ||
androidClientId: '10879165640-ipqeaemtarv9h5kpgsr216su9r9pueqk.apps.googleusercontent.com', | ||
iosClientId: '10879165640-q602g5sl8aupgj1vmh1mfj22u8qp9vf6.apps.googleusercontent.com', | ||
iosBundleId: 'com.example.justsharelahV1', | ||
); | ||
|
||
static const FirebaseOptions macos = FirebaseOptions( | ||
apiKey: 'AIzaSyDQsTMIfIVUGUi9bfyHjBpgQPzo-4vHPhc', | ||
appId: '1:10879165640:ios:f463674769a076dadff1fd', | ||
messagingSenderId: '10879165640', | ||
projectId: 'justsharelah-6dca5', | ||
storageBucket: 'justsharelah-6dca5.appspot.com', | ||
androidClientId: '10879165640-ipqeaemtarv9h5kpgsr216su9r9pueqk.apps.googleusercontent.com', | ||
iosClientId: '10879165640-q602g5sl8aupgj1vmh1mfj22u8qp9vf6.apps.googleusercontent.com', | ||
iosBundleId: 'com.example.justsharelahV1', | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import 'package:firebase_auth/firebase_auth.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:justsharelah_v1/pages/feed_page.dart'; | ||
import 'package:justsharelah_v1/pages/login_page.dart'; | ||
|
||
import 'firebase/auth_provider.dart'; | ||
import 'firebase/auth_service.dart'; | ||
|
||
class HomeController extends StatelessWidget { | ||
const HomeController({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final AuthService auth = Provider.of(context)!.auth; | ||
|
||
return StreamBuilder( | ||
stream: auth.onAuthStateChanged, | ||
builder: (context, AsyncSnapshot<User?> snapshot) { | ||
if (snapshot.connectionState == ConnectionState.active) { | ||
final bool signedIn = snapshot.hasData; | ||
return signedIn ? const FeedPage() : const LoginPage(); | ||
} | ||
return Container( | ||
color: Colors.black, | ||
); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,55 @@ | ||
import 'package:firebase_core/firebase_core.dart'; | ||
import 'package:firebase_auth/firebase_auth.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:justsharelah_v1/apptheme.dart'; | ||
import 'package:justsharelah_v1/firebase/auth_service.dart'; | ||
import 'package:justsharelah_v1/utils/apptheme.dart'; | ||
import 'package:justsharelah_v1/pages/activity.dart'; | ||
import 'package:justsharelah_v1/pages/addListing.dart'; | ||
import 'package:justsharelah_v1/pages/feed_page.dart'; | ||
import 'package:justsharelah_v1/pages/forget_password.dart'; | ||
import 'package:justsharelah_v1/home_controller.dart'; | ||
import 'package:justsharelah_v1/pages/signup_page.dart'; | ||
import 'package:justsharelah_v1/pages/profile_page.dart'; | ||
import 'package:supabase_flutter/supabase_flutter.dart'; | ||
import 'package:justsharelah_v1/pages/account_page.dart'; | ||
import 'package:justsharelah_v1/pages/login_page.dart'; | ||
import 'package:justsharelah_v1/pages/splash_page.dart'; | ||
import 'package:google_fonts/google_fonts.dart'; | ||
import 'package:justsharelah_v1/pages/chat_page.dart'; | ||
|
||
import 'firebase/auth_provider.dart'; | ||
import 'firebase/firebase_options.dart'; | ||
|
||
Future<void> main() async { | ||
WidgetsFlutterBinding.ensureInitialized(); | ||
|
||
// TODO: Use .env | ||
await Supabase.initialize( | ||
url: 'https://etegbwhzssurytyojhtf.supabase.co', | ||
anonKey: | ||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImV0ZWdid2h6c3N1cnl0eW9qaHRmIiwicm9sZSI6ImFub24iLCJpYXQiOjE2NTMyMTIyMjEsImV4cCI6MTk2ODc4ODIyMX0.AbyAtt9P8DPc1MuvfAaPmZ03xI9LjA4L1jc3NZujPbU', | ||
await Firebase.initializeApp( | ||
options: DefaultFirebaseOptions.currentPlatform, | ||
); | ||
runApp(MyApp()); | ||
} | ||
|
||
final navigatorKey = GlobalKey<NavigatorState>(); | ||
|
||
class MyApp extends StatelessWidget { | ||
const MyApp({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
title: 'JustShareLah', | ||
theme: AppTheme().buildThemeData(), | ||
initialRoute: '/', | ||
routes: <String, WidgetBuilder>{ | ||
'/': (_) => const SplashPage(), | ||
'/forget_password': (_) => const ForgetPassword(), | ||
'/login': (_) => const LoginPage(), | ||
'/signup': (_) => const SignupPage(), | ||
'/feed': (_) => const FeedPage(), | ||
'/chat': (_) => const ChatPage(), | ||
'/addlisting': (_) => const AddListingPage(), | ||
'/profile': (_) => const ProfilePage(), | ||
'/activity': (_) => const ActivityPage(), | ||
}, | ||
return Provider( | ||
auth: AuthService(), | ||
child: MaterialApp( | ||
title: 'JustShareLah', | ||
theme: AppTheme().buildThemeData(), | ||
navigatorKey: navigatorKey, | ||
home: const HomeController(), | ||
routes: <String, WidgetBuilder>{ | ||
'/forget_password': (_) => const ForgetPassword(), | ||
'/login': (_) => const LoginPage(), | ||
'/signup': (_) => const SignupPage(), | ||
'/feed': (_) => const FeedPage(), | ||
'/chat': (_) => const ChatPage(), | ||
'/addlisting': (_) => const AddListingPage(), | ||
'/profile': (_) => const ProfilePage(), | ||
'/activity': (_) => const ActivityPage(), | ||
}, | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.