63 lines
2.1 KiB
Dart
63 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
|
|
import '../../../../core/styles/app_color.dart';
|
|
import '../../../../core/styles/app_text.dart';
|
|
import '../../../../core/utils/language/localizations_delegate.dart';
|
|
import '../../../../core/utils/secure/secure_storage_service.dart';
|
|
import '../../../../shared/components/appbar_widget.dart';
|
|
import '../../../../shared/components/exit_app_dialog.dart';
|
|
import '../bloc/pin_bloc.dart';
|
|
import 'pin_layout.dart';
|
|
|
|
class PinScreen extends StatelessWidget {
|
|
final String fromScreen;
|
|
const PinScreen({super.key, required this.fromScreen});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var localizations = AppLocalizations.of(context);
|
|
final SharedPreferenceLocalData secureStorageService =
|
|
SharedPreferenceLocalData();
|
|
return WillPopScope(
|
|
onWillPop: () async {
|
|
if (fromScreen == "login" ||
|
|
fromScreen == "LoginedInUser" ||
|
|
fromScreen == "login-master-pending") {
|
|
exitAppDialog(context);
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
},
|
|
child: Scaffold(
|
|
backgroundColor: AppColor.plainWhite,
|
|
appBar: fromScreen == "register" ||
|
|
fromScreen == "reset-pin" ||
|
|
fromScreen == "login-master-pending"
|
|
? AppBarWidget(
|
|
height: 75,
|
|
titleTxt: fromScreen == "reset-pin"
|
|
? localizations.translate(AppText.changePinCode)
|
|
: localizations.translate(AppText.createPinCode),
|
|
showLeading: fromScreen == "reset-pin" ? true : false,
|
|
)
|
|
: null,
|
|
resizeToAvoidBottomInset: true,
|
|
body: MultiBlocProvider(
|
|
providers: [
|
|
BlocProvider(
|
|
// Create an instance of the OnboardingBloc
|
|
create: (context) =>
|
|
PinBloc(secureStorageService: secureStorageService),
|
|
),
|
|
],
|
|
child: PinLayout(
|
|
fromScreen: fromScreen,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|