pikapika/lib/basic/config/AutoFullScreen.dart

34 lines
776 B
Dart
Raw Normal View History

2021-09-29 23:57:09 +00:00
/// 自动全屏
import 'package:flutter/material.dart';
import '../Common.dart';
import '../Method.dart';
2021-10-21 04:08:51 +00:00
late bool _autoFullScreen;
bool currentAutoFullScreen() {
return _autoFullScreen;
}
const _propertyName = "autoFullScreen";
2021-09-29 23:57:09 +00:00
Future<void> initAutoFullScreen() async {
2021-10-21 04:08:51 +00:00
_autoFullScreen =
(await method.loadProperty(_propertyName, "false")) == "true";
2021-09-29 23:57:09 +00:00
}
String autoFullScreenName() {
2021-10-21 04:08:51 +00:00
return _autoFullScreen ? "" : "";
2021-09-29 23:57:09 +00:00
}
Future<void> chooseAutoFullScreen(BuildContext context) async {
String? result =
await chooseListDialog<String>(context, "进入阅读器自动全屏", ["", ""]);
if (result != null) {
var target = result == "";
2021-10-21 04:08:51 +00:00
await method.saveProperty(_propertyName, "$target");
_autoFullScreen = target;
2021-09-29 23:57:09 +00:00
}
}