-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementa register #34
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
30268c4
feat(#59) Corrigindo view da register account
isabellachoukaira 37c5426
feat(#59)Removendo codigo não utilizado da register account
isabellachoukaira cf7d500
fix#59: cria controllerpassword e rota
isabellachoukaira 554b0e5
Merge branch 'dev' into implementa_Register
isabellachoukaira e7bd038
feat(#59) modifica onboarding, registro, cria rota
isabellachoukaira 73ca7c9
feat(#59) modifiva lorem onboarding
isabellachoukaira File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,205 @@ | ||
import 'package:aranduapp/ui/login/view/LoginView.dart'; | ||
import 'package:aranduapp/ui/shared/TextName.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:provider/provider.dart'; | ||
import 'package:aranduapp/core/log/Log.dart'; | ||
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; | ||
|
||
class RegisterAccount extends StatelessWidget{ | ||
import 'package:aranduapp/ui/register_account/viewModel/RegisterViewModel.dart'; | ||
|
||
import 'package:aranduapp/ui/shared/TitleSlogan.dart'; | ||
import 'package:aranduapp/ui/shared/TextEmail.dart'; | ||
import 'package:aranduapp/ui/shared/ErrorPopUp.dart'; | ||
import 'package:aranduapp/ui/shared/TextPassword.dart'; | ||
|
||
|
||
class RegisterAccount extends StatelessWidget { | ||
const RegisterAccount({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
// TODO: implement build | ||
throw UnimplementedError(); | ||
return ChangeNotifierProvider( | ||
create: (context) => RegisterAccountViewModel(), | ||
child: const _RegisterAccount(), | ||
); | ||
} | ||
} | ||
|
||
class _RegisterAccount extends StatefulWidget { | ||
const _RegisterAccount({Key? key}) : super(key: key); | ||
|
||
@override | ||
State<StatefulWidget> createState() { | ||
return _RegisterAccountState(); | ||
} | ||
} | ||
|
||
class _RegisterAccountState extends State<_RegisterAccount> { | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
RegisterAccountViewModel viewModel = Provider.of<RegisterAccountViewModel>(context); | ||
|
||
return Scaffold( | ||
body: Column( | ||
children: [ | ||
// Cabeçalho com padrão de losangos | ||
_buildHeader(viewModel), | ||
// Corpo do formulário | ||
_buildForm(viewModel), | ||
], | ||
), | ||
); | ||
} | ||
|
||
Widget _buildHeader(RegisterAccountViewModel viewModel) { | ||
return const Stack( | ||
children: [ | ||
Expanded( | ||
child: Center( | ||
child: Padding( | ||
padding: EdgeInsets.only(top: 25.0), | ||
child: TitleSlogan(), | ||
), | ||
), | ||
), | ||
], | ||
); | ||
} | ||
|
||
|
||
Widget _buildForm(RegisterAccountViewModel viewModel) { | ||
return Expanded( | ||
child: Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 16.0), | ||
child: SingleChildScrollView( | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.center, | ||
children: [ | ||
const SizedBox(height: 10), | ||
const Text( | ||
'Olá,\nCrie uma conta', | ||
textAlign: TextAlign.center, | ||
style: TextStyle( | ||
fontSize: 20, | ||
fontWeight: FontWeight.bold, | ||
), | ||
), | ||
const SizedBox(height: 30), | ||
TextName(controller: viewModel.firstNameController, padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 0)), | ||
TextEmail(padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 0), controller: viewModel.emailController), | ||
TextPassWord(padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 0), controller: viewModel.passwordController), | ||
TextPassWord(padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 0), controller: viewModel.confPasswordController), | ||
const SizedBox(height: 10), | ||
_buildTermsCheckbox(context), | ||
const SizedBox(height: 20), | ||
_buildRegisterButton(context, viewModel), | ||
const SizedBox(height: 20), | ||
_buildDividerWithText(), | ||
const SizedBox(height: 20), | ||
_buildGoogleLoginButton(), | ||
const SizedBox(height: 20), | ||
_buildLoginRedirectButton(context), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
|
||
Widget _buildTermsCheckbox(BuildContext context) { | ||
final viewModel = Provider.of<RegisterAccountViewModel>(context); | ||
return Row( | ||
children: [ | ||
Checkbox( | ||
value: viewModel.isTermsAccepted, | ||
onChanged: (value) { | ||
// Ação ao clicar no checkbox | ||
if (value != null) { | ||
viewModel.toggleTermsAccepted(value); | ||
} | ||
}, | ||
), | ||
const Expanded( | ||
child: Text( | ||
'Para continuar, aceite os termos de privacidade e políticas de uso', | ||
style: TextStyle(fontSize: 12), | ||
), | ||
), | ||
], | ||
); | ||
} | ||
|
||
Widget _buildRegisterButton(BuildContext context, RegisterAccountViewModel viewModel) { | ||
return SizedBox( | ||
width: 291, | ||
height: 64, | ||
child: ElevatedButton( | ||
onPressed: () { | ||
viewModel | ||
.register() | ||
.catchError((e) => showDialog<Object>( | ||
context: context, | ||
builder: (BuildContext context) => | ||
ErrorPopUp(content: Text('$e')), | ||
)); | ||
// Ação ao clicar no botão de cadastro | ||
}, | ||
child: Consumer<RegisterAccountViewModel>( | ||
builder: (context, value, child) => value.isLoading | ||
? const CircularProgressIndicator(value: null) | ||
: const Text('Registrar'), | ||
)), | ||
); | ||
} | ||
|
||
Widget _buildDividerWithText() { | ||
return const Row( | ||
children: [ | ||
Expanded(child: Divider()), | ||
Padding( | ||
padding: EdgeInsets.symmetric(horizontal: 8.0), | ||
child: Text('ou'), | ||
), | ||
Expanded(child: Divider()), | ||
], | ||
); | ||
} | ||
|
||
Widget _buildGoogleLoginButton() { | ||
return GestureDetector( | ||
onTap: () => Log.d(""), | ||
child: Container( | ||
width: 50, | ||
height: 50, | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.circular(10), | ||
border: Border.all(color: Theme.of(context).colorScheme.outline), | ||
color: Colors.transparent, | ||
), | ||
child: Icon( | ||
FontAwesomeIcons.google, | ||
size: 20, | ||
color: Theme.of(context).colorScheme.primary, | ||
), | ||
), | ||
); | ||
} | ||
|
||
|
||
Widget _buildLoginRedirectButton(BuildContext context) { | ||
return TextButton( | ||
onPressed: () { | ||
// Navegar para a tela de login | ||
Navigator.of(context).push( | ||
MaterialPageRoute( | ||
builder: (context) => const Login(), | ||
), | ||
); | ||
}, | ||
child: const Text( | ||
'Já tem uma conta? faça login', | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remova esse lorem