categorized_dropdown 1.0.0 copy "categorized_dropdown: ^1.0.0" to clipboard
categorized_dropdown: ^1.0.0 copied to clipboard

Categorised droptown created using base dropdown widget of the Flutter.

categorized_dropdown #

Categorized dropdown created using base dropdown widget of the Flutter.

Dropdown Field Dropdown Items

Getting Started #

Depend on it #

Run this command:

With Flutter:

 $ flutter pub add categorised_dropdown

This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):

dependencies:
   categorized_dropdown:  1.0.0

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

Import it #

Now in your Dart code, you can use:

import  'package:categorized_dropdown/categorised_dropdown.dart';

Example #

final List<CategorizedDropdownItem<String>>? items = [
  CategorizedDropdownItem(text: 'Exhaust', subItems: [
    SubCategorizedDropdownItem(text: 'Pipes', value: 'pipes'),
    SubCategorizedDropdownItem(text: 'Mufflers', value: 'mufflers'),
    SubCategorizedDropdownItem(text: 'Gaskets', value: 'gaskets'),
  ]),
  CategorizedDropdownItem(text: 'Engine Parts', subItems: [
    SubCategorizedDropdownItem(text: 'Engine mounts', value: 'engine-mounts'),
    SubCategorizedDropdownItem(text: 'Oil Filters', value: 'oil-filters'),
  ]),
  CategorizedDropdownItem(text: 'Fuel & Emission', subItems: [
    SubCategorizedDropdownItem(text: 'Fuel Injection', value: 'fuel-incection'),
    SubCategorizedDropdownItem(text: '02 Sensor', value: 'o2-sensor'),
  ]),
  CategorizedDropdownItem(text: 'Other', value: 'Other'),
];
String? value;
CategorizedDropdown(
  items: items,
  value: value,
  hint: const Text('Select auto parts'),
  onChanged: (v) {
    setState(() {
      value = value;
    });
  },
),

Contributions #

Contributions of any kind are more than welcome! Feel free to fork and improve in any way you want, make a pull request, or open an issue.

10
likes
150
points
51
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Categorised droptown created using base dropdown widget of the Flutter.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on categorized_dropdown