Skip to content

Commit adedfee

Browse files
committed
Fixed field cleaning (issue #11).
1 parent ec4a592 commit adedfee

File tree

6 files changed

+29
-14
lines changed

6 files changed

+29
-14
lines changed

CHANGELOG.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
## 2.2.0 - 2021-07-27
2+
3+
* Change how SelectFormField identify and set the initial value from item list (issue #8).
4+
* Fixed field cleaning (issue #11).
5+
16
## 2.1.0 - 2021-07-07
27

3-
* Fixed bug of return when click outside the select items
4-
* Improved validation of initialValue and items parameters
8+
* Fixed bug of return when click outside the select items.
9+
* Improved validation of initialValue and items parameters.
510

611
## 2.0.0 - 2021-03-09
712

@@ -11,24 +16,24 @@
1116

1217
## 1.1.0 - 2020-12-07
1318

14-
* Increment an option to show itens as dropdown or dialog with search
15-
* Exemple update
19+
* Increment an option to show itens as dropdown or dialog with search.
20+
* Exemple update.
1621

1722
## 1.0.1 - 2020-08-05
1823

19-
* Fixed issue #1 - text render overflowed
24+
* Fixed issue #1 - text render overflowed.
2025

2126
## 1.0.0 - 2020-07-17
2227

23-
* Fixed use of widget with empty initial value
24-
* Improved README.md
25-
* Improved testing
26-
* Improved example app
27-
* Final validation
28+
* Fixed use of widget with empty initial value.
29+
* Improved README.md.
30+
* Improved testing.
31+
* Improved example app.
32+
* Final validation.
2833

2934
## 0.1.1 - 2020-07-16
3035

31-
* Example page published
36+
* Example page published.
3237

3338
## 0.1.0 - 2020-07-16
3439

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ In the `pubspec.yaml` of your flutter project, add the following dependency:
1414
```yaml
1515
dependencies:
1616
...
17-
select_form_field: "^2.1.0"
17+
select_form_field: "^2.2.0"
1818
```
1919
2020
In your library add the following import:

example/lib/main.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ class _MyHomePageState extends State<MyHomePage> {
176176
_valueChanged = '';
177177
_valueToValidate = '';
178178
_valueSaved = '';
179+
_controller?.clear();
179180
});
180181
},
181182
child: Text('Reset'),

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dependencies:
2828
# The following adds the Cupertino Icons font to your application.
2929
# Use with the CupertinoIcons class for iOS style icons.
3030
cupertino_icons: ^0.1.3
31-
select_form_field: #^2.1.0
31+
select_form_field: #^2.2.0
3232
path: ../
3333

3434
dev_dependencies:

lib/select_form_field.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,10 @@ class _SelectFormFieldState extends FormFieldState<String> {
426426
widget.controller?.addListener(_handleControllerChanged);
427427
}
428428

429+
initValues();
430+
}
431+
432+
void initValues() {
429433
if (_effectiveController?.text != null &&
430434
_effectiveController?.text != '') {
431435
widget.items?.forEach((Map<String, dynamic> lmItem) {
@@ -487,6 +491,11 @@ class _SelectFormFieldState extends FormFieldState<String> {
487491
_icon = _item?['icon'];
488492
}
489493
}
494+
} else {
495+
_labelController.clear();
496+
_icon = widget.icon;
497+
498+
initValues();
490499
}
491500
}
492501

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: select_form_field
22
description: A Flutter select form field widget. It shows a list of options in a dropdown menu.
3-
version: 2.1.0
3+
version: 2.2.0
44
homepage: https://github.com/m3uzz/select_form_field
55

66
environment:

0 commit comments

Comments
 (0)