@@ -3,7 +3,6 @@ import 'package:bb_mobile/core/widgets/buttons/button.dart';
33import 'package:bb_mobile/core/widgets/dialpad/dial_pad.dart' ;
44import 'package:bb_mobile/core/widgets/inputs/text_input.dart' ;
55import 'package:bb_mobile/core/widgets/navbar/top_bar.dart' ;
6- import 'package:bb_mobile/core/widgets/text/text.dart' ;
76import 'package:bb_mobile/features/app_unlock/presentation/bloc/app_unlock_bloc.dart' ;
87import 'package:bb_mobile/features/wallet/ui/wallet_router.dart' ;
98import 'package:bb_mobile/locator.dart' ;
@@ -65,55 +64,80 @@ class PinCodeUnlockInputScreen extends StatelessWidget {
6564 ),
6665 ),
6766 body: SafeArea (
68- child: SingleChildScrollView (
69- child: Padding (
70- padding: const EdgeInsets .symmetric (horizontal: 32 ),
71- child: Column (
72- crossAxisAlignment: CrossAxisAlignment .stretch,
73- children: [
74- const Gap (30 ),
75- BBText (
76- 'Enter your pin code to unlock' ,
77- textAlign: TextAlign .center,
78- style: context.font.headlineMedium? .copyWith (
79- color: context.colour.outline,
80- ),
81- maxLines: 3 ,
82- ),
83- const Gap (30 ),
84- BlocSelector <AppUnlockBloc , AppUnlockState , (String , bool )>(
85- selector: (state) => (state.pinCode, state.obscurePinCode),
86- builder: (context, data) {
87- final (pinCode, obscurePinCode) = data;
88- return BBInputText (
89- value: pinCode,
90- obscure: obscurePinCode,
91- onRightTap:
92- () => context.read <AppUnlockBloc >().add (
93- AppUnlockPinCodeObscureToggled (),
94- ),
95- rightIcon: const Icon (Icons .visibility_off_outlined),
96- onlyNumbers: true ,
97- onChanged: (value) {},
98- );
99- },
100- ),
101- const Gap (30 ),
102- DialPad (
103- disableFeedback: true ,
104- onlyDigits: true ,
105- onNumberPressed:
106- (value) => context.read <AppUnlockBloc >().add (
107- AppUnlockPinCodeNumberAdded (int .parse (value)),
67+ child: Column (
68+ children: [
69+ Expanded (
70+ child: SingleChildScrollView (
71+ child: Padding (
72+ padding: const EdgeInsets .symmetric (horizontal: 32 ),
73+ child: Column (
74+ crossAxisAlignment: CrossAxisAlignment .stretch,
75+ children: [
76+ const Gap (30 ),
77+ Text (
78+ 'Enter your pin code to unlock' ,
79+ textAlign: TextAlign .center,
80+ style: context.font.headlineMedium? .copyWith (
81+ color: context.colour.outline,
82+ ),
83+ maxLines: 3 ,
10884 ),
109- onBackspacePressed:
110- () => context.read <AppUnlockBloc >().add (
111- const AppUnlockPinCodeNumberRemoved (),
85+ const Gap (30 ),
86+ BlocSelector <AppUnlockBloc , AppUnlockState , (String , bool )>(
87+ selector: (state) => (state.pinCode, state.obscurePinCode),
88+ builder: (context, data) {
89+ final (pinCode, obscurePinCode) = data;
90+ return BBInputText (
91+ value: pinCode,
92+ obscure: obscurePinCode,
93+ onRightTap:
94+ () => context.read <AppUnlockBloc >().add (
95+ AppUnlockPinCodeObscureToggled (),
96+ ),
97+ rightIcon: const Icon (Icons .visibility_off_outlined),
98+ onlyNumbers: true ,
99+ onChanged: (value) {},
100+ );
101+ },
112102 ),
103+ const Gap (2 ),
104+ BlocSelector <AppUnlockBloc , AppUnlockState , (bool , int )>(
105+ selector: (state) => (state.showError, state.failedAttempts),
106+ builder: (context, data) {
107+ final (showError, failedAttempts) = data;
108+ return showError && failedAttempts > 0
109+ ? Text (
110+ 'Incorrect PIN. Please try again. ($failedAttempts failed ${failedAttempts == 1 ? "attempt" : "attempts" })' ,
111+ textAlign: TextAlign .start,
112+ style: context.font.labelSmall? .copyWith (
113+ color: context.colour.error,
114+ ),
115+ )
116+ : const SizedBox .shrink ();
117+ },
118+ ),
119+ ],
120+ ),
113121 ),
114- ] ,
122+ ) ,
115123 ),
116- ),
124+ Padding (
125+ padding: const EdgeInsets .symmetric (horizontal: 32 ),
126+ child: DialPad (
127+ disableFeedback: true ,
128+ onlyDigits: true ,
129+ onNumberPressed:
130+ (value) => context.read <AppUnlockBloc >().add (
131+ AppUnlockPinCodeNumberAdded (int .parse (value)),
132+ ),
133+ onBackspacePressed:
134+ () => context.read <AppUnlockBloc >().add (
135+ const AppUnlockPinCodeNumberRemoved (),
136+ ),
137+ ),
138+ ),
139+ const Gap (16 ),
140+ ],
117141 ),
118142 ),
119143 bottomNavigationBar: SafeArea (
0 commit comments