fix remote menubar theme

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2023-03-11 19:29:26 +08:00
parent fc9b2d60e3
commit fc8e3df7dc
2 changed files with 23 additions and 4 deletions

View File

@ -252,6 +252,9 @@ class MyTheme {
),
),
),
menuBarTheme: MenuBarThemeData(
style:
MenuStyle(backgroundColor: MaterialStatePropertyAll(Colors.white))),
colorScheme: ColorScheme.light(
primary: Colors.blue, secondary: accent, background: grayBg),
).copyWith(
@ -352,6 +355,9 @@ class MyTheme {
),
),
),
menuBarTheme: MenuBarThemeData(
style: MenuStyle(
backgroundColor: MaterialStatePropertyAll(Color(0xFF121212)))),
colorScheme: ColorScheme.dark(
primary: Colors.blue,
secondary: accent,

View File

@ -408,7 +408,12 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
borderRadius: BorderRadius.all(Radius.circular(4.0)),
color: Theme.of(context)
.menuBarTheme
.style
?.backgroundColor
?.resolve(MaterialState.values.toSet()),
),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
@ -416,9 +421,9 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
data: themeData(),
child: Row(
children: [
SizedBox(width: _MenubarTheme.buttonHMargin),
SizedBox(width: _MenubarTheme.buttonHMargin * 2),
...menubarItems,
SizedBox(width: _MenubarTheme.buttonHMargin)
SizedBox(width: _MenubarTheme.buttonHMargin * 2)
],
),
),
@ -441,7 +446,13 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
),
dividerTheme: DividerThemeData(space: 4),
menuBarTheme: MenuBarThemeData(
style: MenuStyle(padding: MaterialStatePropertyAll(EdgeInsets.zero))),
style: MenuStyle(
padding: MaterialStatePropertyAll(EdgeInsets.zero),
elevation: MaterialStatePropertyAll(0),
shape: MaterialStatePropertyAll(BeveledRectangleBorder()),
).copyWith(
backgroundColor:
Theme.of(context).menuBarTheme.style?.backgroundColor)),
);
}
}
@ -1863,6 +1874,7 @@ class _IconMenuButtonState extends State<_IconMenuButton> {
height: _MenubarTheme.buttonSize,
child: MenuItemButton(
style: ButtonStyle(
backgroundColor: MaterialStatePropertyAll(Colors.transparent),
padding: MaterialStatePropertyAll(EdgeInsets.zero),
overlayColor: MaterialStatePropertyAll(Colors.transparent)),
onHover: (value) => setState(() {
@ -1934,6 +1946,7 @@ class _IconSubmenuButtonState extends State<_IconSubmenuButton> {
child: SubmenuButton(
menuStyle: widget.menuStyle,
style: ButtonStyle(
backgroundColor: MaterialStatePropertyAll(Colors.transparent),
padding: MaterialStatePropertyAll(EdgeInsets.zero),
overlayColor: MaterialStatePropertyAll(Colors.transparent)),
onHover: (value) => setState(() {