feat: Limit professional expertise tags to three with a "more" pill and implement save button state management for profile settings based on field changes.
This commit is contained in:
@@ -38,10 +38,23 @@ class _ProfileSettingsTabState extends ConsumerState<ProfileSettingsTab> {
|
||||
_emailController = TextEditingController();
|
||||
_phoneController = TextEditingController();
|
||||
_locationController = TextEditingController();
|
||||
// Listen for changes to enable/disable Cancel & Save buttons
|
||||
_fullNameController.addListener(_onFieldChanged);
|
||||
_titleController.addListener(_onFieldChanged);
|
||||
_phoneController.addListener(_onFieldChanged);
|
||||
_locationController.addListener(_onFieldChanged);
|
||||
}
|
||||
|
||||
void _onFieldChanged() {
|
||||
setState(() {}); // triggers rebuild so _hasChanges is re-evaluated
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_fullNameController.removeListener(_onFieldChanged);
|
||||
_titleController.removeListener(_onFieldChanged);
|
||||
_phoneController.removeListener(_onFieldChanged);
|
||||
_locationController.removeListener(_onFieldChanged);
|
||||
_fullNameController.dispose();
|
||||
_titleController.dispose();
|
||||
_emailController.dispose();
|
||||
|
||||
@@ -146,8 +146,10 @@ class ProfileActionButtons extends StatelessWidget {
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: GestureDetector(
|
||||
onTap: isSaving ? null : onSave,
|
||||
child: Container(
|
||||
onTap: (isSaving || !hasChanges) ? null : onSave,
|
||||
child: Opacity(
|
||||
opacity: hasChanges ? 1.0 : 0.5,
|
||||
child: Container(
|
||||
height: 31,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
decoration: BoxDecoration(
|
||||
@@ -174,6 +176,7 @@ class ProfileActionButtons extends StatelessWidget {
|
||||
)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user