Skip to content

Commit 5ebc1c1

Browse files
committed
Fix clean input item
1 parent b1d96bb commit 5ebc1c1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/src/verification_code_input.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ class _VerificationCodeInputState extends State<VerificationCodeInput> {
2828
final List<FocusNode> _listFocusNode = <FocusNode>[];
2929
final List<TextEditingController> _listControllerText =
3030
<TextEditingController>[];
31-
Map<int, String> _code = Map();
31+
List<String> _code = List();
3232
int _currentIdex = 0;
3333
@override
3434
void initState() {
3535
if (_listFocusNode.isEmpty) {
3636
for (var i = 0; i < widget.length; i++) {
3737
_listFocusNode.add(new FocusNode());
3838
_listControllerText.add(new TextEditingController());
39-
_code[i] = " ";
39+
_code.add(' ');
4040
}
4141
}
4242
super.initState();
@@ -123,6 +123,9 @@ class _VerificationCodeInputState extends State<VerificationCodeInput> {
123123
void _prev(int index) {
124124
if (index > 0) {
125125
setState(() {
126+
if (_listControllerText[index].text.isEmpty) {
127+
_listControllerText[index - 1].text = ' ';
128+
}
126129
_currentIdex = index - 1;
127130
});
128131
FocusScope.of(context).requestFocus(_listFocusNode[index - 1]);

0 commit comments

Comments
 (0)