💄 Better desktop platform window decoration

This commit is contained in:
LittleSheep 2024-12-08 19:11:37 +08:00
parent 893b820e24
commit f1dbea190b

View File

@ -5,7 +5,9 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:responsive_framework/responsive_framework.dart'; import 'package:responsive_framework/responsive_framework.dart';
import 'package:styled_widget/styled_widget.dart';
import 'package:surface/providers/navigation.dart'; import 'package:surface/providers/navigation.dart';
import 'package:surface/widgets/connection_indicator.dart'; import 'package:surface/widgets/connection_indicator.dart';
import 'package:surface/widgets/dialog.dart'; import 'package:surface/widgets/dialog.dart';
@ -96,6 +98,14 @@ class AppRootScaffold extends StatelessWidget {
], ],
); );
final windowButtonColor = WindowButtonColors(
iconNormal: Theme.of(context).colorScheme.primary,
mouseOver: Theme.of(context).colorScheme.primaryContainer,
mouseDown: Theme.of(context).colorScheme.onPrimaryContainer,
iconMouseOver: Theme.of(context).colorScheme.primary,
iconMouseDown: Theme.of(context).colorScheme.primary,
);
return AppBackground( return AppBackground(
isRoot: true, isRoot: true,
child: Scaffold( child: Scaffold(
@ -104,16 +114,38 @@ class AppRootScaffold extends StatelessWidget {
children: [ children: [
if (!kIsWeb && if (!kIsWeb &&
(Platform.isWindows || Platform.isLinux || Platform.isMacOS)) (Platform.isWindows || Platform.isLinux || Platform.isMacOS))
Container( WindowBorder(
decoration: BoxDecoration( color: Theme.of(context).dividerColor,
border: Border( width: 1,
bottom: BorderSide( child: Row(
color: Theme.of(context).dividerColor, crossAxisAlignment: CrossAxisAlignment.center,
width: 1 / devicePixelRatio, children: [
WindowTitleBarBox(
child: MoveWindow(
child: Text(
'Solian',
style: GoogleFonts.spaceGrotesk(),
).padding(horizontal: 12, vertical: 5),
),
), ),
), Expanded(
child: WindowTitleBarBox(
child: Row(
children: [
Expanded(child: MoveWindow()),
Row(
children: [
MinimizeWindowButton(colors: windowButtonColor),
MaximizeWindowButton(colors: windowButtonColor),
CloseWindowButton(colors: windowButtonColor),
],
),
],
),
),
),
],
), ),
child: WindowTitleBarBox(child: MoveWindow()),
), ),
ConnectionIndicator(), ConnectionIndicator(),
Expanded(child: innerWidget), Expanded(child: innerWidget),