πŸ” Precision Select Dropdown

A production-ready, generic, searchable dropdown widget for Flutter.

precision_select_dropdown is built using overlay-based positioning to provide precise UI behavior, debounced search, outside tap dismissal, and full customization support.

Designed for scalability, clean architecture, and enterprise-grade applications.


✨ Features

  • βœ… Generic <T> type support
  • βœ… Search field inside dropdown
  • βœ… Overlay-based dropdown positioning
  • βœ… Outside tap dismissal (like native dropdown)
  • βœ… Android back button handling
  • βœ… Debounced search
  • βœ… Custom item builder
  • βœ… Custom search matcher
  • βœ… Empty state (β€œNo Data Found”)
  • βœ… Dart 3 & Null Safety support
  • βœ… Clean lifecycle management

πŸ“Έ Preview

Collapsed State

Collapsed

Expanded with Options

Expanded

Search in Action

Search

No Data Found State

No Data

πŸ“¦ Installation

Add this to your pubspec.yaml:

dependencies:
  precision_select_dropdown: ^0.0.1

Then run:

flutter pub get

πŸ›  Basic Usage

PrecisionSelectDropdown<String>(
  items: const [
    'Apple',
    'Banana',
    'Orange',
    'Mango',
    'Pineapple',
  ],
  itemLabelBuilder: (item) => item,
  hintText: 'Select a fruit',
  onChanged: (value) {
    debugPrint("Selected: $value");
  },
)

🧠 Advanced Usage (Custom Search + Custom UI)

PrecisionSelectDropdown<User>(
  items: users,
  hintText: "Select User",
  itemLabelBuilder: (user) => user.name,
  searchMatcher: (user, query) =>
      user.name.toLowerCase().contains(query.toLowerCase()) ||
      user.email.toLowerCase().contains(query.toLowerCase()),
  itemBuilder: (context, user) => ListTile(
    title: Text(user.name),
    subtitle: Text(user.email),
  ),
  onChanged: (value) {},
),

βš™οΈ Parameters

Parameter Type Description
items List<T> Data source
itemLabelBuilder String Function(T) Converts item to display text
itemBuilder Widget Function(BuildContext, T)? Custom item UI
searchMatcher bool Function(T, String)? Custom search logic
onChanged ValueChanged<T?> Selection callback
initialValue T? Preselected value
hintText String Placeholder text
enabled bool Enable/disable dropdown
maxHeight double Maximum dropdown height

πŸ— Architecture

This widget is implemented using:

  • OverlayEntry
  • CompositedTransformFollower
  • LayerLink
  • Debounced filtering
  • Full lifecycle safety
  • Outside tap barrier handling
  • Android back button support

The architecture keeps business logic (search filtering) decoupled from UI rendering, making it extensible and testable.


πŸ§ͺ Example

A full working example is available inside the /example folder.

To run it:

cd example
flutter run

πŸ“Œ Upcoming Features

  • πŸ”² Multi-select support
  • πŸ”² Async API search support
  • πŸ”² FormField integration with validation
  • πŸ”² Clear/reset icon
  • πŸ”² Animated open/close transitions
  • πŸ”² Dialog mode (fullscreen search)
  • πŸ”² Controller-based architecture
  • πŸ”² Keyboard navigation support
  • πŸ”² Accessibility improvements
  • πŸ”² Advanced theming customization

🀝 Contributing

Contributions are welcome.

If you’d like to improve this package:

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request

For major changes, please open an issue first to discuss the proposal.


Development Setup

  1. Clone the repository
  2. Run dart pub get
  3. Make your changes
  4. Run dart test to ensure tests pass
  5. Run dart analyze to check for issues
  6. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™‹β€β™‚οΈ Support

If you find this package useful, please consider giving it a ⭐ on GitHub.

Example

See the example/ directory for a complete usage example.

Changelog

See CHANGELOG.md for a detailed list of changes.


Made with ❀️ for the Dart community