flutter_native_select 1.0.0
flutter_native_select: ^1.0.0 copied to clipboard

A flutter plugin which can open a native select box.

flutter_native_select #

pub package

A flutter plugin which can open a native select box.

Usage #

This plugin provides the openSelect method, which opens a select box on the screen, and returns a promise which resolves when the dialog has been dismissed. The value is null in case the user dismissed the dialog (pressed the back button on android), or the value of the selected item.

void showSelect() async {
  final selectedItem = await FlutterNativeSelect.openSelect(
    items: [
      NativeSelectItem(value: 'item0', label: 'Item 0'),
      NativeSelectItem(value: 'item1', label: 'Item 1'),
      NativeSelectItem(value: 'item2', label: 'Item 2'),
      NativeSelectItem(
        value: 'disabled1',
        label: 'Disabled item 1',
        disabled: true,
        color: Colors.red[900],
      ),
      NativeSelectItem(
        value: 'disabled2',
        label: 'Disabled item 2',
        disabled: true,
      ),
      NativeSelectItem(
        value: 'disabled3',
        label: 'Disabled item 3',
        disabled: true,
      ),
      NativeSelectItem(
        value: 'blue',
        label: 'Blue item',
        color: Colors.blue[900],
      ),
    ],
  );
  
  if (selectedItem == null) {
    print('User cleared or dismissed the dialog');
  } else {
    print('User selected: $selectedItem');
  }
}

Screenshots #

The upper code produces dialogs which are looking like that:

iOS #

iOS screenshot

Android #

Android screenshot

2
likes
110
pub points
43%
popularity

Publisher

mietz.app

A flutter plugin which can open a native select box.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_native_select