mirror of
https://github.com/SoPat712/RUSwipeShare.git
synced 2025-08-21 19:08:46 -04:00
Merge branch 'master' of https://github.com/SoPat712/RUSwipeShare
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutterfire_ui/auth.dart';
|
||||
import 'home.dart';
|
||||
|
||||
class AuthGate extends StatelessWidget {
|
||||
const AuthGate({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
AssetImage ruExpressAsset = const AssetImage('assets/ruexpress.png');
|
||||
Image image = Image(image: ruExpressAsset, width: 400, height: 400);
|
||||
return StreamBuilder<User?>(
|
||||
stream: FirebaseAuth.instance.authStateChanges(),
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData) {
|
||||
return SignInScreen(
|
||||
showAuthActionSwitch: false,
|
||||
providerConfigs: const [
|
||||
GoogleProviderConfiguration(
|
||||
clientId: "291581242565-mjeocm5vqg9pntpnv5uk4o4mfoa0k5e6.apps.googleusercontent.com",
|
||||
)
|
||||
],
|
||||
|
||||
subtitleBuilder: (context, action) {
|
||||
return const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: Text('Welcome to RUSwipeShare, please sign in with your RUID Gmail account!')
|
||||
);
|
||||
},
|
||||
footerBuilder: (context, action) {
|
||||
return const Padding(
|
||||
padding: EdgeInsets.only(top: 16),
|
||||
child: Text(
|
||||
'By signing in, you agree to our terms and conditions.',
|
||||
style: TextStyle(color: Colors.grey),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
return const HomeScreen();
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
55
lib/auth_gate.dart
Normal file
55
lib/auth_gate.dart
Normal file
@@ -0,0 +1,55 @@
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutterfire_ui/auth.dart';
|
||||
|
||||
import 'home.dart';
|
||||
|
||||
class AuthGate extends StatelessWidget {
|
||||
const AuthGate({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return StreamBuilder<User?>(
|
||||
stream: FirebaseAuth.instance.authStateChanges(),
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData) {
|
||||
return SignInScreen(
|
||||
providerConfigs: const [
|
||||
EmailProviderConfiguration(),
|
||||
],
|
||||
headerBuilder: (context, constraints, shrinkOffset) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1,
|
||||
child: Image.asset(
|
||||
'assets/ruexpress.png',
|
||||
height: 60.0,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
subtitleBuilder: (context, action) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: action == AuthAction.signIn ? const Text('Welcome to RUSwipeShare, please sign in!') : const Text('Welcome to RUSwipeShare, please sign up!'),
|
||||
);
|
||||
},
|
||||
footerBuilder: (context, action) {
|
||||
return const Padding(
|
||||
padding: EdgeInsets.only(top: 16),
|
||||
child: Text(
|
||||
'By signing in, you agree to our terms and conditions.',
|
||||
style: TextStyle(color: Colors.grey),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
return const HomeScreen();
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,16 +1,16 @@
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:firebase_ui_auth/firebase_ui_auth.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:ruswipeshare/home.dart';
|
||||
import 'package:ruswipeshare/sell.dart';
|
||||
|
||||
import 'firebase_options.dart';
|
||||
import 'authGate.dart';
|
||||
import 'auth_gate.dart';
|
||||
|
||||
void main() async {
|
||||
// WidgetsFlutterBinding.ensureInitialized();
|
||||
// await Firebase.initializeApp(
|
||||
// options: DefaultFirebaseOptions.android,
|
||||
// );
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
|
||||
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
|
24
pubspec.lock
24
pubspec.lock
@@ -201,6 +201,30 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.3+30"
|
||||
firebase_ui_auth:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: firebase_ui_auth
|
||||
sha256: "67b52b2f7d607355a07bae28d67f28e7b52a1e555a7f7cd1455f2e95be4d0816"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.14"
|
||||
firebase_ui_localizations:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: firebase_ui_localizations
|
||||
sha256: "8ab06ef14bbad6c2f8af63aa2995016996c205fd05db7912df18838a51d023e4"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
firebase_ui_oauth:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: firebase_ui_oauth
|
||||
sha256: "77faba56761198f57b8939e4a93ef6dbabc1b972a22ff90ec1033dcff981a071"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.14"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
|
@@ -40,6 +40,7 @@ dependencies:
|
||||
flutterfire_ui: ^0.4.3+20
|
||||
google_sign_in: ^5.4.4
|
||||
flutter_dotenv: ^5.0.2
|
||||
firebase_ui_auth: ^1.1.14
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
@@ -64,9 +65,9 @@ flutter:
|
||||
uses-material-design: true
|
||||
|
||||
# To add assets to your application, add an assets section, like this:
|
||||
assets:
|
||||
- .env
|
||||
- assets/ruexpress.png
|
||||
assets:
|
||||
- .env
|
||||
- assets/
|
||||
|
||||
# An image asset can refer to one or more resolution-specific "variants", see
|
||||
# https://flutter.dev/assets-and-images/#resolution-aware
|
||||
|
Reference in New Issue
Block a user