Show disclaimer when enabling dev tools
This commit is contained in:
parent
fb839eb458
commit
187d7bfa36
@ -137,9 +137,26 @@ class _SettingsState extends State<Settings> {
|
|||||||
visualDensity: const VisualDensity(horizontal: VisualDensity.minimumDensity),
|
visualDensity: const VisualDensity(horizontal: VisualDensity.minimumDensity),
|
||||||
value: settings.val().devToolsEnabled,
|
value: settings.val().devToolsEnabled,
|
||||||
onChanged: (state) {
|
onChanged: (state) {
|
||||||
setState(() {
|
changeView() => setState(() {
|
||||||
settings.val(write: true).devToolsEnabled = state ?? false;
|
settings.val(write: true).devToolsEnabled = state ?? false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(!state!) {
|
||||||
|
changeView();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfirmDialog(
|
||||||
|
title: "Entwicklermodus",
|
||||||
|
content: ""
|
||||||
|
"Die Entwickleransicht bietet erweiterte Funktionen, die für den üblichen Gebrauch nicht benötigt werden.\n\nDie Verwendung der Tools kann darüber hinaus bei falscher Verwendung zu Fehlern führen.\n\n"
|
||||||
|
"Aktivieren auf eigene Verantwortung.",
|
||||||
|
confirmButton: "Ja, ich verstehe das Risiko",
|
||||||
|
cancelButton: "Nein, zurück zur App",
|
||||||
|
onConfirm: () {
|
||||||
|
changeView();
|
||||||
|
},
|
||||||
|
).asDialog(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -10,6 +10,10 @@ class ConfirmDialog extends StatelessWidget {
|
|||||||
final void Function() onConfirm;
|
final void Function() onConfirm;
|
||||||
const ConfirmDialog({Key? key, required this.title, this.content = "", this.icon, this.confirmButton = "Ok", this.cancelButton = "Abbrechen", required this.onConfirm}) : super(key: key);
|
const ConfirmDialog({Key? key, required this.title, this.content = "", this.icon, this.confirmButton = "Ok", this.cancelButton = "Abbrechen", required this.onConfirm}) : super(key: key);
|
||||||
|
|
||||||
|
void asDialog(BuildContext context) {
|
||||||
|
showDialog(context: context, builder: (context) => build(context));
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user