toAnchorChild method

Widget toAnchorChild()

Implementation

Widget toAnchorChild() {
  return switch (this) {
    AppActionDivider() => const Divider(),
    final AppActionBuilder builder => builder.builder(),
    final AppActionsGroup group => SubmenuButton(
        menuChildren: group.items.toAnchorChildren(),
        leadingIcon: group.iconCallback?.call() ?? group.icon,
        child: Text(group.label, style: group.style),
      ),
    final AppAction action => TooltipVisibility(
        visible: action.tooltip != null,
        child: Tooltip(
          message: action.tooltip ?? action.label,
          child: MenuItemButton(
            onPressed: action.onPressed,
            leadingIcon: action.iconCallback?.call() ?? action.icon,
            closeOnActivate: action.submenuSettings?.closeOnActivate ?? true,
            child: Text(action.label, style: action.style),
          ),
        ),
      ),
  };
}