Skip to content

Commit

Permalink
style: enable hover color for action popup actions
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesvedder committed May 27, 2024
1 parent e3e9874 commit 873a9cf
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions designer_v2/lib/common_views/action_popup_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ActionPopUpMenuButton extends StatelessWidget {
data: Theme.of(context).copyWith(
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
hoverColor: Colors.transparent,
// hoverColor: Colors.transparent,
),
child: popupMenu);
}
Expand All @@ -70,26 +70,37 @@ class ActionPopUpMenuButton extends StatelessWidget {
elevation: elevation,
splashRadius: splashRadius,
position: position,
onSelected: (ModelAction action) => action.onExecute(),
onSelected: (action) => action is ModelAction ? action.onExecute() : null,
itemBuilder: (BuildContext context) {
final textTheme = theme.textTheme.labelMedium!;
return actions.map((action) {
return PopupMenuItem(
final List<PopupMenuEntry> popupList = [];
for (final action in actions) {
if (action.isSeparator) {
popupList.add(const PopupMenuDivider());
continue;
}
popupList.add(PopupMenuItem(
value: action,
child: ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 0),
contentPadding: const EdgeInsets.symmetric(
horizontal: 8.0, vertical: 0),
horizontalTitleGap: 4.0,
leading: (action.icon == null)
? const SizedBox.shrink()
: Icon(action.icon,
size: theme.iconTheme.size ?? 14.0,
color: action.isDestructive ? Colors.red : iconColorDefault),
size: theme.iconTheme.size ?? 14.0,
color: action.isDestructive
? Colors.red
: iconColorDefault),
title: action.isDestructive
? Text(action.label, style: textTheme.copyWith(color: Colors.red))
? Text(
action.label, style: textTheme.copyWith(color: Colors.red))
: Text(action.label, style: textTheme),
),
);
}).toList();
));
continue;
}
return popupList;
});
}
}

0 comments on commit 873a9cf

Please sign in to comment.