overlay_options_button

A widget that displays a selected value and expands into an overlayed list of alternatives when pressed.

Usage

One use case is a locale picker that expands into a floating list of available languages anchored to the currently selected language.

OverlayOptionsButton(
    initialValue: locale,
    items: supportedLocales,
    onChanged: (value) => locale = value,
    itemBuilder: (context, index, value, select) {
        return IconButton(
            onPressed: () => select(),
            icon: SizedBox.square(
                dimension: 24.0,
                child: ClipOval(
                    child: SvgPicture.asset(
                        resolveAssetFromLocale(locale),
                        fit: BoxFit.cover,
                    ),
                ),
            ),
        );
    },
);