pikapika/lib/basic/config/WillPopNotice.dart

31 lines
772 B
Dart
Raw Normal View History

2022-08-11 03:21:55 +00:00
import 'package:flutter/material.dart';
import '../Method.dart';
const _propertyName = "willPopNotice";
late bool _willPopNotice;
Future initWillPopNotice() async {
_willPopNotice = (await method.loadProperty(_propertyName, "false")) == "true";
}
bool willPopNotice() {
return _willPopNotice;
}
Widget willPopNoticeSetting() {
return StatefulBuilder(
builder: (BuildContext context, void Function(void Function()) setState) {
2023-04-12 09:48:48 +00:00
return SwitchListTile(
2023-05-08 09:57:28 +00:00
title: const Text("在首页连续按两下返回键才能退出APP"),
2023-04-12 09:48:48 +00:00
value: _willPopNotice,
onChanged: (value) async {
await method.saveProperty(_propertyName, "$value");
_willPopNotice = value;
2022-08-11 03:21:55 +00:00
setState(() {});
},
);
},
);
}