bg_searchable_dropdown 0.0.5

SDKflutter
Platformandroidioswindowslinuxmacosweb

More Descriptive: Instead of just saying it provides customized options, the description now mentions specific features like search functionality, clear option, and flexible styling. This gives potential users a better idea of what the package offers. Concise and Clear: It's still relatively short and to the point, but it provides more useful information. Action-Oriented: The use of offering features like... is a bit more active and engaging.

BGSearchableDropDown

A Flutter widget that provides a searchable dropdown list with customization options.

Features

  • Searchable dropdown with filtering functionality
  • Customizable border, text style, and dropdown icon
  • Clear selection option
  • Overlay-based dropdown positioning

Installation

Add this package to your pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  bg_searchable_dropdown:
    path: path_to_your_local_package  # Change this if publishing to pub.dev

Usage

Basic Example

import 'package:flutter/material.dart';
import 'package:bg_searchable_dropdown/bg_searchable_dropdown.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(title: Text("Searchable Dropdown Example")),
        body: Center(
          child: Padding(
            padding: const EdgeInsets.all(16.0),
            child: BGSearchableDropDown(
              items: ['Apple', 'Banana', 'Cherry', 'Date', 'Elderberry'],
              hint: 'Select a fruit',
              clearOptionText: 'Clear Selection',
              onChanged: (value) {
                print("Selected: $value");
              },
            ),
          ),
        ),
      ),
    );
  }
}

Properties

PropertyTypeDefault ValueDescription
itemsList<String>[]List of items to display in the dropdown
hintString''Placeholder text when no item is selected
clearOptionTextString'Clear'Text for the clear selection button
onChangedFunction(String?)requiredCallback when an item is selected or cleared
borderColorColorColors.greyBorder color of the dropdown
borderRadiusdouble8.0Border radius of the dropdown
dropdownHeightdouble300.0Height of the dropdown overlay
dropdownIconIconIcons.arrow_drop_downDropdown icon
showClearButtonbooltrueWhether to show the clear selection button
textStyleTextStyleTextStyle(fontSize: 16)Style for the dropdown text
searchLabelTextString?'Search...'Label text for the search field

License

This package is open-source. Feel free to contribute or modify it as needed.