So i have a question... is it possible, that I can implement a maintenance screen to my app when I need it?
So like, that the App is checking status from the server and when the Value is at maintenance for example, the App loads to the maintenance screen. And when the Value is changed, the App is starting into the normal main screen.
Idk if i can do this with remote config...
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart';
import 'package:showcaseview/showcaseview.dart';
import '../providers/user-provider.dart';
import '../screens/auth_screen.dart';
import '../screens/startscreen.dart';
class AutoLoginHandler extends StatefulWidget {
@override
State<AutoLoginHandler> createState() => _AutoLoginHandlerState();
}
class _AutoLoginHandlerState extends State<AutoLoginHandler> {
@override
Widget build(BuildContext context) {
UserProvider up = context.read<UserProvider>();
return StreamBuilder<User?>(
//Streambuilder looks if data is avaliable
stream: FirebaseAuth.instance.authStateChanges(),
builder: (context, snapshot) {
if (snapshot.hasData && snapshot.data != null) {
up.setUser(snapshot.data);
return ShowCaseWidget(
builder: Builder(builder: (context) => MainPage()),
); //when data here goto Startscreen
}
return LoginScreen(); //when no data is here goto Login
},
);
}
}
The code attached is the Code that checks, if the User is registered.