Giter VIP home page Giter VIP logo

dropdown_plus's Introduction

dropdown_plus

Simple and easy to use Dropdown in forms with search, keyboard navigation, offiline data source, remote data source and easy customization.

Getting Started

Simple Text Dropdown.

TextDropdownFormField(
    options: ["Male", "Female"],
    decoration: InputDecoration(
        border: OutlineInputBorder(),
        suffixIcon: Icon(Icons.arrow_drop_down),
        labelText: "Gender"),
    dropdownHeight: 120,
),

Install

packages.yaml
dropdown_plus: <lastest version>

Customizable Example


 final List<Map<String, dynamic>> _roles = [
    {"name": "Super Admin", "desc": "Having full access rights", "role": 1},
    {
      "name": "Admin",
      "desc": "Having full access rights of a Organization",
      "role": 2
    },
    {
      "name": "Manager",
      "desc": "Having Magenent access rights of a Organization",
      "role": 3
    },
    {
      "name": "Technician",
      "desc": "Having Technician Support access rights",
      "role": 4
    },
    {
      "name": "Customer Support",
      "desc": "Having Customer Support access rights",
      "role": 5
    },
    {"name": "User", "desc": "Having End User access rights", "role": 6},
  ];


// ...
// ...

DropdownFormField<Map<String, dynamic>>(
    onEmptyActionPressed: () async {},
    decoration: InputDecoration(
        border: OutlineInputBorder(),
        suffixIcon: Icon(Icons.arrow_drop_down),
        labelText: "Access"),
    onSaved: (dynamic str) {},
    onChanged: (dynamic str) {},
    validator: (dynamic str) {},
    displayItemFn: (dynamic item) => Text(
    item['name'] ?? '',
    style: TextStyle(fontSize: 16),
    ),
    findFn: (dynamic str) async => _roles,
    filterFn: (dynamic item, str) =>
        item['name'].toLowerCase().indexOf(str.toLowerCase()) >= 0,
    dropdownItemFn: (dynamic item, position, focused,
            dynamic lastSelectedItem, onTap) =>
        ListTile(
    title: Text(item['name']),
    subtitle: Text(
        item['desc'] ?? '',
    ),
    tileColor:
        focused ? Color.fromARGB(20, 0, 0, 0) : Colors.transparent,
    onTap: onTap,
    ),
),

Options

final bool autoFocus;
final bool Function(dynamic item, String str)? filterFn;
final bool Function(dynamic item1, dynamic item2)? selectedFn;
final Future<List<dynamic>> Function(String str) findFn;

final ListTile Function(
  dynamic item,
  int position,
  bool focused,
  bool selected,
  Function() onTap,
) dropdownItemFn;

final Widget Function(dynamic item) displayItemFn;
final InputDecoration? decoration;
final Color? dropdownColor;
final DropdownEditingController<T>? controller;
final void Function(dynamic item)? onChanged;
final void Function(dynamic)? onSaved;
final String? Function(T?)? validator;
final double? dropdownHeight;
final TextStyle? searchTextStyle;
final String emptyText;
final String emptyActionText;
final Future<void> Function()? onEmptyActionPressed;

dropdown_plus's People

Contributors

hashcapdotcom avatar davidmoros avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.