@@ -63,7 +63,8 @@ class _MyAppState extends State<MyApp> {
63
63
'Your data is locked for privacy reasons. You need to unlock the app to access your data.' ,
64
64
65
65
/// Provide a widget that represents a single pin input field
66
- inputNodeBuilder: (index, state) => _InputField (state: state, index: index),
66
+ inputNodeBuilder: (index, state) =>
67
+ _InputField (state: state, index: index),
67
68
68
69
/// Provide a widget that describes what you want your lock screen to look like,
69
70
/// given the state of the lock screen ([LockScreenConfiguration] )
@@ -94,9 +95,12 @@ class _InputField extends StatelessWidget {
94
95
}) : super (key: key);
95
96
@override
96
97
Widget build (BuildContext context) {
97
- final borderColor = state == InputFieldState .error ? Theme .of (context).errorColor : Theme .of (context).primaryColor;
98
+ final borderColor = state == InputFieldState .error
99
+ ? Theme .of (context).errorColor
100
+ : Theme .of (context).primaryColor;
98
101
double borderWidth = 1 ;
99
- if (state == InputFieldState .focused || state == InputFieldState .filledAndFocused) {
102
+ if (state == InputFieldState .focused ||
103
+ state == InputFieldState .filledAndFocused) {
100
104
borderWidth = 4 ;
101
105
}
102
106
return Container (
@@ -110,7 +114,8 @@ class _InputField extends StatelessWidget {
110
114
width: borderWidth,
111
115
),
112
116
),
113
- child: state == InputFieldState .filled || state == InputFieldState .filledAndFocused
117
+ child: state == InputFieldState .filled ||
118
+ state == InputFieldState .filledAndFocused
114
119
? Center (
115
120
child: Container (
116
121
width: 6 ,
@@ -142,7 +147,8 @@ class _Home extends StatelessWidget {
142
147
),
143
148
TextButton (
144
149
onPressed: () {
145
- Navigator .of (context).push (MaterialPageRoute (builder: (_) => _SetupAuthWidget ()));
150
+ Navigator .of (context)
151
+ .push (MaterialPageRoute (builder: (_) => _SetupAuthWidget ()));
146
152
},
147
153
child: Text ('Configure local authentication' ),
148
154
),
@@ -214,7 +220,8 @@ class _SetupAuthWidget extends StatelessWidget {
214
220
215
221
/// Pin input widget can be the same as on the lock screen, or you can provide a custom UI
216
222
/// that you want to use when setting it up
217
- pinInputBuilder: (index, state) => _InputField (state: state, index: index),
223
+ pinInputBuilder: (index, state) =>
224
+ _InputField (state: state, index: index),
218
225
219
226
/// Overview refers to the first thing your user sees when getting to settings, before they have made
220
227
/// any action, as well as after they made an action (such as changing pincode)
@@ -243,14 +250,17 @@ class _SetupAuthWidget extends StatelessWidget {
243
250
),
244
251
245
252
/// In case of something going wrong, [OverviewConfiguration] provides an [error] property
246
- if (config.error != null ) Text (config.error! .toString (), style: TextStyle (color: Colors .red)),
253
+ if (config.error != null )
254
+ Text (config.error! .toString (),
255
+ style: TextStyle (color: Colors .red)),
247
256
248
257
/// If biometric authentication is available, provide an option to toggle it on or off
249
258
if (config.isBiometricAuthAvailable == true )
250
259
Row (
251
260
mainAxisAlignment: MainAxisAlignment .spaceBetween,
252
261
children: [
253
- const Text ('Use fingerprint or face id to unlock the app' ),
262
+ const Text (
263
+ 'Use fingerprint or face id to unlock the app' ),
254
264
Switch (
255
265
value: config.isBiometricAuthEnabled! ,
256
266
onChanged: (_) => config.onToggleBiometric (),
@@ -291,7 +301,8 @@ class _SetupAuthWidget extends StatelessWidget {
291
301
292
302
/// [configuration.error] provides details if something goes wrong (e.g., pins don't match)
293
303
if (configuration.error != null )
294
- Text (configuration.error.toString (), style: TextStyle (color: Colors .red)),
304
+ Text (configuration.error.toString (),
305
+ style: TextStyle (color: Colors .red)),
295
306
296
307
/// [configuration.canSubmitChange] can optionaly be used to hide or disable submit button
297
308
/// It is also possible to listen for this property and programatically trigger [config.onSubmitChange] ,
@@ -324,7 +335,9 @@ class _SetupAuthWidget extends StatelessWidget {
324
335
style: TextStyle (color: Colors .red),
325
336
),
326
337
if (configuration.canSubmitChange)
327
- OutlinedButton (onPressed: configuration.onChangeSubmitted, child: Text ('Save' ))
338
+ OutlinedButton (
339
+ onPressed: configuration.onChangeSubmitted,
340
+ child: Text ('Save' ))
328
341
],
329
342
),
330
343
),
@@ -342,7 +355,8 @@ class _SetupAuthWidget extends StatelessWidget {
342
355
configuration.newPinInputWidget,
343
356
const Text ('Confirm new pin' ),
344
357
configuration.confirmNewPinInputWidget,
345
- if (configuration.error != null && ! _isCurrentPinIssue (configuration.error))
358
+ if (configuration.error != null &&
359
+ ! _isCurrentPinIssue (configuration.error))
346
360
Text (
347
361
configuration.error! .toString (),
348
362
style: const TextStyle (color: Colors .red),
@@ -359,6 +373,7 @@ class _SetupAuthWidget extends StatelessWidget {
359
373
}
360
374
361
375
bool _isCurrentPinIssue (LocalAuthFailure ? error) {
362
- return error == LocalAuthFailure .wrongPin || error == LocalAuthFailure .tooManyAttempts;
376
+ return error == LocalAuthFailure .wrongPin ||
377
+ error == LocalAuthFailure .tooManyAttempts;
363
378
}
364
379
}
0 commit comments