22 lines
530 B
Dart
22 lines
530 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class JsonViewer extends StatelessWidget {
|
|
String title;
|
|
String data;
|
|
|
|
JsonViewer({Key? key, required this.title, required this.data}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text(title),
|
|
),
|
|
body: SingleChildScrollView(
|
|
scrollDirection: Axis.vertical,
|
|
child: Text(data.replaceAllMapped(RegExp(r'[{,}]'), (match) => "${match.group(0)}\n ")),
|
|
),
|
|
);
|
|
}
|
|
}
|