Fix. Remote toolbar, menu refresh (#7605)

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2024-04-05 09:28:35 +08:00 committed by GitHub
parent 129548764e
commit 2397fdc495
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -636,7 +636,7 @@ class _MonitorMenu extends StatelessWidget {
menuStyle: MenuStyle( menuStyle: MenuStyle(
padding: padding:
MaterialStatePropertyAll(EdgeInsets.symmetric(horizontal: 6))), MaterialStatePropertyAll(EdgeInsets.symmetric(horizontal: 6))),
menuChildren: [buildMonitorSubmenuWidget()]); menuChildrenGetter: () => [buildMonitorSubmenuWidget()]);
} }
Widget buildMultiMonitorMenu() { Widget buildMultiMonitorMenu() {
@ -843,17 +843,17 @@ class _ControlMenu extends StatelessWidget {
color: _ToolbarTheme.blueColor, color: _ToolbarTheme.blueColor,
hoverColor: _ToolbarTheme.hoverBlueColor, hoverColor: _ToolbarTheme.hoverBlueColor,
ffi: ffi, ffi: ffi,
menuChildren: toolbarControls(context, id, ffi).map((e) { menuChildrenGetter: () => toolbarControls(context, id, ffi).map((e) {
if (e.divider) { if (e.divider) {
return Divider(); return Divider();
} else { } else {
return MenuButton( return MenuButton(
child: e.child, child: e.child,
onPressed: e.onPressed, onPressed: e.onPressed,
ffi: ffi, ffi: ffi,
trailingIcon: e.trailingIcon); trailingIcon: e.trailingIcon);
} }
}).toList()); }).toList());
} }
} }
@ -1046,53 +1046,56 @@ class _DisplayMenuState extends State<_DisplayMenu> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
_screenAdjustor.updateScreen(); _screenAdjustor.updateScreen();
final menuChildren = <Widget>[ menuChildrenGetter() {
_screenAdjustor.adjustWindow(context), final menuChildren = <Widget>[
viewStyle(), _screenAdjustor.adjustWindow(context),
scrollStyle(), viewStyle(),
imageQuality(), scrollStyle(),
codec(), imageQuality(),
_ResolutionsMenu( codec(),
id: widget.id, _ResolutionsMenu(
ffi: widget.ffi, id: widget.id,
screenAdjustor: _screenAdjustor, ffi: widget.ffi,
), screenAdjustor: _screenAdjustor,
// We may add this feature if it is needed and we have an EV certificate. ),
// _VirtualDisplayMenu( // We may add this feature if it is needed and we have an EV certificate.
// id: widget.id, // _VirtualDisplayMenu(
// ffi: widget.ffi, // id: widget.id,
// ), // ffi: widget.ffi,
Divider(), // ),
toggles(), Divider(),
]; toggles(),
// privacy mode ];
if (ffiModel.keyboard && pi.features.privacyMode) { // privacy mode
final privacyModeState = PrivacyModeState.find(id); if (ffiModel.keyboard && pi.features.privacyMode) {
final privacyModeList = final privacyModeState = PrivacyModeState.find(id);
toolbarPrivacyMode(privacyModeState, context, id, ffi); final privacyModeList =
if (privacyModeList.length == 1) { toolbarPrivacyMode(privacyModeState, context, id, ffi);
menuChildren.add(CkbMenuButton( if (privacyModeList.length == 1) {
value: privacyModeList[0].value, menuChildren.add(CkbMenuButton(
onChanged: privacyModeList[0].onChanged, value: privacyModeList[0].value,
child: privacyModeList[0].child, onChanged: privacyModeList[0].onChanged,
ffi: ffi)); child: privacyModeList[0].child,
} else if (privacyModeList.length > 1) { ffi: ffi));
menuChildren.addAll([ } else if (privacyModeList.length > 1) {
Divider(), menuChildren.addAll([
_SubmenuButton( Divider(),
ffi: widget.ffi, _SubmenuButton(
child: Text(translate('Privacy mode')), ffi: widget.ffi,
menuChildren: privacyModeList child: Text(translate('Privacy mode')),
.map((e) => CkbMenuButton( menuChildren: privacyModeList
value: e.value, .map((e) => CkbMenuButton(
onChanged: e.onChanged, value: e.value,
child: e.child, onChanged: e.onChanged,
ffi: ffi)) child: e.child,
.toList()), ffi: ffi))
]); .toList()),
]);
}
} }
menuChildren.add(widget.pluginItem);
return menuChildren;
} }
menuChildren.add(widget.pluginItem);
return _IconSubmenuButton( return _IconSubmenuButton(
tooltip: 'Display Settings', tooltip: 'Display Settings',
@ -1100,7 +1103,7 @@ class _DisplayMenuState extends State<_DisplayMenu> {
ffi: widget.ffi, ffi: widget.ffi,
color: _ToolbarTheme.blueColor, color: _ToolbarTheme.blueColor,
hoverColor: _ToolbarTheme.hoverBlueColor, hoverColor: _ToolbarTheme.hoverBlueColor,
menuChildren: menuChildren, menuChildrenGetter: menuChildrenGetter,
); );
} }
@ -1645,15 +1648,15 @@ class _KeyboardMenu extends StatelessWidget {
ffi: ffi, ffi: ffi,
color: _ToolbarTheme.blueColor, color: _ToolbarTheme.blueColor,
hoverColor: _ToolbarTheme.hoverBlueColor, hoverColor: _ToolbarTheme.hoverBlueColor,
menuChildren: [ menuChildrenGetter: () => [
keyboardMode(modeOnly), keyboardMode(modeOnly),
localKeyboardType(), localKeyboardType(),
inputSource(), inputSource(),
Divider(), Divider(),
viewMode(), viewMode(),
Divider(), Divider(),
...toolbarToggles, ...toolbarToggles,
]); ]);
} }
keyboardMode(String? modeOnly) { keyboardMode(String? modeOnly) {
@ -1804,7 +1807,7 @@ class _ChatMenuState extends State<_ChatMenu> {
ffi: widget.ffi, ffi: widget.ffi,
color: _ToolbarTheme.blueColor, color: _ToolbarTheme.blueColor,
hoverColor: _ToolbarTheme.hoverBlueColor, hoverColor: _ToolbarTheme.hoverBlueColor,
menuChildren: [textChat(), voiceCall()]); menuChildrenGetter: () => [textChat(), voiceCall()]);
} }
textChat() { textChat() {
@ -2008,7 +2011,7 @@ class _IconSubmenuButton extends StatefulWidget {
final Widget? icon; final Widget? icon;
final Color color; final Color color;
final Color hoverColor; final Color hoverColor;
final List<Widget> menuChildren; final List<Widget> Function() menuChildrenGetter;
final MenuStyle? menuStyle; final MenuStyle? menuStyle;
final FFI ffi; final FFI ffi;
final double? width; final double? width;
@ -2020,7 +2023,7 @@ class _IconSubmenuButton extends StatefulWidget {
required this.tooltip, required this.tooltip,
required this.color, required this.color,
required this.hoverColor, required this.hoverColor,
required this.menuChildren, required this.menuChildrenGetter,
required this.ffi, required this.ffi,
this.menuStyle, this.menuStyle,
this.width, this.width,
@ -2064,7 +2067,8 @@ class _IconSubmenuButtonState extends State<_IconSubmenuButton> {
color: hover ? widget.hoverColor : widget.color, color: hover ? widget.hoverColor : widget.color,
), ),
child: icon))), child: icon))),
menuChildren: widget.menuChildren menuChildren: widget
.menuChildrenGetter()
.map((e) => _buildPointerTrackWidget(e, widget.ffi)) .map((e) => _buildPointerTrackWidget(e, widget.ffi))
.toList())); .toList()));
return MenuBar(children: [ return MenuBar(children: [