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/jsonViewer.dart';
|
||||
|
||||
class DevToolsSettingsDialog extends StatefulWidget {
|
||||
class DevToolsSettings extends StatefulWidget {
|
||||
final SettingsProvider settings;
|
||||
const DevToolsSettingsDialog({required this.settings, super.key});
|
||||
const DevToolsSettings({required this.settings, super.key});
|
||||
|
||||
@override
|
||||
State<DevToolsSettingsDialog> createState() => _DevToolsSettingsDialogState();
|
||||
State<DevToolsSettings> createState() => _DevToolsSettingsState();
|
||||
}
|
||||
|
||||
class _DevToolsSettingsDialogState extends State<DevToolsSettingsDialog> {
|
||||
class _DevToolsSettingsState extends State<DevToolsSettings> {
|
||||
@override
|
||||
Widget build(BuildContext context) => Column(
|
||||
children: [
|
||||
@ -59,9 +59,9 @@ class _DevToolsSettingsDialogState extends State<DevToolsSettingsDialog> {
|
||||
),
|
||||
ListTile(
|
||||
leading: const CenteredLeading(Icon(Icons.image_outlined)),
|
||||
title: const Text('Cached Thumbnails löschen'),
|
||||
subtitle: Text('etwa ${filesize(PaintingBinding.instance.imageCache.currentSizeBytes)}'),
|
||||
onTap: () {
|
||||
title: const Text('Thumb-storage'),
|
||||
subtitle: Text('etwa ${filesize(PaintingBinding.instance.imageCache.currentSizeBytes)}\nLange tippen um zu löschen'),
|
||||
onLongPress: () {
|
||||
ConfirmDialog(
|
||||
title: 'Thumbs cache löschen',
|
||||
content: 'Alle zwischengespeicherten Bilder werden gelöscht.',
|
||||
@ -69,7 +69,6 @@ class _DevToolsSettingsDialogState extends State<DevToolsSettingsDialog> {
|
||||
onConfirm: () => PaintingBinding.instance.imageCache.clear(),
|
||||
).asDialog(context);
|
||||
},
|
||||
trailing: const Icon(Icons.arrow_right),
|
||||
),
|
||||
ListTile(
|
||||
leading: const CenteredLeading(Icon(Icons.settings_applications_outlined)),
|
||||
@ -80,7 +79,7 @@ class _DevToolsSettingsDialogState extends State<DevToolsSettingsDialog> {
|
||||
},
|
||||
onLongPress: () {
|
||||
ConfirmDialog(
|
||||
title: 'App-Speicher löschen',
|
||||
title: 'Einstellungen löschen',
|
||||
content: 'Alle Einstellungen gehen verloren! Accountdaten sowie App-Daten sind nicht betroffen.',
|
||||
confirmButton: 'Unwiederruflich Löschen',
|
||||
onConfirm: () {
|
||||
@ -112,7 +111,7 @@ class _DevToolsSettingsDialogState extends State<DevToolsSettingsDialog> {
|
||||
),
|
||||
ListTile(
|
||||
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'),
|
||||
onTap: () {
|
||||
// Navigator.push(context, MaterialPageRoute(builder: (context) => const CacheView()));
|
||||
@ -125,7 +124,6 @@ class _DevToolsSettingsDialogState extends State<DevToolsSettingsDialog> {
|
||||
onConfirm: () => HydratedBloc.storage.clear(),
|
||||
).asDialog(context);
|
||||
},
|
||||
trailing: const Icon(Icons.arrow_right),
|
||||
),
|
||||
],
|
||||
);
|
@ -16,7 +16,7 @@ import '../../widget/confirmDialog.dart';
|
||||
import '../../widget/debug/cacheView.dart';
|
||||
import '../pages/timetable/timetableNameMode.dart';
|
||||
import 'defaultSettings.dart';
|
||||
import 'devToolsSettingsDialog.dart';
|
||||
import 'devToolsSettings.dart';
|
||||
import 'privacyInfo.dart';
|
||||
|
||||
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(
|
||||
leading: const CenteredLeading(Icon(Icons.notifications_active_outlined)),
|
||||
title: const Text('Push-Benachrichtigungen aktivieren'),
|
||||
@ -214,6 +186,30 @@ 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!;
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
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(
|
||||
leading: const Icon(Icons.live_help_outlined),
|
||||
title: const Text('Informationen und Lizenzen'),
|
||||
@ -269,15 +265,12 @@ class _SettingsState extends State<Settings> {
|
||||
|
||||
const Divider(),
|
||||
|
||||
Visibility(
|
||||
visible: !kReleaseMode,
|
||||
child: ListTile(
|
||||
ListTile(
|
||||
leading: const CenteredLeading(Icon(Icons.code)),
|
||||
title: const Text('Quellcode MarianumMobile/Client'),
|
||||
subtitle: const Text('GNU GPL v3'),
|
||||
onTap: () => ConfirmDialog.openBrowser(context, 'https://mhsl.eu/gitea/MarianumMobile/Client'),
|
||||
),
|
||||
),
|
||||
|
||||
ListTile(
|
||||
leading: const Icon(Icons.developer_mode_outlined),
|
||||
@ -311,7 +304,7 @@ class _SettingsState extends State<Settings> {
|
||||
|
||||
Visibility(
|
||||
visible: settings.val().devToolsEnabled,
|
||||
child: DevToolsSettingsDialog(settings: settings),
|
||||
child: DevToolsSettings(settings: settings),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -3,7 +3,6 @@ import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'package:filesize/filesize.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:jiffy/jiffy.dart';
|
||||
import 'package:localstore/localstore.dart';
|
||||
|
||||
@ -41,7 +40,7 @@ class _CacheViewState extends State<CacheView> {
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Lokaler cache'),
|
||||
title: const Text('Cache storage'),
|
||||
),
|
||||
body: FutureBuilder(
|
||||
future: files,
|
||||
@ -58,27 +57,7 @@ class _CacheViewState extends State<CacheView> {
|
||||
title: Text(filename),
|
||||
subtitle: Text("${filesize(jsonEncode(element).length * 8)}, ${Jiffy.parseFromMillisecondsSinceEpoch(element['lastupdate']).fromNow()}"),
|
||||
trailing: const Icon(Icons.arrow_right),
|
||||
onTap: () {
|
||||
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();
|
||||
},
|
||||
)
|
||||
],
|
||||
));
|
||||
},
|
||||
onTap: () => JsonViewer.asDialog(context, jsonDecode(element['json'])),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user