feat(ui): add premium PluriWave redesign
This commit is contained in:
@@ -115,11 +115,28 @@ class ServicioFavoritos {
|
||||
/// Actualiza el orden de un favorito.
|
||||
Future<void> reordenar(String uuid, int nuevoOrden) async {
|
||||
final db = await _database;
|
||||
await db.update(
|
||||
'favoritos',
|
||||
{'orden': nuevoOrden},
|
||||
where: 'uuid = ?',
|
||||
whereArgs: [uuid],
|
||||
);
|
||||
await db.transaction((txn) async {
|
||||
final rows = await txn.query(
|
||||
'favoritos',
|
||||
columns: ['uuid'],
|
||||
orderBy: 'orden ASC, id ASC',
|
||||
);
|
||||
final uuids = rows.map((r) => r['uuid'] as String).toList();
|
||||
final oldIndex = uuids.indexOf(uuid);
|
||||
if (oldIndex == -1 || uuids.isEmpty) return;
|
||||
|
||||
final targetIndex = nuevoOrden.clamp(0, uuids.length - 1);
|
||||
final moved = uuids.removeAt(oldIndex);
|
||||
uuids.insert(targetIndex, moved);
|
||||
|
||||
for (var i = 0; i < uuids.length; i++) {
|
||||
await txn.update(
|
||||
'favoritos',
|
||||
{'orden': i},
|
||||
where: 'uuid = ?',
|
||||
whereArgs: [uuids[i]],
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class ServicioTimer {
|
||||
|
||||
/// Inicia el timer para [minutos] minutos.
|
||||
void iniciar(int minutos) {
|
||||
cancelar();
|
||||
unawaited(cancelar());
|
||||
final duracion = Duration(minutes: minutos);
|
||||
_finAt = DateTime.now().add(duracion);
|
||||
_tiempoRestante = duracion;
|
||||
@@ -92,7 +92,7 @@ class ServicioTimer {
|
||||
}
|
||||
|
||||
/// Cancela el timer activo sin detener el audio.
|
||||
void cancelar({bool detenerAudio = false}) {
|
||||
Future<void> cancelar({bool detenerAudio = false}) async {
|
||||
_timer?.cancel();
|
||||
_timer = null;
|
||||
_fadeTicker?.cancel();
|
||||
@@ -102,12 +102,12 @@ class ServicioTimer {
|
||||
_controller.add(_tiempoRestante);
|
||||
|
||||
if (detenerAudio) {
|
||||
_audio.detener();
|
||||
await _audio.detener();
|
||||
}
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
cancelar();
|
||||
unawaited(cancelar());
|
||||
_controller.close();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user