From c1de7a2cde137abf124c769e898af3ec76b0f041 Mon Sep 17 00:00:00 2001 From: R1K4S Date: Fri, 20 Dec 2024 15:19:07 -0300 Subject: [PATCH] fix(#59) Tela Profile + Tela EditProfile Atualizadas --- android/settings.gradle | 2 +- lib/ui/edit_profile/view/EditProfileView.dart | 56 +++++-------------- lib/ui/profile/view/ProfileView.dart | 41 +++++++++++--- lib/ui/shared/ProfileHeader.dart | 23 -------- 4 files changed, 48 insertions(+), 74 deletions(-) diff --git a/android/settings.gradle b/android/settings.gradle index b9e43bd..5c58366 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -18,7 +18,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.1.0" apply false + id "com.android.application" version "8.3.2" apply false id "org.jetbrains.kotlin.android" version "1.8.22" apply false } diff --git a/lib/ui/edit_profile/view/EditProfileView.dart b/lib/ui/edit_profile/view/EditProfileView.dart index 65bb522..2686ff8 100644 --- a/lib/ui/edit_profile/view/EditProfileView.dart +++ b/lib/ui/edit_profile/view/EditProfileView.dart @@ -1,5 +1,7 @@ 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'; import 'package:aranduapp/ui/shared/TextPassword.dart'; import 'package:flutter/material.dart'; @@ -51,7 +53,9 @@ class _EditProfileScreenState extends State { leading: IconButton( color: Theme.of(context).colorScheme.primary, icon: Icon(Icons.arrow_back), - onPressed: () {}, + onPressed: () { + Navigator.of(context).pop(); + }, ), ), body: LayoutBuilder( @@ -61,13 +65,8 @@ class _EditProfileScreenState extends State { child: SingleChildScrollView( padding: const EdgeInsets.all(16.0), child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, children: [ - Padding( - padding: const EdgeInsets.only(top: 6.0), // Move para cima - child: _icon(context), - ), + _buildProfileHeader(context), SizedBox(height: isSmallScreen ? 30 : 50), _buildForm(viewModel, isSmallScreen), ], @@ -117,6 +116,15 @@ class _EditProfileScreenState extends State { ); } + Widget _buildProfileHeader(BuildContext context) { + return Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + ProfileHeader( + name: "Stefani", + role: "Estudante", + ), + ]); + } + Widget _saveButton(EditProfileViewModel viewModel) { return ElevatedButton( onPressed: () async { @@ -153,40 +161,6 @@ class _EditProfileScreenState extends State { ); } - Widget _icon(BuildContext context) { - return Padding( - padding: const EdgeInsets.only(left: 16.0), - child: Row( - children: [ - CircleAvatar( - radius: 30, - backgroundColor: Theme.of(context).colorScheme.onSurface, - ), - SizedBox(width: 16), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "NOME", - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - Text( - "Estudante", - style: TextStyle( - fontSize: 14, - color: Theme.of(context).colorScheme.onSurface, - ), - ), - ], - ), - ], - ), - ); - } - void _showDeleteConfirmationDialog(BuildContext context) { showDialog( context: context, diff --git a/lib/ui/profile/view/ProfileView.dart b/lib/ui/profile/view/ProfileView.dart index b14450c..1600aab 100644 --- a/lib/ui/profile/view/ProfileView.dart +++ b/lib/ui/profile/view/ProfileView.dart @@ -76,15 +76,38 @@ class Profile extends StatelessWidget { /// Cabeçalho do Perfil Widget _buildProfileHeader(BuildContext context) { - return ProfileHeader( - name: "Stefani", - role: "Estudante", - onEditPressed: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => const EditProfile()), - ); - }, + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + ProfileHeader( + name: "Stefani", + role: "Estudante", + ), + Padding( + padding: const EdgeInsets.only(right: 16.0), // Margem direita + child: ElevatedButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => const EditProfile()), + ); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Theme.of(context).colorScheme.primary, + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), + elevation: 2, + ), + child: Text( + "Editar", + style: TextStyle( + fontSize: 16, + color: Theme.of(context).colorScheme.onPrimary, + fontWeight: FontWeight.w400, + ), + ), + ), + ), + ], ); } diff --git a/lib/ui/shared/ProfileHeader.dart b/lib/ui/shared/ProfileHeader.dart index d68391a..c5067c1 100644 --- a/lib/ui/shared/ProfileHeader.dart +++ b/lib/ui/shared/ProfileHeader.dart @@ -3,13 +3,11 @@ import 'package:flutter/material.dart'; class ProfileHeader extends StatelessWidget { final String name; final String role; - final VoidCallback? onEditPressed; const ProfileHeader({ Key? key, required this.name, required this.role, - this.onEditPressed, // Botão pode não ter ação inicialmente }) : super(key: key); @override @@ -58,27 +56,6 @@ class ProfileHeader extends StatelessWidget { ), ], ), - // Botão Editar - ElevatedButton( - onPressed: onEditPressed ?? () {}, // Não faz nada se nulo - style: ElevatedButton.styleFrom( - backgroundColor: - Theme.of(context).colorScheme.primary, // Cor do botão - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), - elevation: 2, - ), - child: Text( - "Editar", - style: TextStyle( - fontSize: 16, - color: Theme.of(context).colorScheme.onPrimary, - fontWeight: FontWeight.w400, - ), - ), - ), ], ), );