This repository was archived by the owner on Aug 29, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
lib/src/presentation/widgets Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ class PinInputWidget extends StatefulWidget {
31
31
class _PinInputWidgetState extends State <PinInputWidget > {
32
32
late final TextEditingController controller;
33
33
late final FocusNode focusNode;
34
+
34
35
@override
35
36
void initState () {
36
37
super .initState ();
@@ -42,10 +43,17 @@ class _PinInputWidgetState extends State<PinInputWidget> {
42
43
focusNode.addListener (() => setState (() {}));
43
44
}
44
45
46
+ @override
47
+ void dispose () {
48
+ focusNode.dispose ();
49
+ controller.dispose ();
50
+ super .dispose ();
51
+ }
52
+
45
53
@override
46
54
Widget build (BuildContext context) {
47
55
if (controller.text != widget.value) {
48
- controller.text = widget.value ;
56
+ controller.clear () ;
49
57
}
50
58
return Row (
51
59
mainAxisSize: MainAxisSize .min,
@@ -77,10 +85,9 @@ class _PinInputWidgetState extends State<PinInputWidget> {
77
85
focusNode: focusNode,
78
86
keyboardType: TextInputType .number,
79
87
maxLength: widget.pinLength,
80
- onChanged: (text) async {
88
+ onChanged: (text) {
81
89
widget.onInput (text);
82
- if (text.length == widget.pinLength &&
83
- focusNode.hasFocus == true ) {
90
+ if (text.length == widget.pinLength && focusNode.hasFocus == true ) {
84
91
widget.nextFocusNode? .requestFocus ();
85
92
}
86
93
},
You can’t perform that action at this time.
0 commit comments