@@ -8,6 +8,7 @@ A Flutter-first implementation of the [vercel-labs/json-render](https://github.c
88- Flat and model-friendly spec shape (` root + elements ` )
99- Dynamic prop resolution (` $state ` , ` $item ` , ` $index ` , ` $cond ` )
1010- Visibility and repeat support
11+ - Style presets and style-aware prompt generation
1112- JSONL streaming patch compiler for progressive UI updates
1213
1314## Install
@@ -22,6 +23,7 @@ flutter pub add flutter_json_render
2223- ` JsonRegistry ` : maps component type -> Flutter widget builder, action -> handler
2324- ` JsonRenderer ` : renders ` JsonRenderSpec ` safely
2425- ` JsonSpecStreamCompiler ` : compiles streamed JSONL specs/patches
26+ - ` JsonStyleDefinition ` : defines selectable style presets for generation/runtime
2527
2628## Quick Start
2729
@@ -43,6 +45,18 @@ final catalog = JsonCatalog(
4345 ...standardActionDefinitions,
4446 'increment': const JsonActionDefinition(description: 'Increase count'),
4547 },
48+ styles: {
49+ 'clean': const JsonStyleDefinition(
50+ displayName: 'Clean',
51+ description: 'Neutral and productivity-focused',
52+ guidance: 'Use subtle borders and restrained color.',
53+ ),
54+ 'midnight': const JsonStyleDefinition(
55+ displayName: 'Midnight',
56+ description: 'Dark, high-contrast dashboard style',
57+ guidance: 'Use compact spacing and bright accents.',
58+ ),
59+ },
4660);
4761
4862final registry = defineRegistry(
@@ -100,13 +114,28 @@ Widget app() {
100114 return MaterialApp(
101115 home: Scaffold(
102116 body: Center(
103- child: JsonRenderer(spec: spec, registry: registry),
117+ child: JsonRenderer(
118+ spec: spec,
119+ registry: registry,
120+ styleId: 'clean', // runtime-selected style
121+ ),
104122 ),
105123 ),
106124 );
107125}
108126```
109127
128+ Generate style-aware LLM prompts:
129+
130+ ``` dart
131+ final prompt = catalog.prompt(
132+ options: const JsonPromptOptions(
133+ selectedStyleId: 'clean',
134+ includeStyles: true,
135+ ),
136+ );
137+ ```
138+
110139## Stream JSONL Patches
111140
112141``` dart
@@ -184,6 +213,19 @@ Included scenarios:
184213- Async action flow
185214- Streamed JSONL patch simulation
186215
216+ The example includes a ` Style Preset ` dropdown and supports startup style selection:
217+
218+ ``` bash
219+ cd example
220+ flutter run --dart-define=STYLE_PRESET=midnight
221+ ```
222+
223+ ### Style Preset Screenshots
224+
225+ | clean | midnight | sunset |
226+ | ---| ---| ---|
227+ | ![ clean] ( https://raw.githubusercontent.com/Dev-Beom/flutter-json-render/main/assets/screenshots/example-style-clean.png ) | ![ midnight] ( https://raw.githubusercontent.com/Dev-Beom/flutter-json-render/main/assets/screenshots/example-style-midnight.png ) | ![ sunset] ( https://raw.githubusercontent.com/Dev-Beom/flutter-json-render/main/assets/screenshots/example-style-sunset.png ) |
228+
187229## pub.dev Release Checklist
188230
189231``` bash
0 commit comments