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());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user