language localization

This commit is contained in:
jayesh
2024-07-09 14:56:23 +05:30
parent c830e4d09c
commit 11d0d3cf8b
18 changed files with 708 additions and 34 deletions

View File

@@ -1,3 +1,5 @@
import 'dart:io';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:local_auth/local_auth.dart';
@@ -23,13 +25,26 @@ class BiometricBloc extends Bloc<BiometricEvent, BiometricState> {
AuthenticateBiometricEvent event, Emitter<BiometricState> emit) async {
emit(BiometricAuthenticating());
try {
bool authenticated = await localAuthentication.authenticate(
localizedReason: 'Please authenticate to access the app',
options: const AuthenticationOptions(
useErrorDialogs: true,
stickyAuth: true,
),
);
bool authenticated = false;
if (Platform.isIOS) {
authenticated = await localAuthentication.authenticate(
localizedReason: 'Please authenticate to access the app',
options: const AuthenticationOptions(
useErrorDialogs: true,
stickyAuth: true,
biometricOnly: true,
),
);
} else if (Platform.isAndroid) {
authenticated = await localAuthentication.authenticate(
localizedReason: 'Please authenticate to access the app',
options: const AuthenticationOptions(
useErrorDialogs: true,
stickyAuth: true,
),
);
}
if (authenticated) {
emit(BiometricAuthenticated());
} else {

View File

@@ -8,10 +8,10 @@ import 'package:flutter_svg/flutter_svg.dart';
import '../../../../core/routes/route_name.dart';
import '../../../../core/routes/routes.dart';
import '../../../../core/styles/app_images.dart';
import '../../../../shared/components/device_locked_dialog.dart';
import '../bloc/biometric_bloc.dart';
import '../bloc/biometric_event.dart';
import '../bloc/biometric_state.dart';
import '../../../../shared/components/device_locked_dialog.dart';
class BiometricLayout extends StatelessWidget {
const BiometricLayout({super.key});

View File

@@ -44,14 +44,14 @@ class SplashScreen extends StatelessWidget {
// Navigate to the WelcomeScreen using the goRouter
goRouter.goNamed(RouteName.welcomeScreen);
} else {
// if (await secureStorageService.read('biometric') != null &&
// await secureStorageService.read('biometric') == 'on') {
// goRouter.goNamed(RouteName.biometricScreen);
// } else {
goRouter.goNamed(RouteName.pinScreen, pathParameters: {
"fromScreen": "LoginedInUser",
});
// }
if (await secureStorageService.read('biometric') != null &&
await secureStorageService.read('biometric') == 'on') {
goRouter.goNamed(RouteName.biometricScreen);
} else {
goRouter.goNamed(RouteName.pinScreen, pathParameters: {
"fromScreen": "LoginedInUser",
});
}
}
}
}