From 8e4171be56cfc19de9b02af664fcc7974f2c8f52 Mon Sep 17 00:00:00 2001 From: PartyDonut Date: Fri, 1 Aug 2025 09:41:43 +0200 Subject: [PATCH] chore: Changed titlebar window buttons background --- lib/screens/shared/default_title_bar.dart | 168 ++++++++++++---------- 1 file changed, 89 insertions(+), 79 deletions(-) diff --git a/lib/screens/shared/default_title_bar.dart b/lib/screens/shared/default_title_bar.dart index aff9362..6375cac 100644 --- a/lib/screens/shared/default_title_bar.dart +++ b/lib/screens/shared/default_title_bar.dart @@ -47,8 +47,8 @@ class _DefaultTitleBarState extends ConsumerState with WindowLi decoration: BoxDecoration( gradient: LinearGradient( colors: [ - surfaceColor.withValues(alpha: 0.7), surfaceColor.withValues(alpha: hovering ? 0.7 : 0), + surfaceColor.withValues(alpha: 0), ], begin: Alignment.topCenter, end: Alignment.bottomCenter, @@ -83,94 +83,104 @@ class _DefaultTitleBarState extends ConsumerState with WindowLi ), ), ), - Row( - children: [ - FutureBuilder>(future: Future.microtask(() async { - final isMinimized = await windowManager.isMinimized(); - return [isMinimized]; - }), builder: (context, snapshot) { - final isMinimized = snapshot.data?.firstOrNull ?? false; - return IconButton( + Container( + decoration: BoxDecoration(boxShadow: [ + BoxShadow( + color: surfaceColor.withValues(alpha: 0.15), + blurRadius: 32, + spreadRadius: 10, + offset: const Offset(8, -6), + ), + ]), + child: Row( + children: [ + FutureBuilder>(future: Future.microtask(() async { + final isMinimized = await windowManager.isMinimized(); + return [isMinimized]; + }), builder: (context, snapshot) { + final isMinimized = snapshot.data?.firstOrNull ?? false; + return IconButton( + style: IconButton.styleFrom( + hoverColor: brightness == Brightness.light + ? Colors.black.withValues(alpha: 0.1) + : Colors.white.withValues(alpha: 0.2), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2))), + onPressed: () async { + fullScreenHelper.closeFullScreen(ref); + if (isMinimized) { + windowManager.restore(); + } else { + windowManager.minimize(); + } + }, + icon: Transform.translate( + offset: const Offset(0, -2), + child: Icon( + Icons.minimize_rounded, + color: iconColor, + size: 20, + ), + ), + ); + }), + FutureBuilder>( + future: Future.microtask(() async { + final isMaximized = await windowManager.isMaximized(); + return [isMaximized]; + }), + builder: (BuildContext context, AsyncSnapshot> snapshot) { + final maximized = snapshot.data?.firstOrNull ?? false; + return IconButton( + style: IconButton.styleFrom( + hoverColor: brightness == Brightness.light + ? Colors.black.withValues(alpha: 0.1) + : Colors.white.withValues(alpha: 0.2), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2)), + ), + onPressed: () async { + fullScreenHelper.closeFullScreen(ref); + if (maximized) { + await windowManager.unmaximize(); + return; + } + if (!maximized) { + await windowManager.maximize(); + } else { + await windowManager.unmaximize(); + } + }, + icon: Transform.translate( + offset: const Offset(0, 0), + child: Icon( + maximized ? Icons.maximize_rounded : Icons.crop_square_rounded, + color: iconColor, + size: 19, + ), + ), + ); + }, + ), + IconButton( style: IconButton.styleFrom( - hoverColor: brightness == Brightness.light - ? Colors.black.withValues(alpha: 0.1) - : Colors.white.withValues(alpha: 0.2), - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2))), + hoverColor: Colors.red, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(2), + ), + ), onPressed: () async { - fullScreenHelper.closeFullScreen(ref); - if (isMinimized) { - windowManager.restore(); - } else { - windowManager.minimize(); - } + windowManager.close(); }, icon: Transform.translate( offset: const Offset(0, -2), child: Icon( - Icons.minimize_rounded, + Icons.close_rounded, color: iconColor, - size: 20, + size: 23, ), ), - ); - }), - FutureBuilder>( - future: Future.microtask(() async { - final isMaximized = await windowManager.isMaximized(); - return [isMaximized]; - }), - builder: (BuildContext context, AsyncSnapshot> snapshot) { - final maximized = snapshot.data?.firstOrNull ?? false; - return IconButton( - style: IconButton.styleFrom( - hoverColor: brightness == Brightness.light - ? Colors.black.withValues(alpha: 0.1) - : Colors.white.withValues(alpha: 0.2), - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2)), - ), - onPressed: () async { - fullScreenHelper.closeFullScreen(ref); - if (maximized) { - await windowManager.unmaximize(); - return; - } - if (!maximized) { - await windowManager.maximize(); - } else { - await windowManager.unmaximize(); - } - }, - icon: Transform.translate( - offset: const Offset(0, 0), - child: Icon( - maximized ? Icons.maximize_rounded : Icons.crop_square_rounded, - color: iconColor, - size: 19, - ), - ), - ); - }, - ), - IconButton( - style: IconButton.styleFrom( - hoverColor: Colors.red, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(2), - ), ), - onPressed: () async { - windowManager.close(); - }, - icon: Transform.translate( - offset: const Offset(0, -2), - child: Icon( - Icons.close_rounded, - color: iconColor, - size: 23, - ), - ), - ), - ], + ], + ), ), ], ),