feat: Implement change detection and conditional enabling of save/cancel buttons for profile and notification settings.
This commit is contained in:
@@ -87,6 +87,7 @@ class ProfileActionButtons extends StatelessWidget {
|
||||
final VoidCallback onSave;
|
||||
final VoidCallback onCancel;
|
||||
final bool isSaving;
|
||||
final bool hasChanges;
|
||||
final String saveLabel;
|
||||
|
||||
const ProfileActionButtons({
|
||||
@@ -94,6 +95,7 @@ class ProfileActionButtons extends StatelessWidget {
|
||||
required this.onSave,
|
||||
required this.onCancel,
|
||||
this.isSaving = false,
|
||||
this.hasChanges = true,
|
||||
this.saveLabel = 'Save Changes',
|
||||
});
|
||||
|
||||
@@ -114,26 +116,29 @@ class ProfileActionButtons extends StatelessWidget {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: GestureDetector(
|
||||
onTap: onCancel,
|
||||
child: Container(
|
||||
height: 31,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
border: Border.all(
|
||||
color: AppColors.primaryDark.withValues(alpha: 0.1),
|
||||
width: 1,
|
||||
onTap: hasChanges ? onCancel : null,
|
||||
child: Opacity(
|
||||
opacity: hasChanges ? 1.0 : 0.5,
|
||||
child: Container(
|
||||
height: 31,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
border: Border.all(
|
||||
color: AppColors.primaryDark.withValues(alpha: 0.1),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: const Text('Cancel',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Fractul',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.primaryDark,
|
||||
)),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: const Text('Cancel',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Fractul',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.primaryDark,
|
||||
)),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user