2021-10-29 03:38:36 +00:00
|
|
|
/// 音量键翻页
|
|
|
|
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import '../Common.dart';
|
|
|
|
import '../Method.dart';
|
|
|
|
|
2021-11-04 05:56:25 +00:00
|
|
|
const _propertyName = "androidSecureFlag";
|
2021-10-29 03:38:36 +00:00
|
|
|
|
2021-11-04 05:56:25 +00:00
|
|
|
late bool _androidSecureFlag;
|
2021-10-29 03:38:36 +00:00
|
|
|
|
|
|
|
Future<void> initAndroidSecureFlag() async {
|
|
|
|
if (Platform.isAndroid) {
|
2021-11-04 05:56:25 +00:00
|
|
|
_androidSecureFlag =
|
|
|
|
(await method.loadProperty(_propertyName, "false")) == "true";
|
|
|
|
if (_androidSecureFlag) {
|
2021-10-29 03:38:36 +00:00
|
|
|
await method.androidSecureFlag(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-04 05:56:25 +00:00
|
|
|
Future<void> _chooseAndroidSecureFlag(BuildContext context) async {
|
2021-10-29 03:38:36 +00:00
|
|
|
String? result =
|
|
|
|
await chooseListDialog<String>(context, "禁止截图/禁止显示在任务视图", ["是", "否"]);
|
|
|
|
if (result != null) {
|
|
|
|
var target = result == "是";
|
2021-11-04 05:56:25 +00:00
|
|
|
await method.saveProperty(_propertyName, "$target");
|
|
|
|
_androidSecureFlag = target;
|
|
|
|
await method.androidSecureFlag(_androidSecureFlag);
|
2021-10-29 03:38:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget androidSecureFlagSetting() {
|
|
|
|
if (Platform.isAndroid) {
|
|
|
|
return StatefulBuilder(builder:
|
|
|
|
(BuildContext context, void Function(void Function()) setState) {
|
|
|
|
return ListTile(
|
2022-03-19 04:12:27 +00:00
|
|
|
title: const Text("禁止截图/禁止显示在任务视图"),
|
2021-11-04 05:56:25 +00:00
|
|
|
subtitle: Text(_androidSecureFlag ? "是" : "否"),
|
2021-10-29 03:38:36 +00:00
|
|
|
onTap: () async {
|
2021-11-04 05:56:25 +00:00
|
|
|
await _chooseAndroidSecureFlag(context);
|
2021-10-29 03:38:36 +00:00
|
|
|
setState(() {});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return Container();
|
|
|
|
}
|