27 lines
709 B
Dart
27 lines
709 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:firebase_auth/firebase_auth.dart';
|
|
import 'package:cofounderella/services/auth/login_or_register.dart';
|
|
import 'package:cofounderella/pages/home_page.dart';
|
|
|
|
class AuthGate extends StatelessWidget{
|
|
const AuthGate({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: StreamBuilder(
|
|
stream: FirebaseAuth.instance.authStateChanges(),
|
|
builder: (context, snapshot){
|
|
|
|
// check if user is logged in or not
|
|
if(snapshot.hasData){
|
|
return HomePage();
|
|
}
|
|
else {
|
|
return const LoginOrRegister();
|
|
}
|
|
},
|
|
),
|
|
);
|
|
}
|
|
} |