Skip to content

Commit

Permalink
[Bug] Clear button deletes entire input in math challenge instead of…
Browse files Browse the repository at this point in the history
… removing digits one-by-one (#648)

* Update alarm_ring_view.dart

added exit preview button

* Update alarm_challenge_controller.dart

math-bug

* Update maths_challenge_view.dart

* Update alarm_ring_view.dart
  • Loading branch information
mahendra-918 authored Jan 28, 2025
1 parent 797e4f4 commit b81dcd4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -246,4 +246,13 @@ class AlarmChallengeController extends GetxController {
AudioUtils.playAlarm(alarmRecord: alarmRecord);
}
}
void removeDigit() {
if (displayValue.value.isNotEmpty) {
displayValue.value = displayValue.value.substring(
0,
displayValue.value.length - 1
);
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class MathsChallengeView extends GetView<AlarmChallengeController> {
() => ElevatedButton(
onPressed: () {
Utils.hapticFeedback();
controller.displayValue.value = '';
controller.removeDigit();
},
style: ElevatedButton.styleFrom(
backgroundColor: themeController.primaryTextColor.value.withOpacity(0.45),
Expand Down Expand Up @@ -228,3 +228,4 @@ class MathsChallengeView extends GetView<AlarmChallengeController> {
);
}
}

0 comments on commit b81dcd4

Please sign in to comment.