flutter_easy_dropdown

Last updated:

0 purchases

flutter_easy_dropdown Image
flutter_easy_dropdown Images
Add to Cart

Description:

flutter easy dropdown

I am developing a new plugin flutter_easy_dropdown that uses the latest version dropdown_search. I have added new features in this new plugin like a pagintion in dropdown list using netwok APIs.


Flutter Easy DropdownSearch



Flutter simple and robust Easy DropdownSearch with item search feature, making it possible to use an offline item list or filtering URL for easy customization with PAGINATION VIEW.




Key Features #

Dropdown with pagination
Sync and/or Async items (online, offline, DB, ...)
Searchable dropdown
Three dropdown mode: Menu/ BottomSheet/ ModalBottomSheet / Dialog
Single & multi selection
Material dropdown
Easy customizable UI
Handle Light and Dark theme
Easy implementation into statelessWidget
Support multi level items

Pagination implementation (using Dio package) #
DropdownSearch<UserModel>(
dropdownSearchDecoration: InputDecoration(labelText: "Name"),
onLoadMore: (String filter, int offset) async {
var response = await Dio().get(
"http://5d85ccfb1e61af001471bf60.mockapi.io/user",
queryParameters: {"filter": filter, "page":offset, "size":10},
);
var models = UserModel.fromJsonList(response.data);
return models;
},
onChanged: (UserModel? data) {
print(data);
},
)
copied to clipboard


















packages.yaml #
flutter_easy_dropdown: <lastest version>
copied to clipboard
Import #
import 'package:flutter_easy_dropdown/flutter_easy_dropdown.dart';
copied to clipboard
Simple implementation #
DropdownSearch<String>(
popupProps: PopupProps.menu(
showSelectedItems: true,
disabledItemFn: (String s) => s.startsWith('I'),
),
items: ["Brazil", "Italia (Disabled)", "US", 'Canada'],
dropdownDecoratorProps: DropDownDecoratorProps(
dropdownSearchDecoration: InputDecoration(
labelText: "Menu mode",
hintText: "country in menu mode",
),
),
onChanged: print,
selectedItem: "Brazil",
)

DropdownSearch<String>.multiSelection(
items: ["Brazil", "Italia (Disabled)", "London", 'Canada'],
popupProps: PopupPropsMultiSelection.menu(
showSelectedItems: true,
disabledItemFn: (String s) => s.startsWith('I'),
),
onChanged: print,
selectedItems: ["Brazil"],
)
copied to clipboard
customize showed field (itemAsString) #
DropdownSearch<UserModel>(
asyncItems: (String filter) => getData(filter),
itemAsString: (UserModel u) => u.userAsStringByName(),
onChanged: (UserModel? data) => print(data),
dropdownDecoratorProps: DropDownDecoratorProps(
dropdownSearchDecoration: InputDecoration(labelText: "User by name"),
),
)

DropdownSearch<UserModel>(
asyncItems: (String filter) => getData(filter),
itemAsString: (UserModel u) => u.userAsStringById(),
onChanged: (UserModel? data) => print(data),
dropdownDecoratorProps: DropDownDecoratorProps(
dropdownSearchDecoration: InputDecoration(labelText: "User by id"),
),
)
copied to clipboard
customize Filter Function #
DropdownSearch<UserModel>(
filterFn: (user, filter) =>
user.userFilterByCreationDate(filter),
asyncItems: (String filter) => getData(filter),
itemAsString: (UserModel u) => u.userAsStringByName(),
onChanged: (UserModel? data) => print(data),
dropdownDecoratorProps: DropDownDecoratorProps(
dropdownSearchDecoration: InputDecoration(labelText: "Name"),
),
)
copied to clipboard
customize Search Mode #
DropdownSearch<UserModel>(
popupProps: PopupProps.bottomSheet(),
dropdownSearchDecoration: InputDecoration(labelText: "Name"),
asyncItems: (String filter) => getData(filter),
itemAsString: (UserModel u) => u.userAsString(),
onChanged: (UserModel? data) => print(data),
)
copied to clipboard
Validation #
DropdownSearch(
items: ["Brazil", "France", "Tunisia", "Canada"],
dropdownSearchDecoration: InputDecoration(labelText: "Name"),
onChanged: print,
selectedItem: "Tunisia",
validator: (String? item) {
if (item == null)
return "Required field";
else if (item == "Brazil")
return "Invalid item";
else
return null;
},
)
copied to clipboard
Endpoint implementation (using Dio package) #
DropdownSearch<UserModel>(
dropdownSearchDecoration: InputDecoration(labelText: "Name"),
asyncItems: (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);
},
)

copied to clipboard
Support #
If this plugin was useful to you, helped you to deliver your app, saved you a lot of time, or you just want to support the project.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.