|
1 | 1 | import 'package:dogs_core/dogs_schema.dart' as z; |
| 2 | +import 'package:dogs_flutter/databinding/material/list.dart'; |
2 | 3 | import 'package:dogs_flutter/dogs_flutter.dart'; |
3 | 4 | import 'package:example/dogs.g.dart'; |
4 | 5 | import 'package:flutter/material.dart'; |
@@ -46,30 +47,36 @@ class _TestFormState extends State<TestForm> { |
46 | 47 | // // ), |
47 | 48 | // ); |
48 | 49 |
|
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(), |
61 | 58 |
|
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); |
65 | 70 |
|
66 | 71 | @override |
67 | 72 | Widget build(BuildContext context) { |
68 | 73 | return Scaffold( |
69 | 74 | body: Theme( |
70 | 75 | data: Theme.of( |
71 | 76 | context, |
72 | | - ).copyWith(inputDecorationTheme: InputDecorationTheme()), |
| 77 | + ).copyWith(inputDecorationTheme: InputDecorationTheme( |
| 78 | + // border: OutlineInputBorder(), |
| 79 | + )), |
73 | 80 | child: Center( |
74 | 81 | child: SizedBox( |
75 | 82 | width: 600, |
|
0 commit comments