Skip to content

Commit

Permalink
YaruWindowControlRow: Adding FG and BG color
Browse files Browse the repository at this point in the history
  • Loading branch information
Miroslav Mazel authored and sergio-costas committed Dec 14, 2023
1 parent 2d6fbec commit 6a84af9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/src/widgets/yaru_window_control_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class YaruWindowControlRow extends StatelessWidget {
required this.onMaximize,
required this.onMinimize,
required this.onRestore,
this.foregroundColor,
this.backgroundColor,
});

final List<YaruWindowControlType> windowControls;
Expand All @@ -36,6 +38,12 @@ class YaruWindowControlRow extends StatelessWidget {
/// double-clicked while the window is maximized.
final FutureOr<void> Function(BuildContext)? onRestore;

/// The foreground color.
final Color? foregroundColor;

/// The background color.
final Color? backgroundColor;

@override
Widget build(BuildContext context) {
return Padding(
Expand All @@ -46,19 +54,25 @@ class YaruWindowControlRow extends StatelessWidget {
switch (type) {
case YaruWindowControlType.close:
return YaruWindowControl(
foregroundColor: foregroundColor,
backgroundColor: backgroundColor,
type: YaruWindowControlType.close,
onTap: onClose != null ? () => onClose!(context) : null,
);
case YaruWindowControlType.maximize:
case YaruWindowControlType.restore:
if (isMaximized == true) {
return YaruWindowControl(
foregroundColor: foregroundColor,
backgroundColor: backgroundColor,
type: YaruWindowControlType.restore,
onTap:
onRestore != null ? () => onRestore!(context) : null,
);
} else {
return YaruWindowControl(
foregroundColor: foregroundColor,
backgroundColor: backgroundColor,
type: YaruWindowControlType.maximize,
onTap: onMaximize != null
? () => onMaximize!(context)
Expand All @@ -67,6 +81,8 @@ class YaruWindowControlRow extends StatelessWidget {
}
case YaruWindowControlType.minimize:
return YaruWindowControl(
foregroundColor: foregroundColor,
backgroundColor: backgroundColor,
type: YaruWindowControlType.minimize,
onTap:
onMinimize != null ? () => onMinimize!(context) : null,
Expand Down

0 comments on commit 6a84af9

Please sign in to comment.