Initial commit
This commit is contained in:
20
lib/screen/settings/about/about.dart
Normal file
20
lib/screen/settings/about/about.dart
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class About extends StatelessWidget {
|
||||
const About({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text("Über diese App"),
|
||||
),
|
||||
body: const Card(
|
||||
elevation: 1,
|
||||
borderOnForeground: true,
|
||||
child: Text("Marianum Fulda"),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
90
lib/screen/settings/settings.dart
Normal file
90
lib/screen/settings/settings.dart
Normal file
@ -0,0 +1,90 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../../data/accountModel.dart';
|
||||
import '../../data/incommingPackets/serverInfoPacket.dart';
|
||||
import '../../widget/ListItem.dart';
|
||||
|
||||
class Settings extends StatefulWidget {
|
||||
const Settings({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<Settings> createState() => _SettingsState();
|
||||
}
|
||||
|
||||
class _SettingsState extends State<Settings> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
ServerInfoPacket().invoke();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text("Einstellungen"),
|
||||
),
|
||||
body: ListView(
|
||||
children: [
|
||||
|
||||
const ListItemNavigator(icon: Icons.info, text: "Über diese App", target: AboutDialog(
|
||||
applicationIcon: Icon(Icons.send_time_extension_outlined),
|
||||
applicationLegalese: "Released under MIT-License",
|
||||
applicationName: "Marianum Fulda",
|
||||
applicationVersion: "ALPHA 0.1",
|
||||
)),
|
||||
|
||||
ListTile(
|
||||
leading: const Icon(Icons.logout),
|
||||
title: const Text("Account abmelden"),
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (builder) => 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);
|
||||
},
|
||||
),
|
||||
],
|
||||
)));
|
||||
},
|
||||
),
|
||||
|
||||
Consumer<ServerInfoPacket>(
|
||||
builder: (context, serverInfo, child) {
|
||||
return ListTile(
|
||||
leading: const Icon(Icons.home_work_outlined),
|
||||
title: Text("Server: ${serverInfo.serverName}"),
|
||||
subtitle: Text(
|
||||
"Betreiber: ${serverInfo.serverOwner}\n"
|
||||
"Serverversion: ${serverInfo.serverVersion}\n"
|
||||
"Rechtliche hinweise: ${serverInfo.legal}\n"
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user