splash_page.dart
unknown
dart
a month ago
1.6 kB
22
Indexable
Never
// ignore_for_file: use_build_context_synchronously import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:tahmin_et/components/tahmin_et_logo.dart'; import 'package:tahmin_et/extensions/context_extension.dart'; import 'package:tahmin_et/stores/auth_store.dart'; import 'package:tahmin_et/stores/root_store.dart'; import '../routes.dart'; class SplashPage extends StatefulWidget { const SplashPage({Key? key}) : super(key: key); @override State<SplashPage> createState() => _SplashPageState(); } class _SplashPageState extends State<SplashPage> { late AuthStore authStore; @override void initState() { super.initState(); () async { await Future.delayed(Duration.zero); await authStore.currentUser(); if (authStore.isLoggedIn) { Navigator.of(context).pushReplacementNamed(Routes.home); } else { Navigator.of(context).pushReplacementNamed(Routes.welcomeScreen); } }(); } @override void didChangeDependencies() { super.didChangeDependencies(); authStore = Provider.of<RootStore>(context).authStore; } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: const Color(0xffff525b), //0xff52ffee body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ TahminEtLogo( width: context.dynamicWidth(.5), ), const CircularProgressIndicator( strokeWidth: 8, ) ], ), ), ); } }
Leave a Comment