@@ -276,21 +276,21 @@ class _RestoreFrostMsWalletViewState
276276 Constants .size.circularBorderRadius,
277277 ),
278278 child: TextField (
279- key: const Key ("frMyNameTextFieldKey " ),
280- controller: keysFieldController ,
279+ key: const Key ("frConfigTextFieldKey " ),
280+ controller: configFieldController ,
281281 onChanged: (_) {
282282 setState (() {
283- _keysEmpty = keysFieldController .text.isEmpty;
283+ _configEmpty = configFieldController .text.isEmpty;
284284 });
285285 },
286- focusNode: keysFocusNode ,
286+ focusNode: configFocusNode ,
287287 readOnly: false ,
288288 autocorrect: false ,
289289 enableSuggestions: false ,
290290 style: STextStyles .field (context),
291291 decoration: standardInputDecoration (
292- "Keys " ,
293- keysFocusNode ,
292+ "Enter config " ,
293+ configFocusNode ,
294294 context,
295295 ).copyWith (
296296 contentPadding: const EdgeInsets .only (
@@ -300,50 +300,83 @@ class _RestoreFrostMsWalletViewState
300300 right: 5 ,
301301 ),
302302 suffixIcon: Padding (
303- padding: _keysEmpty
303+ padding: _configEmpty
304304 ? const EdgeInsets .only (right: 8 )
305305 : const EdgeInsets .only (right: 0 ),
306306 child: UnconstrainedBox (
307307 child: Row (
308308 mainAxisAlignment: MainAxisAlignment .spaceAround,
309309 children: [
310- ! _keysEmpty
310+ ! _configEmpty
311311 ? TextFieldIconButton (
312312 semanticsLabel:
313- "Clear Button. Clears The Keys Field." ,
314- key: const Key ("frMyNameClearButtonKey " ),
313+ "Clear Button. Clears The Config Field." ,
314+ key: const Key ("frConfigClearButtonKey " ),
315315 onTap: () {
316- keysFieldController .text = "" ;
316+ configFieldController .text = "" ;
317317
318318 setState (() {
319- _keysEmpty = true ;
319+ _configEmpty = true ;
320320 });
321321 },
322322 child: const XIcon (),
323323 )
324324 : TextFieldIconButton (
325325 semanticsLabel:
326- "Paste Button. Pastes From Clipboard To Keys Field." ,
327- key: const Key ("frKeysPasteButtonKey " ),
326+ "Paste Button. Pastes From Clipboard To Config Field Input ." ,
327+ key: const Key ("frConfigPasteButtonKey " ),
328328 onTap: () async {
329329 final ClipboardData ? data =
330330 await Clipboard .getData (
331- Clipboard .kTextPlain);
331+ Clipboard .kTextPlain,
332+ );
332333 if (data? .text != null &&
333334 data! .text! .isNotEmpty) {
334- keysFieldController .text =
335+ configFieldController .text =
335336 data.text! .trim ();
336337 }
337338
338339 setState (() {
339- _keysEmpty =
340- keysFieldController .text.isEmpty;
340+ _configEmpty =
341+ configFieldController .text.isEmpty;
341342 });
342343 },
343- child: _keysEmpty
344+ child: _configEmpty
344345 ? const ClipboardIcon ()
345346 : const XIcon (),
346347 ),
348+ if (_configEmpty)
349+ TextFieldIconButton (
350+ semanticsLabel:
351+ "Scan QR Button. Opens Camera For Scanning QR Code." ,
352+ key: const Key ("frConfigScanQrButtonKey" ),
353+ onTap: () async {
354+ try {
355+ if (FocusScope .of (context).hasFocus) {
356+ FocusScope .of (context).unfocus ();
357+ await Future <void >.delayed (
358+ const Duration (milliseconds: 75 ),
359+ );
360+ }
361+
362+ final qrResult = await BarcodeScanner .scan ();
363+
364+ configFieldController.text =
365+ qrResult.rawContent;
366+
367+ setState (() {
368+ _configEmpty =
369+ configFieldController.text.isEmpty;
370+ });
371+ } on PlatformException catch (e, s) {
372+ Logging .instance.log (
373+ "Failed to get camera permissions while trying to scan qr code: $e \n $s " ,
374+ level: LogLevel .Warning ,
375+ );
376+ }
377+ },
378+ child: const QrCodeIcon (),
379+ ),
347380 ],
348381 ),
349382 ),
@@ -359,21 +392,21 @@ class _RestoreFrostMsWalletViewState
359392 Constants .size.circularBorderRadius,
360393 ),
361394 child: TextField (
362- key: const Key ("frConfigTextFieldKey " ),
363- controller: configFieldController ,
395+ key: const Key ("frMyNameTextFieldKey " ),
396+ controller: keysFieldController ,
364397 onChanged: (_) {
365398 setState (() {
366- _configEmpty = configFieldController .text.isEmpty;
399+ _keysEmpty = keysFieldController .text.isEmpty;
367400 });
368401 },
369- focusNode: configFocusNode ,
402+ focusNode: keysFocusNode ,
370403 readOnly: false ,
371404 autocorrect: false ,
372405 enableSuggestions: false ,
373406 style: STextStyles .field (context),
374407 decoration: standardInputDecoration (
375- "Enter config " ,
376- configFocusNode ,
408+ "Keys " ,
409+ keysFocusNode ,
377410 context,
378411 ).copyWith (
379412 contentPadding: const EdgeInsets .only (
@@ -383,81 +416,51 @@ class _RestoreFrostMsWalletViewState
383416 right: 5 ,
384417 ),
385418 suffixIcon: Padding (
386- padding: _configEmpty
419+ padding: _keysEmpty
387420 ? const EdgeInsets .only (right: 8 )
388421 : const EdgeInsets .only (right: 0 ),
389422 child: UnconstrainedBox (
390423 child: Row (
391424 mainAxisAlignment: MainAxisAlignment .spaceAround,
392425 children: [
393- ! _configEmpty
426+ ! _keysEmpty
394427 ? TextFieldIconButton (
395428 semanticsLabel:
396- "Clear Button. Clears The Config Field." ,
397- key: const Key ("frConfigClearButtonKey " ),
429+ "Clear Button. Clears The Keys Field." ,
430+ key: const Key ("frMyNameClearButtonKey " ),
398431 onTap: () {
399- configFieldController .text = "" ;
432+ keysFieldController .text = "" ;
400433
401434 setState (() {
402- _configEmpty = true ;
435+ _keysEmpty = true ;
403436 });
404437 },
405438 child: const XIcon (),
406439 )
407440 : TextFieldIconButton (
408441 semanticsLabel:
409- "Paste Button. Pastes From Clipboard To Config Field Input ." ,
410- key: const Key ("frConfigPasteButtonKey " ),
442+ "Paste Button. Pastes From Clipboard To Keys Field." ,
443+ key: const Key ("frKeysPasteButtonKey " ),
411444 onTap: () async {
412445 final ClipboardData ? data =
413446 await Clipboard .getData (
414- Clipboard .kTextPlain);
447+ Clipboard .kTextPlain,
448+ );
415449 if (data? .text != null &&
416450 data! .text! .isNotEmpty) {
417- configFieldController .text =
451+ keysFieldController .text =
418452 data.text! .trim ();
419453 }
420454
421455 setState (() {
422- _configEmpty =
423- configFieldController .text.isEmpty;
456+ _keysEmpty =
457+ keysFieldController .text.isEmpty;
424458 });
425459 },
426- child: _configEmpty
460+ child: _keysEmpty
427461 ? const ClipboardIcon ()
428462 : const XIcon (),
429463 ),
430- if (_configEmpty)
431- TextFieldIconButton (
432- semanticsLabel:
433- "Scan QR Button. Opens Camera For Scanning QR Code." ,
434- key: const Key ("frConfigScanQrButtonKey" ),
435- onTap: () async {
436- try {
437- if (FocusScope .of (context).hasFocus) {
438- FocusScope .of (context).unfocus ();
439- await Future <void >.delayed (
440- const Duration (milliseconds: 75 ));
441- }
442-
443- final qrResult = await BarcodeScanner .scan ();
444-
445- configFieldController.text =
446- qrResult.rawContent;
447-
448- setState (() {
449- _configEmpty =
450- configFieldController.text.isEmpty;
451- });
452- } on PlatformException catch (e, s) {
453- Logging .instance.log (
454- "Failed to get camera permissions while trying to scan qr code: $e \n $s " ,
455- level: LogLevel .Warning ,
456- );
457- }
458- },
459- child: const QrCodeIcon (),
460- )
461464 ],
462465 ),
463466 ),
0 commit comments