Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/ui/compact_icon_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class CompactIconButton extends StatelessWidget {
this.extent,
this.radius = 6,
this.tapTargetSize,
this.selectedBackground,
});

final Widget icon;
Expand All @@ -33,6 +34,10 @@ class CompactIconButton extends StatelessWidget {
/// buttons edge to edge and cannot afford padding around each one.
final MaterialTapTargetSize? tapTargetSize;

/// The surface while [selected], in place of the palette's selection: the
/// drawing dock marks its tool in the tonal sage.
final Color? selectedBackground;

@override
Widget build(BuildContext context) {
final palette = context.palette;
Expand Down Expand Up @@ -63,7 +68,9 @@ class CompactIconButton extends StatelessWidget {
if (states.contains(WidgetState.pressed)) {
return scheme.primary.withValues(alpha: 0.10);
}
if (selected) return palette.selectedBackground;
if (selected) {
return selectedBackground ?? palette.selectedBackground;
}
if (states.contains(WidgetState.hovered) ||
states.contains(WidgetState.focused)) {
return palette.hover;
Expand Down
Loading
Loading