Skip to content

Commit

Permalink
Improved validation on load the list of icons.
Browse files Browse the repository at this point in the history
  • Loading branch information
hslbetto committed Jul 7, 2021
1 parent af77c12 commit 098288f
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
## 2.0.1 - 2021-07-07

* Improved validation on load the list of icons.

## 2.0.0 - 2021-03-09

* Migrate to null safety.
Expand Down
4 changes: 3 additions & 1 deletion README.md
Expand Up @@ -2,6 +2,8 @@

[![pub package](https://img.shields.io/pub/v/icon_picker.svg)](https://pub.dartlang.org/packages/icon_picker)

<a href="https://www.buymeacoffee.com/hslbetto" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-blue.png" alt="Buy Me A Beer" style="width: 150px !important;"></a>

A Flutter widget to show an icon collection to pick.\
This widget extend TextField and has a similar behavior as TextFormField

Expand All @@ -12,7 +14,7 @@ In the `pubspec.yaml` of your flutter project, add the following dependency:
```yaml
dependencies:
...
icon_picker: "^2.0.0"
icon_picker: "^2.0.1"
```

In your library add the following import:
Expand Down
2 changes: 1 addition & 1 deletion example/lib/main.dart
Expand Up @@ -23,7 +23,7 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State<MyHomePage> {
GlobalKey<FormState> _oFormKey = GlobalKey<FormState>();
TextEditingController? _controller;
//String _initialValue;
//String _initialValue = '';
String _valueChanged = '';
String _valueToValidate = '';
String _valueSaved = '';
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Expand Up @@ -28,7 +28,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
icon_picker: #^2.0.0
icon_picker: #^2.0.1
path: ../

dev_dependencies:
Expand Down
4 changes: 2 additions & 2 deletions lib/icon_picker.dart
Expand Up @@ -442,7 +442,7 @@ class _IconPickerState extends FormFieldState<String> {
}

Future<void> _showIconPickerDialog() async {
Map<String, dynamic> lmIconPicked = await showDialog(
Map<String, dynamic>? lmIconPicked = await showDialog(
context: context,
builder: (BuildContext context) {
return IconPickerDialog(
Expand All @@ -458,7 +458,7 @@ class _IconPickerState extends FormFieldState<String> {
if (lmIconPicked is Map) {
if (!mounted) return;

int liCodePoint = lmIconPicked['icon'].codePoint;
int liCodePoint = lmIconPicked!['icon'].codePoint;
String lsFontFamily = lmIconPicked['icon'].fontFamily;
String lsIconName = lmIconPicked['name'];
_effectiveController?.text = lsIconName;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
@@ -1,6 +1,6 @@
name: icon_picker
description: A Flutter widget to display a dialog containing an icon collection to pick one returning a jason iconData.
version: 2.0.0
version: 2.0.1
homepage: https://github.com/m3uzz/icon_picker

environment:
Expand Down
2 changes: 1 addition & 1 deletion test/icon_picker_test.dart
Expand Up @@ -44,7 +44,7 @@ void main() {
await tester.pumpWidget(myWidget);
expect(
find.text(
'{"iconName": "ac_unit", "codePoint": 58712, "fontFamily": "MaterialIcons"}'),
'{"iconName": "ac_unit", "codePoint": 57399, "fontFamily": "MaterialIcons"}'),
findsOneWidget,
reason: 'IconPicker value result not changed!',
);
Expand Down

0 comments on commit 098288f

Please sign in to comment.