mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 03:06:59 +08:00
tweaks (#1846)
* opt: live extra * opt: remove addPointer * opt: use ssd * opt: cache svg * opt: localToGlobal * opt: disabled icon * opt: onVideoDetailChange switch * fix --------- Co-authored-by: dom <githubaccount56556@proton.me>
This commit is contained in:
committed by
GitHub
parent
4a3d827f7a
commit
e707764f84
@@ -25,9 +25,11 @@ import 'package:PiliPlus/pages/setting/widgets/multi_select_dialog.dart';
|
||||
import 'package:PiliPlus/pages/setting/widgets/select_dialog.dart';
|
||||
import 'package:PiliPlus/pages/setting/widgets/slider_dialog.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/utils/fullscreen.dart';
|
||||
import 'package:PiliPlus/utils/extension/file_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/theme_ext.dart';
|
||||
import 'package:PiliPlus/utils/global_data.dart';
|
||||
import 'package:PiliPlus/utils/path_utils.dart';
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
@@ -38,6 +40,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
List<SettingsModel> get styleSettings => [
|
||||
if (PlatformUtils.isDesktop) ...[
|
||||
@@ -56,16 +59,7 @@ List<SettingsModel> get styleSettings => [
|
||||
needReboot: true,
|
||||
),
|
||||
],
|
||||
if (Platform.isLinux)
|
||||
const SwitchModel(
|
||||
title: '使用SSD(Server-Side Decoration)',
|
||||
subtitle: '(Linux)强制使用Server-Side Decoration',
|
||||
leading: Icon(Icons.web_asset),
|
||||
setKey: SettingBoxKey.useSSD,
|
||||
defaultVal: false,
|
||||
needReboot: true,
|
||||
onChanged: GStorage.syncToDisk,
|
||||
),
|
||||
if (Platform.isLinux) _useSSDModel(),
|
||||
SwitchModel(
|
||||
title: '横屏适配',
|
||||
subtitle: '启用横屏布局与逻辑,平板、折叠屏等可开启;建议全屏方向设为【不改变当前方向】',
|
||||
@@ -920,3 +914,31 @@ Future<void> _showBarHideTypeDialog(
|
||||
setState();
|
||||
}
|
||||
}
|
||||
|
||||
NormalModel _useSSDModel() {
|
||||
final file = File(path.join(appSupportDirPath, 'use_ssd'));
|
||||
void onChanged(BuildContext context, VoidCallback setState) {
|
||||
(file.existsSync() ? file.tryDel() : file.create()).whenComplete(() {
|
||||
if (context.mounted) {
|
||||
setState();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return NormalModel(
|
||||
title: '使用SSD(Server-Side Decoration)',
|
||||
leading: const Icon(Icons.web_asset),
|
||||
onTap: onChanged,
|
||||
getTrailing: (theme) => Builder(
|
||||
builder: (context) => Transform.scale(
|
||||
scale: 0.8,
|
||||
alignment: .centerRight,
|
||||
child: Switch(
|
||||
value: file.existsSync(),
|
||||
onChanged: (_) =>
|
||||
onChanged(context, (context as Element).markNeedsBuild),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user