Skip to content

Commit

Permalink
fix: improve when show dropdown disabled hint
Browse files Browse the repository at this point in the history
  • Loading branch information
deandreamatias committed May 18, 2023
1 parent 5dbe5b5 commit 649ea3f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
12 changes: 5 additions & 7 deletions lib/src/fields/form_builder_dropdown.dart
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -262,12 +261,11 @@ class FormBuilderDropdown<T> extends FormBuilderFieldDecoration<T> {
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,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ packages:
source: hosted
version: "1.1.1"
collection:
dependency: "direct main"
dependency: transitive
description:
name: collection
sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
Expand Down
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ dependencies:
flutter:
sdk: flutter
intl: ^0.18.0
collection: ^1.17.1

dev_dependencies:
flutter_lints: ^2.0.1
Expand Down

0 comments on commit 649ea3f

Please sign in to comment.