Skip to content

Commit

Permalink
chore: update router example app
Browse files Browse the repository at this point in the history
  • Loading branch information
ferrarafer committed Aug 1, 2023
1 parent ee23558 commit af5d5e5
Show file tree
Hide file tree
Showing 7 changed files with 173 additions and 101 deletions.
1 change: 0 additions & 1 deletion example/router_example/lib/app/app.locator.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 31 additions & 30 deletions example/router_example/lib/app/app.router.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 14 additions & 12 deletions example/router_example/lib/ui/form/example_form_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ import 'example_form_viewmodel.dart';
validator: FormValidators.emailValidator,
),
FormTextField(
name: 'password',
validator: FormValidators.passwordValidator,
customTextEditingController:
CustomEditingController.getCustomEditingController),
FormTextField(name: 'shortBio'),
name: 'password',
validator: FormValidators.passwordValidator,
customTextEditingController:
CustomEditingController.getCustomEditingController,
),
FormTextField(
name: 'shortBio',
customTextEditingController:
CustomEditingController.getCustomEditingController,
),
FormDateField(name: 'birthDate'),
FormDropdownField(
name: 'doYouLoveFood',
Expand Down Expand Up @@ -50,20 +55,17 @@ class ExampleFormView extends StatelessWidget with $ExampleFormView {
onViewModelReady: (viewModel) {
// #3: Listen to text updates by calling listenToFormUpdated(model);
syncFormWithViewModel(viewModel);
DoYouLoveFoodValueToTitleMap.addAll({'MaybeDr': 'Maybe'});
viewModel.setDoYouLoveFood(DoYouLoveFoodValueToTitleMap.keys.first);
viewModel.populateForm();
},
onDispose: (model) => disposeForm(),
builder: (context, viewModel, child) => Scaffold(
appBar: AppBar(
title: const Text('Example Form View'),
centerTitle: true,
),
floatingActionButton: FloatingActionButton(onPressed: () {
if (validateFormFields(viewModel)) {
viewModel.navigateToNewView();
}
}),
floatingActionButton: FloatingActionButton(
onPressed: viewModel.saveData,
),
body: SingleChildScrollView(
child: SizedBox(
width: MediaQuery.of(context).size.width,
Expand Down
Loading

0 comments on commit af5d5e5

Please sign in to comment.