refactored HTTP error handling and streamlined UI components by centralizing shared logic and removing redundant parameters
This commit is contained in:
@@ -33,7 +33,6 @@ class CacheView extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _CacheViewState extends State<CacheView> {
|
||||
final Localstore storage = Localstore.instance;
|
||||
late Future<Map<String, dynamic>?> files;
|
||||
|
||||
@override
|
||||
|
||||
@@ -15,8 +15,7 @@ class DebugTile {
|
||||
context.read<SettingsCubit>().val().devToolsEnabled &&
|
||||
(onlyInDebug ? kDebugMode : true);
|
||||
|
||||
Widget jsonData(Map<String, dynamic> data, {bool ignoreConfig = false}) =>
|
||||
callback(
|
||||
Widget jsonData(Map<String, dynamic> data) => callback(
|
||||
title: 'JSON daten anzeigen',
|
||||
onTab: () => JsonViewer.asDialog(context, data),
|
||||
);
|
||||
|
||||
@@ -4,21 +4,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import '../../utils/clipboard_helper.dart';
|
||||
|
||||
class JsonViewer extends StatelessWidget {
|
||||
final String title;
|
||||
final Map<String, dynamic> data;
|
||||
|
||||
const JsonViewer({super.key, required this.title, required this.data});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
appBar: AppBar(title: Text(title)),
|
||||
body: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
child: Text(format(data)),
|
||||
),
|
||||
);
|
||||
|
||||
class JsonViewer {
|
||||
static final _encoder = const JsonEncoder.withIndent(' ');
|
||||
|
||||
static String format(Map<String, dynamic> jsonInput) =>
|
||||
|
||||
Reference in New Issue
Block a user