dart format

This commit is contained in:
2026-05-08 20:12:40 +02:00
parent 9e139b5704
commit 3b8da1d3d6
295 changed files with 6404 additions and 4161 deletions
+30 -15
View File
@@ -12,35 +12,50 @@ class JsonViewer extends StatelessWidget {
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: Text(title),
),
body: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Text(format(data)),
),
);
appBar: AppBar(title: Text(title)),
body: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Text(format(data)),
),
);
static final _encoder = const JsonEncoder.withIndent(' ');
static String format(Map<String, dynamic> jsonInput) => _encoder.convert(jsonInput);
static String format(Map<String, dynamic> jsonInput) =>
_encoder.convert(jsonInput);
static void asDialog(BuildContext context, Map<String, dynamic> dataMap) {
showDialog(context: context, builder: (dialogCtx) => AlertDialog(
showDialog(
context: context,
builder: (dialogCtx) => AlertDialog(
scrollable: true,
title: const Row(children: [Icon(Icons.bug_report_outlined), Text('Rohdaten')]),
title: const Row(
children: [Icon(Icons.bug_report_outlined), Text('Rohdaten')],
),
content: Text(JsonViewer.format(dataMap)),
actions: [
TextButton(
onPressed: () => copyToClipboard(dialogCtx, JsonViewer.format(dataMap), successMessage: 'Formatiertes JSON kopiert'),
onPressed: () => copyToClipboard(
dialogCtx,
JsonViewer.format(dataMap),
successMessage: 'Formatiertes JSON kopiert',
),
child: const Text('Kopieren'),
),
TextButton(
onPressed: () => copyToClipboard(dialogCtx, dataMap.toString(), successMessage: 'Inline JSON kopiert'),
onPressed: () => copyToClipboard(
dialogCtx,
dataMap.toString(),
successMessage: 'Inline JSON kopiert',
),
child: const Text('Inline Kopieren'),
),
TextButton(onPressed: () => Navigator.of(dialogCtx).pop(), child: const Text('Schließen'))
TextButton(
onPressed: () => Navigator.of(dialogCtx).pop(),
child: const Text('Schließen'),
),
],
));
),
);
}
}