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
|
|
|
}
|
|
|
|
}
|
2021-11-04 03:45:22 +00:00
|
|
|
|
|
|
|
Widget autoFullScreenSetting() {
|
|
|
|
return StatefulBuilder(
|
|
|
|
builder: (BuildContext context, void Function(void Function()) setState) {
|
|
|
|
return ListTile(
|
|
|
|
title: Text("进入阅读器自动全屏"),
|
|
|
|
subtitle: Text(autoFullScreenName()),
|
|
|
|
onTap: () async {
|
|
|
|
await chooseAutoFullScreen(context);
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|