languages

A collection of programs made with different programming languages.
git clone git://evanalba.com/languages
Log | Files | Refs

auth_page.dart (629B)


      1 import 'package:firebase_auth/firebase_auth.dart';
      2 import 'package:flutter/material.dart';
      3 import 'package:penny/pages/login_or_register.dart';
      4 import 'home_page.dart';
      5 
      6 
      7 class AuthPage extends StatelessWidget {
      8   const AuthPage({super.key});
      9 
     10   @override
     11   Widget build(BuildContext context) {
     12     return Scaffold(
     13       body: StreamBuilder<User?>(
     14         stream: FirebaseAuth.instance.authStateChanges(),
     15         builder: (context, snapshot) {
     16           if (snapshot.hasData) {
     17             return const HomePage();
     18           } else {
     19             return const LoginOrRegisterPage();
     20           }
     21         },
     22       ),
     23     );
     24   }
     25 }