Refactor codebase using ConfirmDialog whenever possible
This commit is contained in:
@ -7,6 +7,7 @@ import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../model/accountModel.dart';
|
||||
import '../../model/appTheme.dart';
|
||||
import '../../widget/confirmDialog.dart';
|
||||
import 'debug/debugOverview.dart';
|
||||
|
||||
class Settings extends StatefulWidget {
|
||||
@ -41,32 +42,19 @@ class _SettingsState extends State<Settings> {
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: const Text("Abmelden?"),
|
||||
content: const Text("Möchtest du dich wirklich abmelden?"),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text("Abmelden"),
|
||||
onPressed: () {
|
||||
SharedPreferences.getInstance().then((value) => {
|
||||
value.clear(),
|
||||
}).then((value) => {
|
||||
Provider.of<AccountModel>(context, listen: false).logout(),
|
||||
Navigator.popUntil(context, (route) => !Navigator.canPop(context)),
|
||||
});
|
||||
}
|
||||
),
|
||||
|
||||
TextButton(
|
||||
child: const Text("Abbrechen"),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
builder: (context) => ConfirmDialog(
|
||||
title: "Abmelden?",
|
||||
content: "Möchtest du dich wirklich abmelden?",
|
||||
confirmButton: "Abmelden",
|
||||
onConfirm: () {
|
||||
SharedPreferences.getInstance().then((value) => {
|
||||
value.clear(),
|
||||
}).then((value) => {
|
||||
Provider.of<AccountModel>(context, listen: false).logout(),
|
||||
Navigator.popUntil(context, (route) => !Navigator.canPop(context)),
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
Reference in New Issue
Block a user