Fix json readability and indention in debugOverview.dart for better debugging

This commit is contained in:
Elias Müller 2023-02-23 22:08:45 +01:00
parent a789f95203
commit 161e933af9

View File

@ -1,4 +1,5 @@
import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:jiffy/jiffy.dart'; import 'package:jiffy/jiffy.dart';
import 'package:localstore/localstore.dart'; import 'package:localstore/localstore.dart';
@ -25,10 +26,6 @@ class _DebugOverviewState extends State<DebugOverview> {
title: const Text("Lokaler cache"), title: const Text("Lokaler cache"),
), ),
body: Column( body: Column(
children: [
Expanded(
flex: 1,
child: ListView(
children: [ children: [
ListTile( ListTile(
leading: const Icon(Icons.delete_forever), leading: const Icon(Icons.delete_forever),
@ -38,10 +35,8 @@ class _DebugOverviewState extends State<DebugOverview> {
Navigator.pop(context) Navigator.pop(context)
}); });
}, },
)
],
),
), ),
const Divider(), const Divider(),
FutureBuilder( FutureBuilder(
future: files, future: files,
@ -62,11 +57,11 @@ class _DebugOverviewState extends State<DebugOverview> {
return ListTile( return ListTile(
leading: const Icon(Icons.text_snippet_outlined), leading: const Icon(Icons.text_snippet_outlined),
title: Text("(${getValue(index).toString().length} z) [$filename] ${Jiffy.unixFromMillisecondsSinceEpoch(getValue(index)['lastupdate']).fromNow()}"), title: Text("[$filename]\n(${getValue(index).toString().length} zeichen) ${Jiffy.unixFromMillisecondsSinceEpoch(getValue(index)['lastupdate']).fromNow()}"),
textColor: Colors.black, textColor: Colors.black,
onTap: () { onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (context) { Navigator.push(context, MaterialPageRoute(builder: (context) {
return JsonViewer(title: filename, data: getValue(index)); return JsonViewer(title: filename, data: {"lastupdate": getValue(index)['lastupdate'], "json": jsonDecode(getValue(index)['json'])});
},)); },));
}, },
); );