show wallpaper only when support, show test on checked

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2023-10-14 18:50:41 +08:00
parent 5e616dd502
commit 68ef1fc9e0
8 changed files with 75 additions and 21 deletions

View File

@@ -323,24 +323,7 @@ class _GeneralState extends State<_General> {
'enable-confirm-closing-tabs',
isServer: false),
_OptionCheckBox(context, 'Adaptive bitrate', 'enable-abr'),
if (Platform.isWindows || Platform.isLinux)
Row(
children: [
Flexible(
child: _OptionCheckBox(
context,
'Remove wallpaper during incoming sessions',
'allow-remove-wallpaper'),
),
_CountDownButton(
text: 'Test',
second: 5,
onPressed: () {
bind.mainTestWallpaper(second: 5);
},
)
],
),
wallpaper(),
_OptionCheckBox(
context,
'Open connection in new tab',
@@ -367,6 +350,42 @@ class _GeneralState extends State<_General> {
return _Card(title: 'Other', children: children);
}
Widget wallpaper() {
return futureBuilder(future: () async {
final support = await bind.mainSupportRemoveWallpaper();
return support;
}(), hasData: (data) {
if (data is bool && data == true) {
final option = 'allow-remove-wallpaper';
bool value = mainGetBoolOptionSync(option);
return Row(
children: [
Flexible(
child: _OptionCheckBox(
context,
'Remove wallpaper during incoming sessions',
option,
update: () {
setState(() {});
},
),
),
if (value)
_CountDownButton(
text: 'Test',
second: 5,
onPressed: () {
bind.mainTestWallpaper(second: 5);
},
)
],
);
}
return Offstage();
});
}
Widget hwcodec() {
return Offstage(
offstage: !bind.mainHasHwcodec(),