extendable_dropdown
ExtendableDropdown는 동적이고 사용자 정의 가능한 드롭다운 메뉴를 위한 유연한 Flutter 패키지입니다
다중 드롭다운 처리를 위한 dart 패키지
{"sdk":"flutter"}{"sdk":"flutter"}^4.0.0아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
Introducing ExtendableDropdown, a production-ready Flutter package that empowers you to create dynamic and expandable multiple dropdown menus with full support for generic data types.
T) with full type safety. No longer restricted to strings!labelBuilder API: Complete control over how your custom objects are rendered as text in the dropdown.Add extendable_dropdown as a dependency in your pubspec.yaml file:
dependencies:
extendable_dropdown: ^1.0.4
Import the package in your Flutter code:
import 'package:extendable_dropdown/extendable_dropdown.dart';
List<String> cities = ['Colombo', 'Kandy', 'Galle', 'Jaffna'];
ExtendableDropdown<String>(
list: cities,
onSendListChanged: (selectedItems) {
print('Selected cities: $selectedItems');
},
)
You can use any custom model and fully override the UI.
ExtendableDropdown<Location>(
list: myLocationList,
onSendListChanged: (selected) => print(selected),
labelBuilder: (location) => location.name,
// Completely custom add button
addButton: ElevatedButton.icon(
onPressed: null, // Logic is handled internally
icon: Icon(Icons.add),
label: Text("Add Location"),
),
// Custom notification logic
onMessage: (context, message) {
MyCustomToast.show(message);
},
)
ExtendableDropdown comes with a wide range of styling options:
| Property | Description | Default |
|---|---|---|
list |
The initial list of items to choose from. | Required |
onSendListChanged |
Callback triggered when the selection changes. | Required |
labelBuilder |
Function to map generic items to strings. | item.toString() |
addButton |
Widget: Custom widget for the add button. | Styled default button |
onMessage |
Callback: Handle custom alerts/notifications. | Default SnackBar |
dismissibleBackgroundColor |
Color shown when swiping to delete. | Colors.red |
selectedIcon |
Icon shown for a selected slot. | Icons.radio_button_checked |
nonSelectedIcon |
Icon shown for an empty slot. | Icons.location_on_outlined |
dropdownBorderRadius |
Border radius of the dropdown container. | 10.0 |
We welcome your feedback and contributions! Please feel free to open issues or submit pull requests.
This project is licensed under the MIT License - see the [LICENSE](file:///Users/mymac/Documents/MyProjects/extendable_dropdown/LICENSE) file for details.
Made with ❤️ by Chanuka Ranathunga