pikapika/lib/basic/config/UsingRightClickPop.dart

40 lines
994 B
Dart
Raw Permalink Normal View History

2022-03-25 14:57:30 +00:00
/// 自动全屏
import 'dart:io';
import 'package:flutter/material.dart';
import '../Common.dart';
import '../Method.dart';
const _propertyName = "usingRightClickPop";
late bool _usingRightClickPop;
Future<void> initUsingRightClickPop() async {
_usingRightClickPop =
(await method.loadProperty(_propertyName, "false")) == "true";
}
bool currentUsingRightClickPop() {
return _usingRightClickPop;
}
Widget usingRightClickPopSetting() {
if (!(Platform.isWindows || Platform.isMacOS || Platform.isLinux)) {
return Container();
}
return StatefulBuilder(
builder: (BuildContext context, void Function(void Function()) setState) {
2023-05-08 09:57:28 +00:00
return SwitchListTile(
2022-03-25 14:57:30 +00:00
title: const Text("鼠标右键返回上一页"),
2023-05-08 09:57:28 +00:00
onChanged: (value) async {
await method.saveProperty(_propertyName, "${value ? "" : ""}");
_usingRightClickPop = value;
2022-03-25 14:57:30 +00:00
setState(() {});
},
2023-05-08 09:57:28 +00:00
value: _usingRightClickPop,
2022-03-25 14:57:30 +00:00
);
},
);
}