|
10 | 10 |
|
11 | 11 | import 'package:dropdown_button2/dropdown_button2.dart'; |
12 | 12 | import 'package:flutter/material.dart'; |
| 13 | +import 'package:flutter/services.dart'; |
13 | 14 | import 'package:flutter_riverpod/flutter_riverpod.dart'; |
14 | 15 | import 'package:flutter_svg/svg.dart'; |
15 | 16 | import 'package:logger/logger.dart'; |
@@ -476,44 +477,52 @@ class _SeedRestoreOptionState extends ConsumerState<SeedRestoreOption> { |
476 | 477 | onTap: widget.dateChooserFunction, |
477 | 478 | controller: widget.dateController, |
478 | 479 | ) : |
479 | | - TextField( |
480 | | - focusNode: widget.blockHeightFocusNode, |
481 | | - controller: widget.blockHeightController, |
482 | | - keyboardType: TextInputType.number, |
483 | | - textInputAction: TextInputAction.done, |
484 | | - style: Util.isDesktop |
485 | | - ? STextStyles.desktopTextMedium(context).copyWith( |
486 | | - height: 2, |
487 | | - ) |
488 | | - : STextStyles.field(context), |
489 | | - onChanged: (value) { |
490 | | - setState(() { |
491 | | - _blockFieldEmpty = value.isEmpty; |
492 | | - }); |
493 | | - }, |
494 | | - decoration: standardInputDecoration( |
495 | | - "Start scanning from...", |
496 | | - widget.blockHeightFocusNode, |
497 | | - context, |
498 | | - ).copyWith( |
499 | | - suffixIcon: UnconstrainedBox( |
500 | | - child: TextFieldIconButton(child: |
501 | | - Semantics( |
| 480 | + ClipRRect( |
| 481 | + borderRadius: BorderRadius.circular( |
| 482 | + Constants.size.circularBorderRadius, |
| 483 | + ), |
| 484 | + child: TextField( |
| 485 | + focusNode: widget.blockHeightFocusNode, |
| 486 | + controller: widget.blockHeightController, |
| 487 | + keyboardType: TextInputType.number, |
| 488 | + inputFormatters: [ |
| 489 | + FilteringTextInputFormatter.digitsOnly, |
| 490 | + ], |
| 491 | + textInputAction: TextInputAction.done, |
| 492 | + style: Util.isDesktop |
| 493 | + ? STextStyles.desktopTextMedium(context).copyWith( |
| 494 | + height: 2, |
| 495 | + ) |
| 496 | + : STextStyles.field(context), |
| 497 | + onChanged: (value) { |
| 498 | + setState(() { |
| 499 | + _blockFieldEmpty = value.isEmpty; |
| 500 | + }); |
| 501 | + }, |
| 502 | + decoration: standardInputDecoration( |
| 503 | + "Start scanning from...", |
| 504 | + widget.blockHeightFocusNode, |
| 505 | + context, |
| 506 | + ).copyWith( |
| 507 | + suffixIcon: UnconstrainedBox( |
| 508 | + child: TextFieldIconButton(child: |
| 509 | + Semantics( |
502 | 510 | label: "Clear Block Height Field Button. Clears the block height field", |
503 | 511 | excludeSemantics: true, |
504 | 512 | child: !_blockFieldEmpty |
505 | 513 | ? XIcon( |
506 | | - width: Util.isDesktop ? 24 : 16, |
507 | | - height: Util.isDesktop ? 24 : 16, |
508 | | - ) |
| 514 | + width: Util.isDesktop ? 24 : 16, |
| 515 | + height: Util.isDesktop ? 24 : 16, |
| 516 | + ) |
509 | 517 | : const SizedBox.shrink(), |
510 | 518 | ), |
511 | | - onTap: () { |
512 | | - widget.blockHeightController.text = ""; |
513 | | - setState(() { |
514 | | - _blockFieldEmpty = true; |
515 | | - }); |
516 | | - }, |
| 519 | + onTap: () { |
| 520 | + widget.blockHeightController.text = ""; |
| 521 | + setState(() { |
| 522 | + _blockFieldEmpty = true; |
| 523 | + }); |
| 524 | + }, |
| 525 | + ), |
517 | 526 | ), |
518 | 527 | ), |
519 | 528 | ), |
@@ -778,9 +787,7 @@ class _SeedRestoreOptionState extends ConsumerState<SeedRestoreOption> { |
778 | 787 | void initState() { |
779 | 788 | super.initState(); |
780 | 789 |
|
781 | | - setState(() { |
782 | | - _blockFieldEmpty = widget.blockHeightController.text.isEmpty; |
783 | | - }); |
| 790 | + _blockFieldEmpty = widget.blockHeightController.text.isEmpty; |
784 | 791 | } |
785 | 792 | } |
786 | 793 |
|
@@ -854,44 +861,57 @@ class _ViewOnlyRestoreOptionState extends State<ViewOnlyRestoreOption> { |
854 | 861 | onTap: widget.dateChooserFunction, |
855 | 862 | controller: widget.dateController, |
856 | 863 | ) |
857 | | - : TextField( |
858 | | - focusNode: widget.blockHeightFocusNode, |
859 | | - controller: widget.blockHeightController, |
860 | | - keyboardType: TextInputType.number, |
861 | | - textInputAction: TextInputAction.done, |
862 | | - style: Util.isDesktop |
863 | | - ? STextStyles.desktopTextMedium(context).copyWith( |
864 | | - height: 2, |
865 | | - ) |
866 | | - : STextStyles.field(context), |
867 | | - decoration: standardInputDecoration( |
868 | | - "Start scanning from...", |
869 | | - widget.blockHeightFocusNode, |
870 | | - context, |
871 | | - ).copyWith( |
872 | | - suffixIcon: UnconstrainedBox( |
873 | | - child: TextFieldIconButton( |
874 | | - child: Semantics( |
875 | | - label: |
876 | | - "Clear Block Height Field Button. Clears the block height field", |
877 | | - excludeSemantics: true, |
878 | | - child: !_blockFieldEmpty |
879 | | - ? XIcon( |
880 | | - width: Util.isDesktop ? 24 : 16, |
881 | | - height: Util.isDesktop ? 24 : 16, |
882 | | - ) |
883 | | - : const SizedBox.shrink(), |
884 | | - ), |
885 | | - onTap: () { |
886 | | - widget.blockHeightController.text = ""; |
887 | | - setState(() { |
888 | | - _blockFieldEmpty = true; |
889 | | - }); |
890 | | - }, |
891 | | - ), |
| 864 | + : ClipRRect( |
| 865 | + borderRadius: BorderRadius.circular( |
| 866 | + Constants.size.circularBorderRadius, |
| 867 | + ), |
| 868 | + child: TextField( |
| 869 | + focusNode: widget.blockHeightFocusNode, |
| 870 | + controller: widget.blockHeightController, |
| 871 | + keyboardType: TextInputType.number, |
| 872 | + inputFormatters: [ |
| 873 | + FilteringTextInputFormatter.digitsOnly, |
| 874 | + ], |
| 875 | + textInputAction: TextInputAction.done, |
| 876 | + style: Util.isDesktop |
| 877 | + ? STextStyles.desktopTextMedium(context).copyWith( |
| 878 | + height: 2, |
| 879 | + ) |
| 880 | + : STextStyles.field(context), |
| 881 | + onChanged: (value) { |
| 882 | + setState(() { |
| 883 | + _blockFieldEmpty = value.isEmpty; |
| 884 | + }); |
| 885 | + }, |
| 886 | + decoration: standardInputDecoration( |
| 887 | + "Start scanning from...", |
| 888 | + widget.blockHeightFocusNode, |
| 889 | + context, |
| 890 | + ).copyWith( |
| 891 | + suffixIcon: UnconstrainedBox( |
| 892 | + child: TextFieldIconButton( |
| 893 | + child: Semantics( |
| 894 | + label: |
| 895 | + "Clear Block Height Field Button. Clears the block height field", |
| 896 | + excludeSemantics: true, |
| 897 | + child: !_blockFieldEmpty |
| 898 | + ? XIcon( |
| 899 | + width: Util.isDesktop ? 24 : 16, |
| 900 | + height: Util.isDesktop ? 24 : 16, |
| 901 | + ) |
| 902 | + : const SizedBox.shrink(), |
892 | 903 | ), |
| 904 | + onTap: () { |
| 905 | + widget.blockHeightController.text = ""; |
| 906 | + setState(() { |
| 907 | + _blockFieldEmpty = true; |
| 908 | + }); |
| 909 | + }, |
893 | 910 | ), |
894 | 911 | ), |
| 912 | + ), |
| 913 | + ), |
| 914 | + ), |
895 | 915 | if (showDateOption) |
896 | 916 | const SizedBox( |
897 | 917 | height: 8, |
@@ -927,8 +947,6 @@ class _ViewOnlyRestoreOptionState extends State<ViewOnlyRestoreOption> { |
927 | 947 | void initState() { |
928 | 948 | super.initState(); |
929 | 949 |
|
930 | | - setState(() { |
931 | | - _blockFieldEmpty = widget.blockHeightController.text.isEmpty; |
932 | | - }); |
| 950 | + _blockFieldEmpty = widget.blockHeightController.text.isEmpty; |
933 | 951 | } |
934 | 952 | } |
0 commit comments