mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-01-19 00:13:01 +08:00
optimize menubar code
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
a9598e006a
commit
47a514a416
@ -1101,7 +1101,8 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
await bind.sessionSetImageQuality(id: widget.id, value: value);
|
||||
}
|
||||
|
||||
return SubmenuButton(
|
||||
return _SubmenuButton(
|
||||
ffi: widget.ffi,
|
||||
child: Text(translate('Image Quality')),
|
||||
menuChildren: [
|
||||
_RadioMenuButton<String>(
|
||||
@ -1135,7 +1136,7 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
},
|
||||
ffi: widget.ffi,
|
||||
),
|
||||
].map((e) => _buildPointerTrackWidget(e, widget.ffi)).toList(),
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
@ -1310,7 +1311,8 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
bind.sessionChangePreferCodec(id: widget.id);
|
||||
}
|
||||
|
||||
return SubmenuButton(
|
||||
return _SubmenuButton(
|
||||
ffi: widget.ffi,
|
||||
child: Text(translate('Codec')),
|
||||
menuChildren: [
|
||||
_RadioMenuButton<String>(
|
||||
@ -1341,7 +1343,7 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
onChanged: onChanged,
|
||||
ffi: widget.ffi,
|
||||
),
|
||||
].map((e) => _buildPointerTrackWidget(e, widget.ffi)).toList());
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
@ -1373,7 +1375,8 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
}
|
||||
}
|
||||
|
||||
return SubmenuButton(
|
||||
return _SubmenuButton(
|
||||
ffi: widget.ffi,
|
||||
menuChildren: resolutions
|
||||
.map((e) => _RadioMenuButton(
|
||||
value: '${e.width}x${e.height}',
|
||||
@ -1381,8 +1384,6 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
onChanged: onChanged,
|
||||
ffi: widget.ffi,
|
||||
child: Text('${e.width}x${e.height}')))
|
||||
.toList()
|
||||
.map((e) => _buildPointerTrackWidget(e, widget.ffi))
|
||||
.toList(),
|
||||
child: Text(translate("Resolution")));
|
||||
}
|
||||
@ -1869,6 +1870,28 @@ class _IconSubmenuButtonState extends State<_IconSubmenuButton> {
|
||||
}
|
||||
}
|
||||
|
||||
class _SubmenuButton extends StatelessWidget {
|
||||
final List<Widget> menuChildren;
|
||||
final Widget? child;
|
||||
final FFI ffi;
|
||||
const _SubmenuButton({
|
||||
Key? key,
|
||||
required this.menuChildren,
|
||||
required this.child,
|
||||
required this.ffi,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SubmenuButton(
|
||||
key: key,
|
||||
child: child,
|
||||
menuChildren:
|
||||
menuChildren.map((e) => _buildPointerTrackWidget(e, ffi)).toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _MenuItemButton extends StatelessWidget {
|
||||
final VoidCallback? onPressed;
|
||||
final Widget? trailingIcon;
|
||||
|
Loading…
Reference in New Issue
Block a user