Simple and robust FindDropdown with item search feature, making it possible to use an offline item list or filtering URL for easy customization.

If you use rxdart in your project in a version lower than 0.23.x, use version 0.1.7+1 of this package. Otherwise, you can use the most current version!

find_dropdown: <lastest version>

import 'package:find_dropdown/find_dropdown.dart';

Simple implementation #

FindDropdown( items: ["Brasil", "Itália", "Estados Unidos", "Canadá"], label: "País", onChanged: (String item) => print(item), selectedItem: "Brasil", );

FindDropdown( items: ["Brasil", "Itália", "Estados Unidos", "Canadá"], label: "País", onChanged: (String item) => print(item), selectedItem: "Brasil", validate: (String item) { if (item == null) return "Required field"; else if (item == "Brasil") return "Invalid item"; else return null; //return null to "no error" }, );

FindDropdown<UserModel>( label: "Nome", onFind: (String filter) async { var response = await Dio().get( "http://5d85ccfb1e61af001471bf60.mockapi.io/user", queryParameters: {"filter": filter}, ); var models = UserModel.fromJsonList(response.data); return models; }, onChanged: (UserModel data) { print(data); }, );

Layout customization #

You can customize the layout of the FindDropdown and its items. EXAMPLE

To customize the FindDropdown, we have the dropdownBuilder property, which takes a function with the parameters:

BuildContext context : current context;

: current context; T item : Current item, where T is the type passed in the FindDropdown constructor.

To customize the items, we have the dropdownItemBuilder property, which takes a function with the parameters:

BuildContext context : current context;

: current context; T item : Current item, where T is the type passed in the FindDropdown constructor.

: Current item, where is the type passed in the FindDropdown constructor. bool isSelected : Boolean that tells you if the current item is selected.

To use a template as an item type, you need to implement toString, equals and hashcode, as shown below: