FIREBASE_ui_auth doesnt work when using custom routes to navigate through screens #10418
Unanswered
Clinton1000
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I used Firebase_ui_auth for my app that has up to 30 screens and when a user creates account it will register correctly in my Firebase console but it wont push the user to the home page.
when a user tries to sign in it also does not push the user to the homepage so basically no user can get passed my authentication page.
please i need help .
below is my code :
import 'pages/main_screens/fiat.dart';
import 'package:firebase_auth/firebase_auth.dart'
hide PhoneAuthProvider, EmailAuthProvider;
import 'package:firebase_ui_auth/firebase_ui_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
FirebaseUIAuth.configureProviders(
[
EmailAuthProvider(),
);
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@OverRide
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
inputDecorationTheme: InputDecorationTheme(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
),
outlinedButtonTheme: OutlinedButtonThemeData(
style: ButtonStyle(
padding: MaterialStateProperty.all(
const EdgeInsets.all(24),
),
backgroundColor: MaterialStateProperty.all(Colors.blue),
foregroundColor: MaterialStateProperty.all(Colors.white),
),
),
),
initialRoute: AuthPage.id,
routes: {
TextFieldGC.id: (context) => TextFieldGC(),
Pay.id: (context) => Pay(),
FundAccount.id: (context) => FundAccount(),
class AuthPage extends StatelessWidget {
static const String id = 'AuthPage';
const AuthPage({super.key});
@OverRide
Widget build(BuildContext context) {
return Scaffold(
body: SignInScreen(
actions: [
AuthStateChangeAction((context, state) {
if (!state.user!.emailVerified) {
Navigator.pushNamed(context, '/verify-email');
} else {
Navigator.pushReplacementNamed(context, BottomNavBar.id);
}
}),
],
),
);
Beta Was this translation helpful? Give feedback.
All reactions