Skip to content
pubscout

flex_dropdown

0.2.0, released 2 years ago by snappx.io

Create custom dropdowns with styling, animations, and flexible data sources in Flutter.

WASM-ready
$ flutter pub add flex_dropdown
Source repository

What it does

The package enables you to easily implement dropdown menus with custom styling, custom animations, and data sources. It provides a RawFlexDropDown widget that utilizes OverlayPortal for flexible positioning and menu control.

AI-written summary of version 0.2.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to build a custom dropdown widget with precise positioning and custom button or menu layouts.
  • You want to manage dropdown visibility with an OverlayPortalController.

Skip it when

  • You are looking for a fully styled Material Design dropdown out of the box without building custom widgets.
  • You need a simple standard form dropdown field and don't need custom styling or animations.

Strengths

  • Supports custom styling and animations for dropdown menus.
  • Precise positioning and dismissal on tap outside.
  • Uses OverlayPortal for smooth rendering over other widgets.

Weaknesses

  • Requires writing custom button and menu builders rather than providing a plug-and-play standard dropdown field.
  • Not documented with extensive pre-built UI themes.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
final OverlayPortalController _controller = OverlayPortalController();

@override
Widget build(BuildContext context) {
  return RawFlexDropDown(
    controller: _controller,
    dismissOnTapOutside: true,
    buttonBuilder: (context, onTap) {
      return ButtonWidget(
        width: 500,
        onTap: onTap,
      );
    },
    menuBuilder: (context, width) {
      return Padding(
        padding: const EdgeInsets.only(top: 4),
        child: MenuWidget(
          width: width,
          onItemTap: () {
            _controller.hide();
          },
        ),
      );
    },
  );
}

Alternatives

Packages that do the same job and could replace flex_dropdown.