pikapika/lib/basic/config/WillPopNotice.dart

32 lines
798 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(
2022-08-11 03:21:55 +00:00
title: const Text("退出APP的提示"),
subtitle: Text(_willPopNotice ? "" : ""),
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(() {});
},
);
},
);
}