From 686da0656d57804afdbd905ca6cb9f6aeebb8daf Mon Sep 17 00:00:00 2001 From: Santo Shakil Date: Sun, 21 Jun 2026 00:29:28 +0600 Subject: [PATCH] fix(mobile): only toggle backup from the switch, not the whole row tapping anywhere on the enable backup row flipped backup on or off, so it was easy to toggle by accident. now only the switch does it. --- .../backup/backup_toggle_button.widget.dart | 96 +++++++++---------- 1 file changed, 44 insertions(+), 52 deletions(-) diff --git a/mobile/lib/presentation/widgets/backup/backup_toggle_button.widget.dart b/mobile/lib/presentation/widgets/backup/backup_toggle_button.widget.dart index 3bf48783ea..b424298f5b 100644 --- a/mobile/lib/presentation/widgets/backup/backup_toggle_button.widget.dart +++ b/mobile/lib/presentation/widgets/backup/backup_toggle_button.widget.dart @@ -106,65 +106,57 @@ class BackupToggleButtonState extends ConsumerState with Sin borderRadius: const BorderRadius.all(Radius.circular(18.5)), color: context.colorScheme.surfaceContainerLow, ), - child: Material( - color: context.colorScheme.surfaceContainerLow, - borderRadius: const BorderRadius.all(Radius.circular(20.5)), - child: InkWell( - borderRadius: const BorderRadius.all(Radius.circular(20.5)), - onTap: () => _onToggle(!_isEnabled), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16), - child: Row( - children: [ - Container( - padding: const EdgeInsets.all(8), - decoration: BoxDecoration( - shape: BoxShape.circle, - gradient: LinearGradient( - colors: [ - context.primaryColor.withValues(alpha: 0.2), - context.primaryColor.withValues(alpha: 0.1), - ], - ), - ), - child: isProcessing - ? const SizedBox(width: 24, height: 24, child: CircularProgressIndicator(strokeWidth: 2)) - : Icon(Icons.cloud_upload_outlined, color: context.primaryColor, size: 24), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16), + child: Row( + children: [ + Container( + padding: const EdgeInsets.all(8), + decoration: BoxDecoration( + shape: BoxShape.circle, + gradient: LinearGradient( + colors: [ + context.primaryColor.withValues(alpha: 0.2), + context.primaryColor.withValues(alpha: 0.1), + ], ), - const SizedBox(width: 16), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + ), + child: isProcessing + ? const SizedBox(width: 24, height: 24, child: CircularProgressIndicator(strokeWidth: 2)) + : Icon(Icons.cloud_upload_outlined, color: context.primaryColor, size: 24), + ), + const SizedBox(width: 16), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Flexible( - child: Text( - "enable_backup".t(context: context), - style: context.textTheme.titleMedium?.copyWith( - fontWeight: FontWeight.w600, - color: context.primaryColor, - ), - ), - ), - ], - ), - if (errorCount > 0) - Padding( - padding: const EdgeInsets.only(top: 2), - child: Text( - "upload_error_with_count".t(context: context, args: {'count': '$errorCount'}), - style: context.textTheme.labelMedium?.copyWith(color: context.colorScheme.error), + Flexible( + child: Text( + "enable_backup".t(context: context), + style: context.textTheme.titleMedium?.copyWith( + fontWeight: FontWeight.w600, + color: context.primaryColor, ), ), + ), ], ), - ), - Switch.adaptive(value: _isEnabled, onChanged: (value) => _onToggle(value)), - ], + if (errorCount > 0) + Padding( + padding: const EdgeInsets.only(top: 2), + child: Text( + "upload_error_with_count".t(context: context, args: {'count': '$errorCount'}), + style: context.textTheme.labelMedium?.copyWith(color: context.colorScheme.error), + ), + ), + ], + ), ), - ), + Switch.adaptive(value: _isEnabled, onChanged: (value) => _onToggle(value)), + ], ), ), ),