Skip to content

Commit

Permalink
fix(#59): melhorando estilo
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielCostaDeOliveira committed Dec 20, 2024
1 parent 7230b84 commit 86f9db1
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 84 deletions.
63 changes: 29 additions & 34 deletions lib/ui/edit_profile/view/EditProfileView.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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<EditProfileScreen> createState() => _EditProfileScreenState();
}

class _EditProfileScreenState extends State<EditProfileScreen> {
@override
Widget build(BuildContext context) {
final viewModel = Provider.of<EditProfileViewModel>(context);
Expand All @@ -46,13 +40,13 @@ class _EditProfileScreenState extends State<EditProfileScreen> {
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();
},
Expand All @@ -61,49 +55,48 @@ class _EditProfileScreenState extends State<EditProfileScreen> {
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),
],
),
);
},
),
);
}

Widget _buildForm(EditProfileViewModel viewModel, bool isSmallScreen) {
Widget _buildForm(BuildContext context, EditProfileViewModel viewModel,
bool isSmallScreen) {
return Form(
key: viewModel.formKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
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),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Expanded(
child: _saveButton(viewModel),
child: _saveButton(context, viewModel),
),
SizedBox(width: isSmallScreen ? 10 : 20),
Expanded(
Expand All @@ -117,15 +110,17 @@ class _EditProfileScreenState extends State<EditProfileScreen> {
}

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

0 comments on commit 86f9db1

Please sign in to comment.