diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index ca4969522..b46b7a439 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -176,6 +176,10 @@ class MyTheme { static const Color dark = Colors.black87; static const Color button = Color(0xFF2C8CFF); static const Color hoverBorder = Color(0xFF999999); + static const Color bordDark = Colors.white24; + static const Color bordLight = Colors.black26; + static const Color dividerDark = Colors.white38; + static const Color dividerLight = Colors.black38; // ListTile static const ListTileThemeData listTileTheme = ListTileThemeData( diff --git a/flutter/lib/desktop/widgets/remote_toolbar.dart b/flutter/lib/desktop/widgets/remote_toolbar.dart index f332f31dd..df5530bfc 100644 --- a/flutter/lib/desktop/widgets/remote_toolbar.dart +++ b/flutter/lib/desktop/widgets/remote_toolbar.dart @@ -1,5 +1,7 @@ import 'dart:convert'; import 'dart:ui' as ui; +import 'dart:async'; +import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -111,6 +113,36 @@ class _ToolbarTheme { static const double buttonVMargin = 6; static const double iconRadius = 8; static const double elevation = 3; + + static const Color bordDark = MyTheme.bordDark; + static const Color bordLight = MyTheme.bordLight; + + static const Color dividerDark = MyTheme.dividerDark; + static const Color dividerLight = MyTheme.dividerLight; + static double dividerSpaceToAction = Platform.isWindows ? 8 : 14; + + static double menuBorderRadius = Platform.isWindows ? 5.0 : 7.0; + static EdgeInsets menuPadding = Platform.isWindows + ? EdgeInsets.fromLTRB(4, 12, 4, 12) + : EdgeInsets.fromLTRB(6, 14, 6, 14); + static const double menuButtonBorderRadius = 3.0; + + static final defaultMenuStyle = MenuStyle( + side: MaterialStateProperty.all(BorderSide( + width: 1, + color: MyTheme.currentThemeMode() == ThemeMode.light + ? _ToolbarTheme.bordLight + : _ToolbarTheme.bordDark, + )), + shape: MaterialStatePropertyAll(RoundedRectangleBorder( + borderRadius: BorderRadius.circular(_ToolbarTheme.menuBorderRadius))), + padding: MaterialStateProperty.all(_ToolbarTheme.menuPadding), + ); + static final defaultMenuButtonStyle = ButtonStyle( + backgroundColor: MaterialStatePropertyAll(Colors.transparent), + padding: MaterialStatePropertyAll(EdgeInsets.zero), + overlayColor: MaterialStatePropertyAll(Colors.transparent), + ); } typedef DismissFunc = void Function(); @@ -475,9 +507,17 @@ class _RemoteToolbarState extends State { textStyle: MaterialStatePropertyAll( TextStyle(fontWeight: FontWeight.normal), ), + shape: MaterialStatePropertyAll(RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(_ToolbarTheme.menuButtonBorderRadius))), ), ), - dividerTheme: DividerThemeData(space: 4), + dividerTheme: DividerThemeData( + space: _ToolbarTheme.dividerSpaceToAction, + color: MyTheme.currentThemeMode() == ThemeMode.light + ? _ToolbarTheme.dividerLight + : _ToolbarTheme.dividerDark, + ), menuBarTheme: MenuBarThemeData( style: MenuStyle( padding: MaterialStatePropertyAll(EdgeInsets.zero), @@ -1635,11 +1675,8 @@ class _IconSubmenuButtonState extends State<_IconSubmenuButton> { width: _ToolbarTheme.buttonSize, height: _ToolbarTheme.buttonSize, child: SubmenuButton( - menuStyle: widget.menuStyle, - style: ButtonStyle( - backgroundColor: MaterialStatePropertyAll(Colors.transparent), - padding: MaterialStatePropertyAll(EdgeInsets.zero), - overlayColor: MaterialStatePropertyAll(Colors.transparent)), + menuStyle: widget.menuStyle ?? _ToolbarTheme.defaultMenuStyle, + style: _ToolbarTheme.defaultMenuButtonStyle, onHover: (value) => setState(() { hover = value; }), @@ -1681,6 +1718,7 @@ class _SubmenuButton extends StatelessWidget { child: child, menuChildren: menuChildren.map((e) => _buildPointerTrackWidget(e, ffi)).toList(), + menuStyle: _ToolbarTheme.defaultMenuStyle, ); } }