diff --git a/lib/ui/edit_profile/view/EditProfileView.dart b/lib/ui/edit_profile/view/EditProfileView.dart index 2686ff8..9bae7af 100644 --- a/lib/ui/edit_profile/view/EditProfileView.dart +++ b/lib/ui/edit_profile/view/EditProfileView.dart @@ -1,5 +1,4 @@ import 'package:aranduapp/ui/edit_profile/viewModel/EditProfileViewModel.dart'; -import 'package:aranduapp/ui/profile/view/ProfileView.dart'; import 'package:aranduapp/ui/shared/TextEmail.dart'; import 'package:aranduapp/ui/shared/ProfileHeader.dart'; import 'package:aranduapp/ui/shared/TextName.dart'; @@ -19,14 +18,9 @@ class EditProfile extends StatelessWidget { } } -class EditProfileScreen extends StatefulWidget { - const EditProfileScreen({Key? key}) : super(key: key); +class EditProfileScreen extends StatelessWidget { + const EditProfileScreen({super.key}); - @override - State createState() => _EditProfileScreenState(); -} - -class _EditProfileScreenState extends State { @override Widget build(BuildContext context) { final viewModel = Provider.of(context); @@ -46,13 +40,13 @@ class _EditProfileScreenState extends State { actions: [ IconButton( color: Theme.of(context).colorScheme.primary, - icon: Icon(Icons.notifications), + icon: const Icon(Icons.notifications), onPressed: () {}, ), ], leading: IconButton( color: Theme.of(context).colorScheme.primary, - icon: Icon(Icons.arrow_back), + icon: const Icon(Icons.arrow_back), onPressed: () { Navigator.of(context).pop(); }, @@ -61,16 +55,14 @@ class _EditProfileScreenState extends State { body: LayoutBuilder( builder: (context, constraints) { final isSmallScreen = constraints.maxWidth < 600; - return Center( - child: SingleChildScrollView( - padding: const EdgeInsets.all(16.0), - child: Column( - children: [ - _buildProfileHeader(context), - SizedBox(height: isSmallScreen ? 30 : 50), - _buildForm(viewModel, isSmallScreen), - ], - ), + return SingleChildScrollView( + padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 20), + child: Column( + children: [ + _buildProfileHeader(context), + SizedBox(height: isSmallScreen ? 30 : 50), + _buildForm(context, viewModel, isSmallScreen), + ], ), ); }, @@ -78,7 +70,8 @@ class _EditProfileScreenState extends State { ); } - Widget _buildForm(EditProfileViewModel viewModel, bool isSmallScreen) { + Widget _buildForm(BuildContext context, EditProfileViewModel viewModel, + bool isSmallScreen) { return Form( key: viewModel.formKey, child: Column( @@ -86,16 +79,16 @@ class _EditProfileScreenState extends State { children: [ TextName( controller: viewModel.firstNameController, - padding: const EdgeInsets.symmetric(vertical: 16), + padding: const EdgeInsets.symmetric(vertical: 0), ), - SizedBox(height: 20), + const SizedBox(height: 20), TextEmail( - padding: const EdgeInsets.symmetric(vertical: 16), + padding: const EdgeInsets.symmetric(vertical: 0), controller: viewModel.emailController, ), - SizedBox(height: 20), + const SizedBox(height: 20), TextPassWord( - padding: const EdgeInsets.symmetric(vertical: 16), + padding: const EdgeInsets.symmetric(vertical: 0), controller: viewModel.passwordController, ), SizedBox(height: isSmallScreen ? 100 : 56), @@ -103,7 +96,7 @@ class _EditProfileScreenState extends State { mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Expanded( - child: _saveButton(viewModel), + child: _saveButton(context, viewModel), ), SizedBox(width: isSmallScreen ? 10 : 20), Expanded( @@ -117,15 +110,17 @@ class _EditProfileScreenState extends State { } Widget _buildProfileHeader(BuildContext context) { - return Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - ProfileHeader( - name: "Stefani", - role: "Estudante", - ), - ]); + return const Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + ProfileHeader( + name: "Stefani", + role: "Estudante", + ), + ]); } - Widget _saveButton(EditProfileViewModel viewModel) { + Widget _saveButton(BuildContext context, EditProfileViewModel viewModel) { return ElevatedButton( onPressed: () async { if (viewModel.isLoading) return; diff --git a/lib/ui/profile/view/ProfileView.dart b/lib/ui/profile/view/ProfileView.dart index 1600aab..236c69b 100644 --- a/lib/ui/profile/view/ProfileView.dart +++ b/lib/ui/profile/view/ProfileView.dart @@ -1,12 +1,8 @@ -// MVVM -import 'package:aranduapp/ui/profile/viewModel/ProfileViewModel.dart'; -// Componentes -import 'package:aranduapp/ui/shared/ProfileHeader.dart'; -//import 'package:aranduapp/ui/shared/ProfileSection.dart'; -// Bibliotecas -import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -// Paginas +import 'package:flutter/material.dart'; + +import 'package:aranduapp/ui/shared/ProfileHeader.dart'; +import 'package:aranduapp/ui/profile/viewModel/ProfileViewModel.dart'; import 'package:aranduapp/ui/edit_profile/view/EditProfileView.dart'; class Profile extends StatelessWidget { @@ -57,19 +53,15 @@ class Profile extends StatelessWidget { /// Página principal Widget _buildPage(BuildContext context) { return SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildProfileHeader(context), - const SizedBox(height: 80), - _buildLogoutButton( - context, - () { - // Lógica de logout - print('Usuário deslogado!'); - }, - ), - ], + child: Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + _buildProfileHeader(context), + const SizedBox(height: 80), + _buildLogoutButton(context), + ], + ), ), ); } @@ -99,11 +91,9 @@ class Profile extends StatelessWidget { ), child: Text( "Editar", - style: TextStyle( - fontSize: 16, - color: Theme.of(context).colorScheme.onPrimary, - fontWeight: FontWeight.w400, - ), + style: Theme.of(context).textTheme.bodySmall!.apply( + color: Theme.of(context).colorScheme.onPrimary, + ), ), ), ), @@ -112,30 +102,13 @@ class Profile extends StatelessWidget { } /// Botão Deslogar - Widget _buildLogoutButton(BuildContext context, VoidCallback onPressed) { - final colorScheme = Theme.of(context).colorScheme; - - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), - child: SizedBox( - width: double.infinity, - child: ElevatedButton( - onPressed: onPressed, - style: ElevatedButton.styleFrom( - backgroundColor: colorScheme.error, - foregroundColor: colorScheme.onError, - padding: const EdgeInsets.symmetric(vertical: 16), - textStyle: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), // Bordas arredondadas - ), - elevation: 6, - ), - child: const Text('Deslogar'), - ), + Widget _buildLogoutButton(BuildContext context) { + return SizedBox( + width: 291, + height: 64, + child: ElevatedButton( + onPressed: () => {}, + child: const Text('Deslogar'), ), ); }