From 649ea3f6c1b86df89de77a284f91a986c6a06657 Mon Sep 17 00:00:00 2001 From: Matias de Andrea Date: Thu, 18 May 2023 16:07:23 +0200 Subject: [PATCH] fix: improve when show dropdown disabled hint --- lib/src/fields/form_builder_dropdown.dart | 12 +++++------- pubspec.lock | 2 +- pubspec.yaml | 1 - 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/src/fields/form_builder_dropdown.dart b/lib/src/fields/form_builder_dropdown.dart index 02177d426..cdb288735 100644 --- a/lib/src/fields/form_builder_dropdown.dart +++ b/lib/src/fields/form_builder_dropdown.dart @@ -1,4 +1,3 @@ -import 'package:collection/collection.dart' show IterableExtension; import 'package:flutter/material.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart'; @@ -262,12 +261,11 @@ class FormBuilderDropdown extends FormBuilderFieldDecoration { value: hasValue ? field.value : null, style: style, isDense: isDense, - disabledHint: field.value != null - ? (items - .firstWhereOrNull((dropDownItem) => - dropDownItem.value == field.value) - ?.child ?? - Text(field.value.toString())) + disabledHint: hasValue + ? items + .firstWhere( + (dropDownItem) => dropDownItem.value == field.value) + .child : disabledHint, elevation: elevation, iconSize: iconSize, diff --git a/pubspec.lock b/pubspec.lock index 02e34d92f..7847eaa45 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -34,7 +34,7 @@ packages: source: hosted version: "1.1.1" collection: - dependency: "direct main" + dependency: transitive description: name: collection sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" diff --git a/pubspec.yaml b/pubspec.yaml index 2b2d8d897..65657a81d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,6 @@ dependencies: flutter: sdk: flutter intl: ^0.18.0 - collection: ^1.17.1 dev_dependencies: flutter_lints: ^2.0.1