Skip to content

Commit ba725be

Browse files
committed
Fixed #3 support 'autofocus'
1 parent d2d68d8 commit ba725be

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@
55
## [0.1.1] - TODO: Add release date.
66

77
* TODO: Fixed clean input
8+
9+
10+
## [0.1.2] - TODO: Add release date.
11+
12+
* TODO: Support `autofocus`

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@
55
## Installing
66

77
```yaml
8-
dependencies:
9-
flutter:
10-
sdk: flutter
118
flutter_verification_code_input:
129
git:
1310
url: git://github.com/tiny-express/flutter_verification_code_input.git
14-
version: ^0.1.1
11+
version: ^0.1.2
1512
```
1613
1714
```dart

example/lib/main.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class _MyHomePageState extends State<MyHomePage> {
4545
VerificationCodeInput(
4646
keyboardType: TextInputType.number,
4747
length: 4,
48+
autofocus: false,
4849
onCompleted: (String value) {
4950
print(value);
5051
setState(() {

lib/src/verification_code_input.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@ class VerificationCodeInput extends StatefulWidget {
55
final TextInputType keyboardType;
66
final int length;
77
final double itemSize;
8-
BoxDecoration itemDecoration;
9-
TextStyle textStyle;
8+
final BoxDecoration itemDecoration;
9+
final TextStyle textStyle;
10+
final bool autofocus;
1011
VerificationCodeInput(
1112
{Key key,
1213
this.onCompleted,
1314
this.keyboardType = TextInputType.number,
1415
this.length = 4,
1516
this.itemDecoration,
1617
this.itemSize = 50,
17-
this.textStyle = const TextStyle(fontSize: 25.0, color: Colors.black)})
18+
this.textStyle = const TextStyle(fontSize: 25.0, color: Colors.black),
19+
this.autofocus = true})
1820
: assert(length > 0),
1921
assert(itemSize > 0),
2022
super(key: key);
@@ -106,7 +108,7 @@ class _VerificationCodeInputState extends State<VerificationCodeInput> {
106108
maxLengthEnforced: true,
107109
autocorrect: false,
108110
textAlign: TextAlign.center,
109-
autofocus: true,
111+
autofocus: widget.autofocus,
110112
style: widget.textStyle,
111113
);
112114
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: flutter_verification_code_input
22
author: loinp <[email protected]>
33
homepage: https://github.com/tiny-express/flutter_verification_code_input
44
description: A Flutter package that help you create a verification input.
5-
version: 0.1.1
5+
version: 0.1.2
66

77
environment:
88
sdk: ">=2.1.0 <3.0.0"

0 commit comments

Comments
 (0)