35 lines
972 B
Dart
35 lines
972 B
Dart
import 'package:firebase_auth/firebase_auth.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:le_kiosque_by_gcs/services/auth/auth.dart';
|
|
import 'package:le_kiosque_by_gcs/ui/auth.dart';
|
|
import 'package:le_kiosque_by_gcs/ui/main.dart';
|
|
|
|
class LandingPageView extends StatelessWidget {
|
|
final Auth auth;
|
|
|
|
const LandingPageView({Key key, this.auth}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return StreamBuilder<User>(
|
|
stream: auth.authStateChanges(),
|
|
builder: (context, snapshot) {
|
|
if (snapshot.connectionState == ConnectionState.active) {
|
|
if (snapshot.data == null) {
|
|
return AuthView(auth: auth);
|
|
} else {
|
|
return MainView();
|
|
}
|
|
}
|
|
else {
|
|
return Scaffold(
|
|
body: Center(
|
|
child: CircularProgressIndicator(),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
);
|
|
}
|
|
}
|