Skip to content

Commit f9a2487

Browse files
committed
update index examples
1 parent b89fd21 commit f9a2487

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

resources/views/components/overview-forms.blade.php

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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
4149
Widget 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>

resources/views/components/overview-router.blade.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
router.add(DiscoverPage.path);
88

9-
router.add(LoginPage.path);
9+
router.add(LoginPage.path,
10+
transitionType: TransitionType.bottomToTop());
1011

1112
router.add(ProfilePage.path,
1213
routeGuard: [

0 commit comments

Comments
 (0)