build method

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

Implementation

@override
Widget build(BuildContext context) {
  return PopupMenuButton<int>(
    initialValue: value,
    itemBuilder: (c) => options.menuItems(),
    position: PopupMenuPosition.under,
    onSelected: (v) {
      value = v;
      updateState();
      onChange?.call(v);
    },
    child: RowMax([
      if (label != null) label!,
      if (align == HorAlign.center || align == HorAlign.right) const Spacer(),
      options.toWidgetOr(value, emptyText),
      if (align == HorAlign.center || align == HorAlign.left) const Spacer(),
      Icons.arrow_drop_down_outlined.icon(),
      if (clearable)
        IconButton(
            onPressed: () {
              value = null;
              updateState();
              onChange?.call(null);
            },
            icon: Icons.clear_rounded.icon(size: 16)),
    ]).padded(xy(0, 10)).sizedBox(height: 56).underLine(),
  );
}