29 lines
741 B
Dart
29 lines
741 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:firebase_auth/firebase_auth.dart';
|
|
import 'package:cofounderella/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 const MyHomePage(title: "MyHomePage Test Title",);
|
|
}
|
|
else {
|
|
return const LoginOrRegister();
|
|
}
|
|
|
|
|
|
},
|
|
),
|
|
);
|
|
}
|
|
} |