resolved many context usage across async gaps warnings
also removed some unused code blocks
This commit is contained in:
41
lib/app.dart
41
lib/app.dart
@@ -82,7 +82,6 @@ class _KMobileState extends State<KMobile> {
|
||||
],
|
||||
child: BlocBuilder<ThemeCubit, ThemeState>(
|
||||
builder: (context, themeState) {
|
||||
print('global theme state changed');
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
locale: _locale ?? const Locale('en'),
|
||||
@@ -153,9 +152,13 @@ class _AuthGateState extends State<AuthGate> {
|
||||
final localAuth = LocalAuthentication();
|
||||
final canCheck = await localAuth.canCheckBiometrics;
|
||||
if (!canCheck) return false;
|
||||
String localizedReason = "";
|
||||
if (mounted) {
|
||||
localizedReason = AppLocalizations.of(context).authenticateToAccess;
|
||||
}
|
||||
try {
|
||||
final didAuth = await localAuth.authenticate(
|
||||
localizedReason: AppLocalizations.of(context).authenticateToAccess,
|
||||
localizedReason: localizedReason,
|
||||
options: const AuthenticationOptions(
|
||||
stickyAuth: true,
|
||||
biometricOnly: true,
|
||||
@@ -255,11 +258,14 @@ class _AuthGateState extends State<AuthGate> {
|
||||
if (optIn == true) {
|
||||
final canCheck = await localAuth.canCheckBiometrics;
|
||||
bool didAuth = false;
|
||||
String authEnable = "";
|
||||
if (context.mounted) {
|
||||
authEnable = AppLocalizations.of(context).authenticateToEnable;
|
||||
}
|
||||
|
||||
if (canCheck) {
|
||||
didAuth = await localAuth.authenticate(
|
||||
localizedReason:
|
||||
AppLocalizations.of(context).authenticateToEnable,
|
||||
localizedReason: authEnable,
|
||||
options: const AuthenticationOptions(
|
||||
stickyAuth: true,
|
||||
biometricOnly: true,
|
||||
@@ -272,11 +278,13 @@ class _AuthGateState extends State<AuthGate> {
|
||||
}
|
||||
}
|
||||
|
||||
Navigator.of(context).pushReplacement(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => const NavigationScaffold(),
|
||||
),
|
||||
);
|
||||
if (context.mounted) {
|
||||
Navigator.of(context).pushReplacement(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => const NavigationScaffold(),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -304,17 +312,8 @@ class _NavigationScaffoldState extends State<NavigationScaffold> {
|
||||
const ServiceScreen(),
|
||||
];
|
||||
|
||||
void _onItemTapped(int index) {
|
||||
setState(() {
|
||||
_selectedIndex = index;
|
||||
});
|
||||
_pageController.jumpToPage(index);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print(
|
||||
"--- NavigationScaffold is rebuilding with theme color: ${Theme.of(context).primaryColor}");
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvokedWithResult: (didPop, result) async {
|
||||
@@ -418,8 +417,12 @@ class BiometricPromptScreen extends StatelessWidget {
|
||||
onCompleted();
|
||||
return;
|
||||
}
|
||||
String localizedReason = "";
|
||||
if (context.mounted) {
|
||||
localizedReason = AppLocalizations.of(context).enableFingerprintQuick;
|
||||
}
|
||||
final didAuth = await localAuth.authenticate(
|
||||
localizedReason: AppLocalizations.of(context).enableFingerprintQuick,
|
||||
localizedReason: localizedReason,
|
||||
options: const AuthenticationOptions(
|
||||
stickyAuth: true,
|
||||
biometricOnly: true,
|
||||
|
Reference in New Issue
Block a user