fix(timer): show the live countdown in the sleep timer sheet
showPluriSleepTimerSheet already had a working countdown branch (ServicioTimer.tiempoRestanteStream), but every preset and the custom duration flow popped the sheet immediately after starting the timer -- so the countdown never rendered in the primary flow, only if the user happened to reopen the sheet afterwards. Stop popping the sheet on start; the existing Consumer<EstadoRadio> already reacts to iniciarTimerDuracion's notifyListeners and swaps to the countdown view live. Also make the sheet scroll-controlled: at a realistic phone width the countdown's title + description + headline- sized remaining-time text overflowed the default half-screen cap that never mattered while the sheet always closed before that view could render.
This commit is contained in:
@@ -14,6 +14,13 @@ import 'pluri_layout.dart';
|
||||
void showPluriSleepTimerSheet(BuildContext context) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
// Issue 2 (feedback-pruebas): without this, the sheet is capped to a
|
||||
// FRACTION of the screen height. That never mattered while the sheet
|
||||
// always closed immediately after picking a duration (see the removed
|
||||
// `Navigator.pop` calls below) -- now that the countdown view actually
|
||||
// stays open, its title + description + headline-sized remaining-time
|
||||
// text can overflow that capped height on a real phone width.
|
||||
isScrollControlled: true,
|
||||
showDragHandle: true,
|
||||
builder:
|
||||
(ctx) => Consumer<EstadoRadio>(
|
||||
@@ -79,12 +86,17 @@ void showPluriSleepTimerSheet(BuildContext context) {
|
||||
Duration(seconds: segundos),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
estado.iniciarTimerDuracion(
|
||||
Duration(seconds: segundos),
|
||||
);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
// Issue 2 (feedback-pruebas): no longer pops
|
||||
// the sheet -- `estado.iniciarTimerDuracion`
|
||||
// notifies this `Consumer<EstadoRadio>`,
|
||||
// which swaps straight to the countdown
|
||||
// view above so the user actually SEES the
|
||||
// remaining time instead of the sheet just
|
||||
// closing with no feedback.
|
||||
onPressed:
|
||||
() => estado.iniciarTimerDuracion(
|
||||
Duration(seconds: segundos),
|
||||
),
|
||||
),
|
||||
ActionChip(
|
||||
avatar: const Icon(Icons.tune_rounded, size: 18),
|
||||
@@ -93,8 +105,9 @@ void showPluriSleepTimerSheet(BuildContext context) {
|
||||
final duracion =
|
||||
await _pedirDuracionPersonalizada(ctx);
|
||||
if (duracion == null || !ctx.mounted) return;
|
||||
// Issue 2: same as above -- stays open on
|
||||
// the countdown view rather than closing.
|
||||
estado.iniciarTimerDuracion(duracion);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user