comicMenuRow function

Widget comicMenuRow(
  1. Set<WidgetState> states,
  2. Widget face(
    1. Set<WidgetState> states
    )
)

A design-kit menu row's face, built by face for the states it shows: the current row (hovered or focused, which ui_core gives one row of a menu at most) as focused, Comic's one lit face, and nothing else of the pointer's or the keys'.

Implementation

Widget comicMenuRow(
  Set<WidgetState> states,
  Widget Function(Set<WidgetState> states) face,
) {
  final current =
      !states.contains(WidgetState.disabled) &&
      (states.contains(WidgetState.focused) ||
          states.contains(WidgetState.hovered));
  return face({
    ...states.difference(const {WidgetState.hovered, WidgetState.focused}),
    if (current) WidgetState.focused,
  });
}