Skip to content

Commit b81dcd4

Browse files
authored
[Bug] Clear button deletes entire input in math challenge instead of 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
1 parent 797e4f4 commit b81dcd4

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/app/modules/alarmChallenge/controllers/alarm_challenge_controller.dart

+9
Original file line numberDiff line numberDiff line change
@@ -246,4 +246,13 @@ class AlarmChallengeController extends GetxController {
246246
AudioUtils.playAlarm(alarmRecord: alarmRecord);
247247
}
248248
}
249+
void removeDigit() {
250+
if (displayValue.value.isNotEmpty) {
251+
displayValue.value = displayValue.value.substring(
252+
0,
253+
displayValue.value.length - 1
254+
);
255+
}
249256
}
257+
}
258+

lib/app/modules/alarmChallenge/views/maths_challenge_view.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class MathsChallengeView extends GetView<AlarmChallengeController> {
181181
() => ElevatedButton(
182182
onPressed: () {
183183
Utils.hapticFeedback();
184-
controller.displayValue.value = '';
184+
controller.removeDigit();
185185
},
186186
style: ElevatedButton.styleFrom(
187187
backgroundColor: themeController.primaryTextColor.value.withOpacity(0.45),
@@ -228,3 +228,4 @@ class MathsChallengeView extends GetView<AlarmChallengeController> {
228228
);
229229
}
230230
}
231+

0 commit comments

Comments
 (0)