From 4a9c766fec47756d20d7af163bb6dd6fcdd20059 Mon Sep 17 00:00:00 2001 From: Gabriel Costa de Oliveira Date: Thu, 12 Dec 2024 13:10:48 -0300 Subject: [PATCH] feat(#60) adiciona view e viewModel para o recoverAccount Co-authored-by: MarinaGaldi --- lib/ui/login/view/LoginView.dart | 2 +- .../recover_account/view/RecoverAccount.dart | 61 +++++++++++++++++-- .../viewModel/recoverAccountViewModel.dart | 13 ++++ 3 files changed, 70 insertions(+), 6 deletions(-) create mode 100644 lib/ui/recover_account/viewModel/recoverAccountViewModel.dart diff --git a/lib/ui/login/view/LoginView.dart b/lib/ui/login/view/LoginView.dart index 8ae71f6..ae86c56 100644 --- a/lib/ui/login/view/LoginView.dart +++ b/lib/ui/login/view/LoginView.dart @@ -154,7 +154,7 @@ class _LoginState extends State<_Login> { onTap: () { Navigator.of(context).push( MaterialPageRoute( - builder: (context) => const RecoverAccount(), + builder: (context) => RecoverAccount(), ), ); }, diff --git a/lib/ui/recover_account/view/RecoverAccount.dart b/lib/ui/recover_account/view/RecoverAccount.dart index d157dc9..6708ffa 100644 --- a/lib/ui/recover_account/view/RecoverAccount.dart +++ b/lib/ui/recover_account/view/RecoverAccount.dart @@ -1,12 +1,63 @@ +import 'package:aranduapp/ui/recover_account/viewModel/recoverAccountViewModel.dart'; +import 'package:aranduapp/ui/shared/TextAndLink.dart'; +import 'package:aranduapp/ui/shared/TextEmail.dart'; +import 'package:aranduapp/ui/shared/TitleSlogan.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; -class RecoverAccount extends StatelessWidget{ - const RecoverAccount({super.key}); - +class RecoverAccount extends StatelessWidget { @override Widget build(BuildContext context) { - // TODO: implement build - throw UnimplementedError(); + return Scaffold( + body: ChangeNotifierProvider( + create: (context) => RecoverAccountViewModel(context), + child: page(context), + )); } + Widget page(BuildContext context) { + RecoverAccountViewModel viewModel = + Provider.of(context); + + return SingleChildScrollView( + child: Center( + child: Column( + children: [ + const SizedBox(height: 80), + const TitleSlogan(), + const Padding( + padding: EdgeInsets.only(top: 70, left: 20, right: 20), + child: Text( + 'Coloque o seu e-mail no campo abaixo e clique em enviar. Logo em seguida, você receberá no seu e-mail as instruções para trocar a sua senha.', + ), + ), + Form( + key: viewModel.formKey, + child: Column(children: [ + TextEmail( + padding: + const EdgeInsets.only(top: 24, left: 20, right: 20), + controller: viewModel.emailController), + ])), + Padding( + padding: const EdgeInsets.only(top: 80), + child: SizedBox( + width: 291, + height: 64, + child: ElevatedButton( + onPressed: () {}, child: const Text('Enviar')), + ), + ), + TextAndLink( + text: 'Já tem uma conta?', + link: ' Click aqui', + action: () { + Navigator.of(context).pop(); + }, + ) + ], + ), + ), + ); + } } diff --git a/lib/ui/recover_account/viewModel/recoverAccountViewModel.dart b/lib/ui/recover_account/viewModel/recoverAccountViewModel.dart new file mode 100644 index 0000000..59952a5 --- /dev/null +++ b/lib/ui/recover_account/viewModel/recoverAccountViewModel.dart @@ -0,0 +1,13 @@ +import 'package:flutter/material.dart'; + +class RecoverAccountViewModel extends ChangeNotifier { + final BuildContext context; + + final formKey; + + final emailController; + + RecoverAccountViewModel(this.context) + : formKey = GlobalKey(), + emailController = TextEditingController(); +}