GF Flutter Multiselect Dropdown Menu

GF Flutter Multiselect Dropdown Menu

GF Flutter Multiselect Dropdown Usage

The simple example demo code of a basic GFMultiselect is as shown below.

GFMultiSelect(
  items: dropList,
  onSelect: (value) {
    print('selected $value ');
  },
  dropdownTitleTileText: 'Messi, Griezmann, Coutinho ',
  dropdownTitleTileMargin: EdgeInsets.only(
      top: 22, left: 18, right: 18, bottom: 5),
  dropdownTitleTilePadding: EdgeInsets.all(10),
  dropdownUnderlineBorder:
  const BorderSide(color: Colors.transparent, width: 2),
  dropdownTitleTileBorder:
  Border.all(color: Colors.grey[200], width: 1),
  dropdownTitleTileBorderRadius: BorderRadius.circular(5),
  expandedIcon: const Icon(
    Icons.keyboard_arrow_down,
    color: Colors.black54,
  ),
  collapsedIcon: const Icon(
    Icons.keyboard_arrow_up,
    color: Colors.black54,
  ),
  submitButton: Text('OK'),
  cancelButton: Text('Cancel'),
  dropdownTitleTileTextStyle:
  const TextStyle(fontSize: 14, color: Colors.black54),
  padding: const EdgeInsets.all(6),
  margin: const EdgeInsets.all(6),
  type: GFCheckboxType.basic,
  activeBgColor: GFColors.SUCCESS,
  activeBorderColor: GFColors.SUCCESS,
  inactiveBorderColor: Colors.grey[200],
),

GF Custom Flutter Multiselect option

GFMultiselect features allow users to create a customized multi-select dropdown for the more flexible and interactive UI design.

The below example code gives the basic Flutter Multi Select option in flutter app

Container(
  child: GFMultiSelect(
    items: dropList,
    onSelect: (value) {
      print('selected $value ');
    },
    dropdownTitleTileText: 'Messi, Griezmann, Coutinho ',
    dropdownTitleTileColor: Colors.grey[200],
    dropdownTitleTileMargin: EdgeInsets.only(
        top: 22, left: 18, right: 18, bottom: 5),
    dropdownTitleTilePadding: EdgeInsets.all(10),
    dropdownUnderlineBorder: const BorderSide(
        color: Colors.transparent, width: 2),
    dropdownTitleTileBorder:
    Border.all(color: Colors.grey[300], width: 1),
    dropdownTitleTileBorderRadius: BorderRadius.circular(5),
    expandedIcon: const Icon(
      Icons.keyboard_arrow_down,
      color: Colors.black54,
    ),
    collapsedIcon: const Icon(
      Icons.keyboard_arrow_up,
      color: Colors.black54,
    ),
    submitButton: Text('OK'),
    dropdownTitleTileTextStyle: const TextStyle(
        fontSize: 14, color: Colors.black54),
    padding: const EdgeInsets.all(6),
    margin: const EdgeInsets.all(6),
    type: GFCheckboxType.basic,
    activeBgColor: Colors.green.withOpacity(0.5),
    inactiveBorderColor: Colors.grey[200],
  ),
),

**GF Flutter Multiselect **Custom Properties

The look and feel of the **GFMultiselect **can be customized using the GFMultiselect properties.

NameDescription
itemsdefines the list of items the user can select
onSelectcallback when user select item from the dropdown, in callback we get list of selected items index
dropdownTitleTileTexttype of [String] to define the dropdownTitleTile title
dropdownTitleTileTextStyletype of [TextStyle] to define the textStyle of [dropDownTitleTileText]
dropdownTitleTileHintTexttype of [String] to define the dropdownTitleTile hint text
dropdownTitleTileHintTextStyletype of [TextStyle] to define the textStyle of [dropDownTitleTileHintTextStyle]
dropdownTitleTileBorderRadiusdefines the border radius of the dropdownTitleTile
dropdownTitleTileBorderdefines the border of the dropdownTitleTile.
dropdownTitleTileColordefines the background color of dropdownButton
hideDropdownUnderlineon true state, it hides the Dropdown Underline border defaults value is false
dropdownUnderlineBorderdefines the border of the Dropdown Underline border
dropdownTitleTileMargindefines the dropdownTitleTile margin
dropdownTitleTilePaddingdefines the dropdownTitleTile padding
expandedIcondefines the dropdownTitleTile's trailing icon when dropdown is visible
collapsedIcondefines the dropdownTitleTile's trailing icon when dropdown is not visible
submitButtondefines the button in the dropdown
colordefines dropdown checkbox ListTile's background color. Can be given [Color] or [GFColors]
avatartype of [Widget] or [GFAvatar] used to defines dropdown checkbox ListTile's leading
margindefines the margin of dropdown checkbox ListTile
paddingdefines the padding of dropdown checkbox ListTile
typedefines dropdown ListTile's checkbox type type of [GFCheckboxType] which is of four type is basic, sqaure, circular and custom
sizedefines dropdown ListTile's checkbox size type of [double] which is GFSize ie, small, medium and large and can use any double value
activeBgColordefines dropdown ListTile's checkbox background color when its active type of [Color] used to change the backgroundColor of the active checkbox
inactiveBgColordefines dropdown ListTile's checkbox background color when its inactive type of [Color] used to change the backgroundColor of the inactive checkbox
activeBorderColor<p>defines dropdown ListTile's checkbox border color when its active</p><p> type of [Color] used to change the border color of the active checkbox</p>
inactiveBorderColor<p>defines dropdown ListTile's checkbox border color when its inactive</p><p> type of [Color] used to change the border color of the inactive checkbox</p>
activeIcon<p>defines dropdown ListTile's checkbox's active icon</p><p> type of [Widget] used to change the checkbox's active icon</p>
inactiveIcon<p>defines dropdown ListTile's checkbox's inactive icon</p><p> type of [Widget] used to change the checkbox's inactive icon</p>
customBgColortype of [Color] used to change the background color of the custom active checkbox only
selectedTo have the list tile appear selected when the checkbox is checked, pass the same value to both. Normally, this property is left to its default value, false.
dropdownBgColordefines the background color of the dropdown. Can be given [Color] or [GFColors]

Last Updated: September 21, 2023