@@ -18,16 +18,24 @@ class RegisterForm extends NyFormData {
1818 // Add your fields here
1919 @override
2020 fields() => [
21- Field.capitalizeWords("Name",
21+ Field.capitalizeWords("name",
22+ label: "Name",
2223 validator: FormValidator.notEmpty(),
2324 ),
24- Field.email("Email",
25+ Field.email("email_address",
26+ label: "Email",
2527 validator: FormValidator.email()
2628 ),
27- Field.password("Password",
29+ Field.password("password",
30+ label: "Password",
2831 validator: FormValidator.password(),
2932 ),
3033 ];
34+
35+ @override
36+ Widget? get submitButton => Button.primary(text: "Submit", submitForm: (this, (data) {
37+ print(["formData", data]);
38+ }));
3139}
3240</x-code-highlighter >
3341
@@ -40,12 +48,19 @@ class RegisterForm extends NyFormData {
4048@override
4149Widget build(BuildContext context) {
4250 return Scaffold(
43- body: NyForm.list(form, children: [
44- Button.primary("Submit", submitForm: (form, (data) {
45- // Handle your form data here
46- printInfo(data);
47- }))
48- ])
51+ body: NyForm(form: form),
52+ );
53+ }
54+
55+ // or like this
56+ AdvertForm form = AdvertForm();
57+
58+ @override
59+ Widget build(BuildContext context) {
60+ return Scaffold(
61+ body: NyForm(form: form, footer: Button.primary(text: "Submit", submitForm: (form, data) {
62+ print(["formData", data]);
63+ })),
4964 );
5065}
5166</x-code-highlighter >
0 commit comments