search_key_value_dropdown
A Flutter package for creating searchable dropdowns with key-value pairs.
Introduction
The search_key_value_dropdown package provides a widget that allows users to select items from a dropdown menu with search functionality. It is particularly useful when dealing with key-value pairs, where users need to select a value associated with a specific key.
Features
- Create searchable dropdown menus with key-value pairs.
- Customize dropdown appearance and behavior.
- Easy integration into Flutter apps.
Getting Started
To use this package, add search_key_value_dropdown as a dependency in your pubspec.yaml file. For more information on how to add dependencies, visit the official documentation.
Usage
import 'package:flutter/material.dart';
import 'package:search_key_value_dropdown/search_key_value_dropdown.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Searchable Dropdown Demo'),
),
body: Center(
child: SearchableDropDown().constantSearchDropdownButtonFormField2(
items: [
DropdownMenuItem(
value: 'key1',
child: Text('Item 1'),
),
DropdownMenuItem(
value: 'key2',
child: Text('Item 2'),
),
DropdownMenuItem(
value: 'key3',
child: Text('Item 3'),
),
],
selectedValue: 'key1',
onChanged: (value) {
print(value);
},
searchController: TextEditingController(),
hintText: 'Select an item',
labelText: 'Items',
),
),
),
);
}
}