Skip to content

Commit 3a84954

Browse files
committed
feat(wip): enhance list and nested structure binding
1 parent 7d1bd28 commit 3a84954

File tree

11 files changed

+294
-237
lines changed

11 files changed

+294
-237
lines changed

packages/dogs_flutter/example/lib/dogs.g.dart

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/dogs_flutter/example/lib/main.dart

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:dogs_core/dogs_schema.dart' as z;
2+
import 'package:dogs_flutter/databinding/material/list.dart';
23
import 'package:dogs_flutter/dogs_flutter.dart';
34
import 'package:example/dogs.g.dart';
45
import 'package:flutter/material.dart';
@@ -46,30 +47,36 @@ class _TestFormState extends State<TestForm> {
4647
// // ),
4748
// );
4849

49-
final mainSchema = dogs.materialize(
50-
z.object({
51-
"name": z.string(),
52-
"surname": z.string(),
53-
"age": z.integer(),
54-
"subschema": z.object({
55-
"subfield1": z.string(),
56-
"subfield2": z.integer(),
57-
}),
58-
"enum": z.enumeration(["option1", "option2", "option3"]),
59-
}),
60-
);
50+
final mainSchema = z.object({
51+
"name": z.string(),
52+
"surname": z.string(),
53+
"age": z.integer(),
54+
"subschema": z.object({"subfield1": z.string(), "subfield2": z.integer()}).serialName("SubSchema").formHelper("Helper").formLabel("My Label"),
55+
"list": z.array(
56+
z.integer(),
57+
).formLabel("My List").formHelper("Hello World!").itemLabel("Item").addButtonLabel("Add Item").optional(),
6158

62-
late final controller = StructureBindingController.schema(
63-
schema: mainSchema.originalSchema,
64-
);
59+
"complexList": z.array(
60+
z.object({
61+
"field1": z.string(),
62+
"field2": z.integer(),
63+
})
64+
).itemLabel("Complex Item"),
65+
66+
"enum": z.enumeration(["option1", "option2", "option3"]),
67+
});
68+
69+
late final controller = StructureBindingController.schema(schema: mainSchema);
6570

6671
@override
6772
Widget build(BuildContext context) {
6873
return Scaffold(
6974
body: Theme(
7075
data: Theme.of(
7176
context,
72-
).copyWith(inputDecorationTheme: InputDecorationTheme()),
77+
).copyWith(inputDecorationTheme: InputDecorationTheme(
78+
// border: OutlineInputBorder(),
79+
)),
7380
child: Center(
7481
child: SizedBox(
7582
width: 600,

packages/dogs_flutter/example/lib/models.conv.g.dart

Lines changed: 33 additions & 145 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)