showMultiSelectDialog function
- List<
Object> options, - Stream<
List< inputStream, {int> > - @Deprecated('Use sizing instead.') int? maxVisibleItems,
- SelectComponentSizing sizing = const SelectComponentSizing.fit(),
- Set<
int> initialSelected = const {},
Shows a scrollable terminal selection dialog and returns the set of selected indices.
Each element in options must be either a String or a SelectOption.
Only standard ASCII characters and ANSI SGR styling sequences (\x1b[...m)
should be used in the options (plus newlines in descriptions), as other
characters may break the width calculations.
Temporarily disables stdin line and echo modes, and restores them before returning. Also intercepts ProcessSignal.sigint to cancel the dialog.
The cursor is hidden for the duration of the dialog and then re-shown. If you want the cursor in a certain state after this dialog you will have to restore it.
The inputStream is a list of input events (typically originating from
stdin or Win32AnsiStdin). See the example/select_dialog.dart for
recommended patterns.
The sizing parameter controls the maximum total height of the dialog and
the maximum number of lines displayed for a hovered option's description.
Defaults to SelectComponentSizing.fit.
The deprecated maxVisibleItems parameter is not respected strictly as an
item count; if provided, it computes the maximum total height by adding the
maximum description height (maxVisibleItems + maxDescriptionHeight).
Returns null if the user aborts the dialog (e.g. by pressing Ctrl+C or
escape), there is no terminal attached to stdout, or the terminal is too
small to display the dialog.
Implementation
Future<Set<int>?> showMultiSelectDialog(
List<Object /* String|SelectOption */> options,
Stream<List<int>> inputStream, {
@Deprecated('Use sizing instead.') int? maxVisibleItems,
SelectComponentSizing sizing = const SelectComponentSizing.fit(),
Set<int> initialSelected = const {},
}) => _runDialog(
options,
inputStream,
multiSelect: true,
maxVisibleItems: maxVisibleItems,
sizing: sizing,
initialSelected: initialSelected,
);