Skip to content

Commit 57eef39

Browse files
committed
Fix removing chip after entering 1 symbol
This changes set a proper initial value for the internal text state. Fix #34
1 parent 8c08caa commit 57eef39

File tree

6 files changed

+89
-76
lines changed

6 files changed

+89
-76
lines changed

example/lib/main.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class MyApp extends StatelessWidget {
2020
}
2121

2222
class MyHomePage extends StatefulWidget {
23-
MyHomePage({Key key}) : super(key: key);
23+
MyHomePage({Key? key}) : super(key: key);
2424

2525
@override
2626
_MyHomePageState createState() => _MyHomePageState();
@@ -69,7 +69,7 @@ class _MyHomePageState extends State<MyHomePage> {
6969
children: <Widget>[
7070
TextField(),
7171
TextField(),
72-
ChipsInput(
72+
ChipsInput<AppProfile>(
7373
key: _chipKey,
7474
/*initialValue: [
7575
AppProfile('John Doe', 'jdoe@flutter.io',
@@ -199,14 +199,14 @@ class _MyHomePageState extends State<MyHomePage> {
199199
);
200200
},
201201
),*/
202-
RaisedButton(
203-
child: Text('Add Chip'),
202+
ElevatedButton(
204203
onPressed: () {
205-
_chipKey.currentState.selectSuggestion(AppProfile(
204+
_chipKey.currentState?.selectSuggestion(AppProfile(
206205
'Gina',
207206
'fred@flutter.io',
208207
'https://upload.wikimedia.org/wikipedia/commons/7/7c/Profile_avatar_placeholder_large.png'));
209208
},
209+
child: Text('Add Chip'),
210210
),
211211
],
212212
),

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: example
22
description: Example Project for flutter_chips_input
33

44
environment:
5-
sdk: ">=2.10.0 <3.0.0"
5+
sdk: ">=2.12.0 <3.0.0"
66
flutter: ">=1.22.0"
77

88
dependencies:

0 commit comments

Comments
 (0)