Added Performance overlays in developer options
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
|
||||
|
||||
import 'package:filesize/filesize.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:jiffy/jiffy.dart';
|
||||
@ -15,7 +14,8 @@ import '../../theming/appTheme.dart';
|
||||
import '../../widget/centeredLeading.dart';
|
||||
import '../../widget/confirmDialog.dart';
|
||||
import '../../widget/debug/cacheView.dart';
|
||||
import '../../widget/debug/jsonViewer.dart';
|
||||
import 'defaultSettings.dart';
|
||||
import 'devToolsSettingsDialog.dart';
|
||||
import 'privacyInfo.dart';
|
||||
|
||||
class Settings extends StatefulWidget {
|
||||
@ -248,11 +248,15 @@ class _SettingsState extends State<Settings> {
|
||||
|
||||
ListTile(
|
||||
leading: const Icon(Icons.developer_mode_outlined),
|
||||
title: const Text("Entwickleransicht"),
|
||||
title: const Text("Entwicklermodus"),
|
||||
trailing: Checkbox(
|
||||
value: settings.val().devToolsEnabled,
|
||||
onChanged: (state) {
|
||||
changeView() => settings.val(write: true).devToolsEnabled = state ?? false;
|
||||
changeView() {
|
||||
var enabled = state ?? false;
|
||||
settings.val(write: true).devToolsEnabled = enabled;
|
||||
if(!enabled) settings.val(write: true).devToolsSettings = DefaultSettings.get().devToolsSettings;
|
||||
}
|
||||
|
||||
if(!state!) {
|
||||
changeView();
|
||||
@ -276,67 +280,7 @@ class _SettingsState extends State<Settings> {
|
||||
|
||||
Visibility(
|
||||
visible: settings.val().devToolsEnabled,
|
||||
child: Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const CenteredLeading(Icon(Icons.image_outlined)),
|
||||
title: const Text("Cached Thumbnails löschen"),
|
||||
subtitle: Text("etwa ${filesize(PaintingBinding.instance.imageCache.currentSizeBytes)}"),
|
||||
onTap: () {
|
||||
ConfirmDialog(
|
||||
title: "Thumbs cache löschen",
|
||||
content: "Alle zwischengespeicherten Bilder werden gelöscht.",
|
||||
confirmButton: "Unwiederruflich löschen",
|
||||
onConfirm: () => PaintingBinding.instance.imageCache.clear(),
|
||||
).asDialog(context);
|
||||
},
|
||||
trailing: const Icon(Icons.arrow_right),
|
||||
),
|
||||
ListTile(
|
||||
leading: const CenteredLeading(Icon(Icons.settings_applications_outlined)),
|
||||
title: const Text("Settings-storage JSON dump"),
|
||||
subtitle: Text("etwa ${filesize(settings.val().toJson().toString().length * 8)}\nLange tippen um zu löschen"),
|
||||
onTap: () {
|
||||
JsonViewer.asDialog(context, settings.val().toJson());
|
||||
},
|
||||
onLongPress: () {
|
||||
ConfirmDialog(
|
||||
title: "App-Speicher löschen",
|
||||
content: "Alle Einstellungen gehen verloren! Accountdaten sowie App-Daten sind nicht betroffen.",
|
||||
confirmButton: "Unwiederruflich Löschen",
|
||||
onConfirm: () {
|
||||
Provider.of<SettingsProvider>(context, listen: false).reset();
|
||||
},
|
||||
).asDialog(context);
|
||||
},
|
||||
trailing: const Icon(Icons.arrow_right),
|
||||
),
|
||||
ListTile(
|
||||
leading: const CenteredLeading(Icon(Icons.data_object)),
|
||||
title: const Text("Cache-storage JSON dump"),
|
||||
subtitle: FutureBuilder(
|
||||
future: const CacheView().totalSize(),
|
||||
builder: (context, snapshot) {
|
||||
return Text("etwa ${snapshot.hasError ? "?" : snapshot.hasData ? filesize(snapshot.data) : "..."}\nLange tippen um zu löschen");
|
||||
},
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) {
|
||||
return const CacheView();
|
||||
}));
|
||||
},
|
||||
onLongPress: () {
|
||||
ConfirmDialog(
|
||||
title: "App-Cache löschen",
|
||||
content: "Alle cache Einträge werden gelöscht. Der Cache wird bei Nutzung der App automatisch erneut aufgebaut",
|
||||
confirmButton: "Unwiederruflich löschen",
|
||||
onConfirm: () => const CacheView().clear().then((value) => setState((){})),
|
||||
).asDialog(context);
|
||||
},
|
||||
trailing: const Icon(Icons.arrow_right),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: DevToolsSettingsDialog(settings: settings),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
Reference in New Issue
Block a user