mudar nome no prefil
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:go_router/go_router.dart';
|
|||||||
import '../../../../core/services/auth_service.dart';
|
import '../../../../core/services/auth_service.dart';
|
||||||
import '../../../../core/theme/app_colors.dart';
|
import '../../../../core/theme/app_colors.dart';
|
||||||
import '../../../dashboard/presentation/pages/student_dashboard_page.dart';
|
import '../../../dashboard/presentation/pages/student_dashboard_page.dart';
|
||||||
|
import '../../../dashboard/presentation/pages/teacher_dashboard_page.dart';
|
||||||
|
|
||||||
/// Profile edit page for settings
|
/// Profile edit page for settings
|
||||||
class ProfileEditPage extends ConsumerStatefulWidget {
|
class ProfileEditPage extends ConsumerStatefulWidget {
|
||||||
@@ -16,8 +17,6 @@ class ProfileEditPage extends ConsumerStatefulWidget {
|
|||||||
class _ProfileEditPageState extends ConsumerState<ProfileEditPage> {
|
class _ProfileEditPageState extends ConsumerState<ProfileEditPage> {
|
||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
final _nameController = TextEditingController();
|
final _nameController = TextEditingController();
|
||||||
final _phoneController = TextEditingController();
|
|
||||||
final _bioController = TextEditingController();
|
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -29,8 +28,6 @@ class _ProfileEditPageState extends ConsumerState<ProfileEditPage> {
|
|||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_nameController.dispose();
|
_nameController.dispose();
|
||||||
_phoneController.dispose();
|
|
||||||
_bioController.dispose();
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,6 +57,7 @@ class _ProfileEditPageState extends ConsumerState<ProfileEditPage> {
|
|||||||
|
|
||||||
// Clear cached user name so dashboard will reload with new name
|
// Clear cached user name so dashboard will reload with new name
|
||||||
StudentDashboardPage.clearCachedUserName();
|
StudentDashboardPage.clearCachedUserName();
|
||||||
|
TeacherDashboardPage.clearCachedUserName();
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
@@ -108,8 +106,8 @@ class _ProfileEditPageState extends ConsumerState<ProfileEditPage> {
|
|||||||
end: Alignment.bottomRight,
|
end: Alignment.bottomRight,
|
||||||
colors: [
|
colors: [
|
||||||
Theme.of(context).colorScheme.background,
|
Theme.of(context).colorScheme.background,
|
||||||
Theme.of(context).colorScheme.primary.withOpacity(0.1),
|
Theme.of(context).colorScheme.primary.withValues(alpha: 0.1),
|
||||||
Theme.of(context).colorScheme.secondary.withOpacity(0.05),
|
Theme.of(context).colorScheme.secondary.withValues(alpha: 0.05),
|
||||||
Theme.of(context).colorScheme.background,
|
Theme.of(context).colorScheme.background,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -159,7 +157,7 @@ class _ProfileEditPageState extends ConsumerState<ProfileEditPage> {
|
|||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Theme.of(
|
color: Theme.of(
|
||||||
context,
|
context,
|
||||||
).colorScheme.shadow.withOpacity(0.1),
|
).colorScheme.shadow.withValues(alpha: 0.1),
|
||||||
blurRadius: 10,
|
blurRadius: 10,
|
||||||
offset: const Offset(0, 4),
|
offset: const Offset(0, 4),
|
||||||
),
|
),
|
||||||
@@ -252,68 +250,6 @@ class _ProfileEditPageState extends ConsumerState<ProfileEditPage> {
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 24),
|
|
||||||
|
|
||||||
// Phone field (optional)
|
|
||||||
Text(
|
|
||||||
'Telefone (opcional)',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: Theme.of(context).colorScheme.onSurface,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
TextFormField(
|
|
||||||
controller: _phoneController,
|
|
||||||
keyboardType: TextInputType.phone,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintText: 'Introduza o seu telefone',
|
|
||||||
filled: true,
|
|
||||||
fillColor: Theme.of(
|
|
||||||
context,
|
|
||||||
).colorScheme.surface,
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
borderSide: BorderSide.none,
|
|
||||||
),
|
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 16,
|
|
||||||
vertical: 12,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 24),
|
|
||||||
|
|
||||||
// Bio field (optional)
|
|
||||||
Text(
|
|
||||||
'Bio (opcional)',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: Theme.of(context).colorScheme.onSurface,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
TextFormField(
|
|
||||||
controller: _bioController,
|
|
||||||
maxLines: 3,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintText: 'Conte um pouco sobre si',
|
|
||||||
filled: true,
|
|
||||||
fillColor: Theme.of(
|
|
||||||
context,
|
|
||||||
).colorScheme.surface,
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
borderSide: BorderSide.none,
|
|
||||||
),
|
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 16,
|
|
||||||
vertical: 12,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 32),
|
const SizedBox(height: 32),
|
||||||
|
|
||||||
// Save button
|
// Save button
|
||||||
|
|||||||
Reference in New Issue
Block a user