Skip to content

Commit

Permalink
feat: Add EditableComboBox.inputFormatters (Fixes #1041)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdlukaa committed Nov 18, 2024
1 parent 52f7ed4 commit f688240
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- fix: Correctly unfocus `NumberBox` when user taps outside ([#1135](https://github.com/bdlukaa/fluent_ui/issues/1135))
- fix: Do try to scroll Date and Time at build time ([#1117](https://github.com/bdlukaa/fluent_ui/issues/1117))
- feat: Use a `Decoration` instead of `Color` in `NavigationAppBar` ([#1118](https://github.com/bdlukaa/fluent_ui/issues/1118))
- feat: Add `EditableComboBox.inputFormatters` ([#1041](https://github.com/bdlukaa/fluent_ui/issues/1041))

## 4.9.2

Expand Down
7 changes: 7 additions & 0 deletions lib/src/controls/form/editable_combo_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class EditableComboBox<T> extends ComboBox<T> {
required this.onFieldSubmitted,
this.textController,
this.onTextChanged,
this.inputFormatters,
// When adding new arguments, consider adding similar arguments to
// EditableComboboxFormField.
});
Expand Down Expand Up @@ -76,6 +77,9 @@ class EditableComboBox<T> extends ComboBox<T> {
/// * [onChanged], which is called when the selected value changes.
final ValueChanged<String>? onTextChanged;

/// {@macro flutter.widgets.editableText.inputFormatters}
final List<TextInputFormatter>? inputFormatters;

@override
State<ComboBox<T>> createState() => _EditableComboboxState<T>();
}
Expand Down Expand Up @@ -188,6 +192,7 @@ class _EditableComboboxState<T> extends ComboBoxState<T> {
_setText(newText);
},
onChanged: widget.onTextChanged,
inputFormatters: widget.inputFormatters,
),
);
}
Expand Down Expand Up @@ -363,6 +368,7 @@ class EditableComboboxFormField<T> extends FormField<T> {
AlignmentGeometry alignment = AlignmentDirectional.centerStart,
BorderRadius? borderRadius,
required SubmitEditableCombobox onFieldSubmitted,
List<TextInputFormatter>? inputFormatters,
// When adding new arguments, consider adding similar arguments to
// EditableComboBox.
}) : super(builder: (FormFieldState<T> field) {
Expand Down Expand Up @@ -399,6 +405,7 @@ class EditableComboboxFormField<T> extends FormField<T> {
autofocus: autofocus,
popupColor: popupColor,
onFieldSubmitted: onFieldSubmitted,
inputFormatters: inputFormatters,
),
),
);
Expand Down

0 comments on commit f688240

Please sign in to comment.