After Login Button
This commit is contained in:
33
lib/app.dart
33
lib/app.dart
@@ -4,7 +4,8 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:kmobile/features/auth/controllers/theme_mode_cubit.dart';
|
||||
import 'package:kmobile/features/auth/controllers/theme_mode_state.dart';
|
||||
import 'package:kmobile/features/auth/screens/sms_verification_screen.dart';
|
||||
import 'package:kmobile/features/auth/screens/login_screen.dart';
|
||||
//import 'package:kmobile/features/auth/screens/sms_verification_screen.dart';
|
||||
import 'package:kmobile/security/secure_storage.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import './l10n/app_localizations.dart';
|
||||
@@ -14,7 +15,6 @@ import 'config/routes.dart';
|
||||
import 'di/injection.dart';
|
||||
import 'features/auth/controllers/auth_cubit.dart';
|
||||
import 'features/card/screens/card_management_screen.dart';
|
||||
import 'features/auth/screens/splash_screen.dart';
|
||||
import 'features/service/screens/service_screen.dart';
|
||||
import 'features/dashboard/screens/dashboard_screen.dart';
|
||||
import 'features/auth/screens/mpin_screen.dart';
|
||||
@@ -37,7 +37,6 @@ class KMobile extends StatefulWidget {
|
||||
|
||||
class _KMobileState extends State<KMobile> with WidgetsBindingObserver {
|
||||
Timer? _backgroundTimer;
|
||||
bool showSplash = true;
|
||||
Locale? _locale;
|
||||
|
||||
@override
|
||||
@@ -45,11 +44,6 @@ class _KMobileState extends State<KMobile> with WidgetsBindingObserver {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
loadPreferences();
|
||||
Future.delayed(const Duration(seconds: 3), () {
|
||||
setState(() {
|
||||
showSplash = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -132,8 +126,7 @@ class _KMobileState extends State<KMobile> with WidgetsBindingObserver {
|
||||
darkTheme: themeState.getDarkThemeData(),
|
||||
themeMode: context.watch<ThemeModeCubit>().state.mode,
|
||||
onGenerateRoute: AppRoutes.generateRoute,
|
||||
initialRoute: AppRoutes.splash,
|
||||
home: showSplash ? const SplashScreen() : const AuthGate(),
|
||||
home: const AuthGate(),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -205,7 +198,11 @@ class _AuthGateState extends State<AuthGate> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_checking) {
|
||||
return const SplashScreen();
|
||||
return const Scaffold(
|
||||
body: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (_isLoggedIn) {
|
||||
if (_hasMPin) {
|
||||
@@ -214,7 +211,11 @@ class _AuthGateState extends State<AuthGate> {
|
||||
future: _tryBiometric(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const SplashScreen();
|
||||
return const Scaffold(
|
||||
body: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (snapshot.data == true) {
|
||||
return const NavigationScaffold();
|
||||
@@ -301,7 +302,7 @@ class _AuthGateState extends State<AuthGate> {
|
||||
);
|
||||
}
|
||||
}
|
||||
return const SmsVerificationScreen();
|
||||
return const LoginScreen();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,7 +423,11 @@ class BiometricPromptScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Future.microtask(() => _showDialog(context));
|
||||
return const SplashScreen();
|
||||
return const Scaffold(
|
||||
body: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _showDialog(BuildContext context) async {
|
||||
|
||||
Reference in New Issue
Block a user