53 lines
1.6 KiB
Dart
53 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:tanami_app/core/utils/secure/secure_storage_service.dart';
|
|
|
|
import '../../../../core/styles/app_color.dart';
|
|
import '../../../../shared/components/exit_app_dialog.dart';
|
|
import '../../../countrySelection/bloc/choose_country_bloc.dart';
|
|
import '../bloc/login_bloc.dart';
|
|
import 'login_layout.dart';
|
|
|
|
class LoginScreen extends StatelessWidget {
|
|
final String fromScreen;
|
|
const LoginScreen({super.key, required this.fromScreen});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final SharedPreferenceLocalData secureStorageService =
|
|
SharedPreferenceLocalData();
|
|
final radioBloc = context.read<RadioBloc>();
|
|
|
|
return WillPopScope(
|
|
onWillPop: () async {
|
|
if (fromScreen == "welcome" ||
|
|
fromScreen == "registerStep" ||
|
|
fromScreen == "forgot-pin") {
|
|
exitAppDialog(context);
|
|
return false;
|
|
} else {
|
|
radioBloc.resetSelection();
|
|
return true;
|
|
}
|
|
},
|
|
child: Scaffold(
|
|
backgroundColor: AppColor.plainWhite,
|
|
resizeToAvoidBottomInset: true,
|
|
body: MultiBlocProvider(
|
|
// Define the providers for the OnboardingBloc and other blocs
|
|
providers: [
|
|
BlocProvider(
|
|
// Create an instance of the OnboardingBloc
|
|
create: (context) =>
|
|
LoginBloc(secureStorageService: secureStorageService),
|
|
),
|
|
],
|
|
child: LoginLayout(
|
|
fromScreen: fromScreen,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|