mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-27 19:04:25 +01:00
This commit introduces the JsonCodeSnippetView, a widget designed to display JSON data in a pretty-printed format. Users can view the JSON content with proper indentation and formatting, enhancing readability. Features: - The JSON data is displayed using the HighlightView with GitHub-themed syntax highlighting. - A copy button (IconButton) is provided to allow users to easily copy the pretty-printed JSON to the clipboard. - Padding and layout adjustments ensure that the view fits seamlessly within the designated space, with scrollable content if the JSON exceeds the available space. This widget enhances the user experience when interacting with JSON data, providing a clean and efficient way to view and copy content.
15 lines
503 B
Dart
15 lines
503 B
Dart
import 'package:auto_gpt_flutter_client/views/chat/json_code_snippet_view.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
const jsonString = '{"key": "value"}';
|
|
|
|
testWidgets('Renders JsonCodeSnippetView without crashing',
|
|
(WidgetTester tester) async {
|
|
await tester.pumpWidget(
|
|
const MaterialApp(home: JsonCodeSnippetView(jsonString: jsonString)));
|
|
expect(find.byType(JsonCodeSnippetView), findsOneWidget);
|
|
});
|
|
}
|