build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Builds the selector interface using a Select widget that triggers a popup on interaction, rendering each option as a SelectItemButton within a SurfaceCard for elevated presentation.

The method maps the values list to interactive buttons using the labelBuilder for text content, applies the current value and change handler for state management, and constrains the popup width to the anchor element's size via PopoverConstraint.anchorFixedSize. This ensures responsive behavior in layouts like Section or alongside IconButton for enhanced input experiences, with theme-aware styling from ArcaneTheme.

Implementation

@override

/// Builds the selector interface using a [Select] widget that triggers a
/// popup on interaction, rendering each option as a [SelectItemButton]
/// within a [SurfaceCard] for elevated presentation.
///
/// The method maps the values list to interactive buttons using the
/// labelBuilder for text content, applies the current value and change
/// handler for state management, and constrains the popup width to the
/// anchor element's size via PopoverConstraint.anchorFixedSize. This
/// ensures responsive behavior in layouts like [Section] or alongside
/// [IconButton] for enhanced input experiences, with theme-aware styling
/// from [ArcaneTheme].
Widget build(BuildContext context) => Select<T>(
    itemBuilder: (context, item) => Text(labelBuilder(item)),
    value: value,
    onChanged: onChanged,
    popupWidthConstraint: PopoverConstraint.anchorFixedSize,
    canUnselect: canUnselect,
    popup: (context) => SurfaceCard(
            child: Column(
          children: [
            ...values.map((e) =>
                SelectItemButton(value: e, child: Text(labelBuilder(e))))
          ],
        )));