Closed chems17 closed 2 months ago
Same issue here is the bear minimum code
import 'dart:convert';
import 'package:json_dynamic_widget/json_dynamic_widget.dart';
void main() {
runApp(const MyApp());
}
const jsonString = '''
{
"type": "scaffold",
"args": {
"appBar": {
"type": "app_bar",
"args": {
"title": {
"type": "text",
"args": {
"text": "Placeholder"
}
}
}
},
"body": {
"type": "intrinsic_width",
"args": {
"child": {
"type": "column",
"args": {
"crossAxisAlignment": "stretch",
"children": [
{
"type": "elevated_button",
"args": {
"onPressed": "",
"child": {
"type": "text",
"args": {
"text": "Short"
}
}
}
},
{
"type": "placeholder",
"args": {
"fallbackHeight": 100
}
},
{
"type": "elevated_button",
"args": {
"onPressed": "",
"child": {
"type": "text",
"args": {
"text": "The Longest text button"
}
}
}
}
]
}
}
}
}
}
''';
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const JsonWidgetExample(),
);
}
}
class JsonWidgetExample extends StatelessWidget {
const JsonWidgetExample({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('JSON Dynamic Widget Example'),
),
body: JsonWidgetData.fromDynamic(
jsonDecode(jsonString),
registry: JsonWidgetRegistry.instance,
).build(context: context),
),
);
}
}
The error Code
AppData/Local/Pub/Cache/hosted/pub.dev/json_theme-6.5.0+1/lib/src/codec/theme_encoder.dart:249:15: Error: The type 'AutovalidateMode' is not exhaustively matched by the switch cases since it doesn't match 'AutovalidateMode.onUnfocus'.
- 'AutovalidateMode' is from 'package:flutter/src/widgets/form.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/form.dart').
Try adding a default case or cases that match 'AutovalidateMode.onUnfocus'.
switch (value) {
^
Failed to compile application.
This is resolved as of tonight. Thanks for the report.
sdk: ">=3.5.0 <4.0.0" flutter: ">=3.24.0"
../../../../.pub-cache/hosted/pub.flutter-io.cn/json_theme-6.5.0+1/lib/src/codec/theme_encoder.dart:249:15: Error: The type 'AutovalidateMode' is not exhaustively matched by the switch cases since it doesn't match 'AutovalidateMode.onUnfocus'.