Skip to content

Commit

Permalink
fix(#59) Tela Profile + Tela EditProfile Atualizadas
Browse files Browse the repository at this point in the history
  • Loading branch information
R1K4S committed Dec 20, 2024
1 parent ee57555 commit c1de7a2
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 74 deletions.
2 changes: 1 addition & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
56 changes: 15 additions & 41 deletions lib/ui/edit_profile/view/EditProfileView.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -51,7 +53,9 @@ class _EditProfileScreenState extends State<EditProfileScreen> {
leading: IconButton(
color: Theme.of(context).colorScheme.primary,
icon: Icon(Icons.arrow_back),
onPressed: () {},
onPressed: () {
Navigator.of(context).pop();
},
),
),
body: LayoutBuilder(
Expand All @@ -61,13 +65,8 @@ class _EditProfileScreenState extends State<EditProfileScreen> {
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),
],
Expand Down Expand Up @@ -117,6 +116,15 @@ class _EditProfileScreenState extends State<EditProfileScreen> {
);
}

Widget _buildProfileHeader(BuildContext context) {
return Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
ProfileHeader(
name: "Stefani",
role: "Estudante",
),
]);
}

Widget _saveButton(EditProfileViewModel viewModel) {
return ElevatedButton(
onPressed: () async {
Expand Down Expand Up @@ -153,40 +161,6 @@ class _EditProfileScreenState extends State<EditProfileScreen> {
);
}

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,
Expand Down
41 changes: 32 additions & 9 deletions lib/ui/profile/view/ProfileView.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
),
),
),
],
);
}

Expand Down
23 changes: 0 additions & 23 deletions lib/ui/shared/ProfileHeader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
),
),
),
],
),
);
Expand Down

0 comments on commit c1de7a2

Please sign in to comment.