restructured settings and devtools
This commit is contained in:
parent
70e6f82b10
commit
8868914a76
@ -10,15 +10,15 @@ import '../../widget/confirmDialog.dart';
|
|||||||
import '../../widget/debug/cacheView.dart';
|
import '../../widget/debug/cacheView.dart';
|
||||||
import '../../widget/debug/jsonViewer.dart';
|
import '../../widget/debug/jsonViewer.dart';
|
||||||
|
|
||||||
class DevToolsSettingsDialog extends StatefulWidget {
|
class DevToolsSettings extends StatefulWidget {
|
||||||
final SettingsProvider settings;
|
final SettingsProvider settings;
|
||||||
const DevToolsSettingsDialog({required this.settings, super.key});
|
const DevToolsSettings({required this.settings, super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<DevToolsSettingsDialog> createState() => _DevToolsSettingsDialogState();
|
State<DevToolsSettings> createState() => _DevToolsSettingsState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _DevToolsSettingsDialogState extends State<DevToolsSettingsDialog> {
|
class _DevToolsSettingsState extends State<DevToolsSettings> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => Column(
|
Widget build(BuildContext context) => Column(
|
||||||
children: [
|
children: [
|
||||||
@ -59,9 +59,9 @@ class _DevToolsSettingsDialogState extends State<DevToolsSettingsDialog> {
|
|||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const CenteredLeading(Icon(Icons.image_outlined)),
|
leading: const CenteredLeading(Icon(Icons.image_outlined)),
|
||||||
title: const Text('Cached Thumbnails löschen'),
|
title: const Text('Thumb-storage'),
|
||||||
subtitle: Text('etwa ${filesize(PaintingBinding.instance.imageCache.currentSizeBytes)}'),
|
subtitle: Text('etwa ${filesize(PaintingBinding.instance.imageCache.currentSizeBytes)}\nLange tippen um zu löschen'),
|
||||||
onTap: () {
|
onLongPress: () {
|
||||||
ConfirmDialog(
|
ConfirmDialog(
|
||||||
title: 'Thumbs cache löschen',
|
title: 'Thumbs cache löschen',
|
||||||
content: 'Alle zwischengespeicherten Bilder werden gelöscht.',
|
content: 'Alle zwischengespeicherten Bilder werden gelöscht.',
|
||||||
@ -69,7 +69,6 @@ class _DevToolsSettingsDialogState extends State<DevToolsSettingsDialog> {
|
|||||||
onConfirm: () => PaintingBinding.instance.imageCache.clear(),
|
onConfirm: () => PaintingBinding.instance.imageCache.clear(),
|
||||||
).asDialog(context);
|
).asDialog(context);
|
||||||
},
|
},
|
||||||
trailing: const Icon(Icons.arrow_right),
|
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const CenteredLeading(Icon(Icons.settings_applications_outlined)),
|
leading: const CenteredLeading(Icon(Icons.settings_applications_outlined)),
|
||||||
@ -80,7 +79,7 @@ class _DevToolsSettingsDialogState extends State<DevToolsSettingsDialog> {
|
|||||||
},
|
},
|
||||||
onLongPress: () {
|
onLongPress: () {
|
||||||
ConfirmDialog(
|
ConfirmDialog(
|
||||||
title: 'App-Speicher löschen',
|
title: 'Einstellungen löschen',
|
||||||
content: 'Alle Einstellungen gehen verloren! Accountdaten sowie App-Daten sind nicht betroffen.',
|
content: 'Alle Einstellungen gehen verloren! Accountdaten sowie App-Daten sind nicht betroffen.',
|
||||||
confirmButton: 'Unwiederruflich Löschen',
|
confirmButton: 'Unwiederruflich Löschen',
|
||||||
onConfirm: () {
|
onConfirm: () {
|
||||||
@ -112,7 +111,7 @@ class _DevToolsSettingsDialogState extends State<DevToolsSettingsDialog> {
|
|||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const CenteredLeading(Icon(Icons.data_object)),
|
leading: const CenteredLeading(Icon(Icons.data_object)),
|
||||||
title: const Text('BLOC State cache'),
|
title: const Text('BLOC-storage state cache'),
|
||||||
subtitle: const Text('Lange tippen um zu löschen'),
|
subtitle: const Text('Lange tippen um zu löschen'),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// Navigator.push(context, MaterialPageRoute(builder: (context) => const CacheView()));
|
// Navigator.push(context, MaterialPageRoute(builder: (context) => const CacheView()));
|
||||||
@ -125,7 +124,6 @@ class _DevToolsSettingsDialogState extends State<DevToolsSettingsDialog> {
|
|||||||
onConfirm: () => HydratedBloc.storage.clear(),
|
onConfirm: () => HydratedBloc.storage.clear(),
|
||||||
).asDialog(context);
|
).asDialog(context);
|
||||||
},
|
},
|
||||||
trailing: const Icon(Icons.arrow_right),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
@ -16,7 +16,7 @@ import '../../widget/confirmDialog.dart';
|
|||||||
import '../../widget/debug/cacheView.dart';
|
import '../../widget/debug/cacheView.dart';
|
||||||
import '../pages/timetable/timetableNameMode.dart';
|
import '../pages/timetable/timetableNameMode.dart';
|
||||||
import 'defaultSettings.dart';
|
import 'defaultSettings.dart';
|
||||||
import 'devToolsSettingsDialog.dart';
|
import 'devToolsSettings.dart';
|
||||||
import 'privacyInfo.dart';
|
import 'privacyInfo.dart';
|
||||||
|
|
||||||
class Settings extends StatefulWidget {
|
class Settings extends StatefulWidget {
|
||||||
@ -155,34 +155,6 @@ class _SettingsState extends State<Settings> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
const Divider(),
|
|
||||||
|
|
||||||
ListTile(
|
|
||||||
leading: const Icon(Icons.drive_folder_upload_outlined),
|
|
||||||
title: const Text('Ordner in Dateien nach oben sortieren'),
|
|
||||||
trailing: Checkbox(
|
|
||||||
value: settings.val().fileSettings.sortFoldersToTop,
|
|
||||||
onChanged: (e) {
|
|
||||||
settings.val(write: true).fileSettings.sortFoldersToTop = e!;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
const Divider(),
|
|
||||||
|
|
||||||
ListTile(
|
|
||||||
leading: const Icon(Icons.open_in_new_outlined),
|
|
||||||
title: const Text('Dateien immer mit Systemdialog öffnen'),
|
|
||||||
trailing: Checkbox(
|
|
||||||
value: settings.val().fileViewSettings.alwaysOpenExternally,
|
|
||||||
onChanged: (e) {
|
|
||||||
settings.val(write: true).fileViewSettings.alwaysOpenExternally = e!;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
const Divider(),
|
|
||||||
|
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const CenteredLeading(Icon(Icons.notifications_active_outlined)),
|
leading: const CenteredLeading(Icon(Icons.notifications_active_outlined)),
|
||||||
title: const Text('Push-Benachrichtigungen aktivieren'),
|
title: const Text('Push-Benachrichtigungen aktivieren'),
|
||||||
@ -214,6 +186,30 @@ class _SettingsState extends State<Settings> {
|
|||||||
|
|
||||||
const Divider(),
|
const Divider(),
|
||||||
|
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Icons.drive_folder_upload_outlined),
|
||||||
|
title: const Text('Ordner in Dateien nach oben sortieren'),
|
||||||
|
trailing: Checkbox(
|
||||||
|
value: settings.val().fileSettings.sortFoldersToTop,
|
||||||
|
onChanged: (e) {
|
||||||
|
settings.val(write: true).fileSettings.sortFoldersToTop = e!;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Icons.open_in_new_outlined),
|
||||||
|
title: const Text('Dateien immer mit Systemdialog öffnen'),
|
||||||
|
trailing: Checkbox(
|
||||||
|
value: settings.val().fileViewSettings.alwaysOpenExternally,
|
||||||
|
onChanged: (e) {
|
||||||
|
settings.val(write: true).fileViewSettings.alwaysOpenExternally = e!;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
const Divider(),
|
||||||
|
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.live_help_outlined),
|
leading: const Icon(Icons.live_help_outlined),
|
||||||
title: const Text('Informationen und Lizenzen'),
|
title: const Text('Informationen und Lizenzen'),
|
||||||
@ -269,14 +265,11 @@ class _SettingsState extends State<Settings> {
|
|||||||
|
|
||||||
const Divider(),
|
const Divider(),
|
||||||
|
|
||||||
Visibility(
|
ListTile(
|
||||||
visible: !kReleaseMode,
|
leading: const CenteredLeading(Icon(Icons.code)),
|
||||||
child: ListTile(
|
title: const Text('Quellcode MarianumMobile/Client'),
|
||||||
leading: const CenteredLeading(Icon(Icons.code)),
|
subtitle: const Text('GNU GPL v3'),
|
||||||
title: const Text('Quellcode MarianumMobile/Client'),
|
onTap: () => ConfirmDialog.openBrowser(context, 'https://mhsl.eu/gitea/MarianumMobile/Client'),
|
||||||
subtitle: const Text('GNU GPL v3'),
|
|
||||||
onTap: () => ConfirmDialog.openBrowser(context, 'https://mhsl.eu/gitea/MarianumMobile/Client'),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
ListTile(
|
ListTile(
|
||||||
@ -311,7 +304,7 @@ class _SettingsState extends State<Settings> {
|
|||||||
|
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: settings.val().devToolsEnabled,
|
visible: settings.val().devToolsEnabled,
|
||||||
child: DevToolsSettingsDialog(settings: settings),
|
child: DevToolsSettings(settings: settings),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -3,7 +3,6 @@ import 'dart:async';
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:filesize/filesize.dart';
|
import 'package:filesize/filesize.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:jiffy/jiffy.dart';
|
import 'package:jiffy/jiffy.dart';
|
||||||
import 'package:localstore/localstore.dart';
|
import 'package:localstore/localstore.dart';
|
||||||
|
|
||||||
@ -41,7 +40,7 @@ class _CacheViewState extends State<CacheView> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => Scaffold(
|
Widget build(BuildContext context) => Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('Lokaler cache'),
|
title: const Text('Cache storage'),
|
||||||
),
|
),
|
||||||
body: FutureBuilder(
|
body: FutureBuilder(
|
||||||
future: files,
|
future: files,
|
||||||
@ -58,27 +57,7 @@ class _CacheViewState extends State<CacheView> {
|
|||||||
title: Text(filename),
|
title: Text(filename),
|
||||||
subtitle: Text("${filesize(jsonEncode(element).length * 8)}, ${Jiffy.parseFromMillisecondsSinceEpoch(element['lastupdate']).fromNow()}"),
|
subtitle: Text("${filesize(jsonEncode(element).length * 8)}, ${Jiffy.parseFromMillisecondsSinceEpoch(element['lastupdate']).fromNow()}"),
|
||||||
trailing: const Icon(Icons.arrow_right),
|
trailing: const Icon(Icons.arrow_right),
|
||||||
onTap: () {
|
onTap: () => JsonViewer.asDialog(context, jsonDecode(element['json'])),
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => JsonViewer(title: filename, data: jsonDecode(element['json'])),));
|
|
||||||
},
|
|
||||||
onLongPress: () {
|
|
||||||
showDialog(context: context, builder: (context) => SimpleDialog(
|
|
||||||
children: [
|
|
||||||
const ListTile(
|
|
||||||
leading: Icon(Icons.delete_forever),
|
|
||||||
title: Text('Diese Datei löschen'),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
leading: const Icon(Icons.copy),
|
|
||||||
title: const Text('Dateitext kopieren'),
|
|
||||||
onTap: () {
|
|
||||||
Clipboard.setData(ClipboardData(text: jsonEncode(element)));
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
));
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user