Skip to content

Commit

Permalink
Fix removing chip after entering 1 symbol
Browse files Browse the repository at this point in the history
This changes set a proper initial value for the internal text state.

Fix #34
  • Loading branch information
EvgeneOskin committed Mar 11, 2021
1 parent 8c08caa commit 57eef39
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 76 deletions.
10 changes: 5 additions & 5 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class MyApp extends StatelessWidget {
}

class MyHomePage extends StatefulWidget {
MyHomePage({Key key}) : super(key: key);
MyHomePage({Key? key}) : super(key: key);

@override
_MyHomePageState createState() => _MyHomePageState();
Expand Down Expand Up @@ -69,7 +69,7 @@ class _MyHomePageState extends State<MyHomePage> {
children: <Widget>[
TextField(),
TextField(),
ChipsInput(
ChipsInput<AppProfile>(
key: _chipKey,
/*initialValue: [
AppProfile('John Doe', '[email protected]',
Expand Down Expand Up @@ -199,14 +199,14 @@ class _MyHomePageState extends State<MyHomePage> {
);
},
),*/
RaisedButton(
child: Text('Add Chip'),
ElevatedButton(
onPressed: () {
_chipKey.currentState.selectSuggestion(AppProfile(
_chipKey.currentState?.selectSuggestion(AppProfile(
'Gina',
'[email protected]',
'https://upload.wikimedia.org/wikipedia/commons/7/7c/Profile_avatar_placeholder_large.png'));
},
child: Text('Add Chip'),
),
],
),
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: example
description: Example Project for flutter_chips_input

environment:
sdk: ">=2.10.0 <3.0.0"
sdk: ">=2.12.0 <3.0.0"
flutter: ">=1.22.0"

dependencies:
Expand Down
Loading

0 comments on commit 57eef39

Please sign in to comment.