Skip to content
This repository was archived by the owner on May 20, 2023. It is now read-only.

Commit 8583594

Browse files
cissyshinshahan
authored andcommitted
Allow selection options input to accept a List in addition to SelectionOptions.
PiperOrigin-RevId: 213681083
1 parent 189d4a0 commit 8583594

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

angular_components/lib/material_input/material_auto_suggest_input.dart

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,24 @@ class MaterialAutoSuggestInputComponent extends MaterialSelectBase
382382
});
383383
}
384384

385-
/// The available options for this container.
386-
@override
385+
/// Sets the available options for the input.
386+
///
387+
/// Accepts either a [SelectionOptions] or a [List]. If a [List] is passed,
388+
/// the [StringSelectionOptions] class will be used to create the selection
389+
/// options.
387390
@Input('selectionOptions')
391+
set selectionOptionsInput(dynamic value) {
392+
if (value == null) return;
393+
if (value is SelectionOptions) {
394+
options = value;
395+
} else if (value is List) {
396+
options = StringSelectionOptions(value, toFilterableString: itemRenderer);
397+
} else {
398+
throw ArgumentError('Unsupported selection options type.');
399+
}
400+
}
401+
402+
@override
388403
set options(SelectionOptions options) {
389404
if (options == null) return;
390405
super.options = options;

0 commit comments

Comments
 (0)