Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Cristiang1021/ErgoKawsay/llms.txt

Use this file to discover all available pages before exploring further.

Building healthy ergonomic habits requires consistency, and consistency requires prompts. The Reminders module gives teachers two distinct notification channels — recurring active break reminders and a single daily exercise alarm — so that good habits become part of the natural rhythm of a school day. All scheduling runs entirely on-device using flutter_local_notifications, meaning no internet connection or external service is ever needed. When notifications are active, the app schedules up to eight lookahead break reminders at once. Each notification carries one of ten rotating motivational messages drawn from both Spanish and Kichwa message banks, so the prompts always feel fresh. A configurable work window and an automatic night silence period ensure that reminders never arrive at inappropriate times.

Notification Types

Active Break Reminders

Periodic notifications delivered at a user-chosen frequency (30 min, 1 h, 2 h, or 3 h). Each notification displays one of ten rotating motivational messages covering neck stretches, hydration, eye rest, breathing, shoulder rolls, walking, back stretches, eye blinking, ankle circles, and gentle neck rotation — available in both Spanish and Kichwa. Only notifications that fall within the configured work window and outside the night silence period are actually delivered.

Daily Exercise Alarm

A single notification delivered once per day at a user-selected hour (default 07:00). It uses a dedicated Android notification channel (daily_exercise) and prompts the teacher to begin their daily exercise session. The alarm advances to the next calendar day automatically if the scheduled time has already passed when settings are saved.

Configuration Options

Every value below maps directly to a field in the ReminderSettings model and is persisted to SharedPreferences as JSON under AppConstants.keyReminders ("reminders").
SettingTypeDefaultDescription
notificationsActivebooltrueMaster on/off toggle for all reminder notifications
breakFrequencyMinutesint60Minutes between active break reminders (presets: 30, 60, 120, 180)
dailyExerciseHourint7Hour of day (0–23) for the daily exercise notification
workStartHourint8Notifications are only scheduled after this hour
workEndHourint17Notifications are only scheduled before this hour
nightSilenceStartHourint20Night silence window begins at this hour
nightSilenceEndHourint6Night silence window ends at this hour
customFrequencyMinutesint45Persisted value when the user picks a custom break frequency via Settings
reminderTypesList<String>all 5 typesActive reminder categories: neck, shoulders, vision, breathing, hydration

Night Silence Mode

When nightSilenceStartHour is greater than nightSilenceEndHour — as in the default 20:00–06:00 window — the logic wraps around midnight. A slot at any hour that is either >= nightSilenceStartHour or < nightSilenceEndHour is considered inside the silence window and is skipped forward to the next workStartHour. When start and end are on the same calendar side (e.g., 01:00–05:00), the simpler >= / < range is used instead.
Night silence is always on — it is not a separate toggle. The default window is 20:00–06:00. To change the window, update nightSilenceStartHour and nightSilenceEndHour in the ReminderSettings object and re-save.
The companion check for work hours (_isOutsideWorkHours) runs in parallel; if a slot falls outside both the work window and the night silence window, it is bumped to the next workStartHour on the following day.

Motivational Messages

The NotificationService contains two static lists of ten messages each — one in Spanish (_messagesEs) and one in Kichwa (_messagesQu). The active list is chosen at scheduling time based on the locale stored in StorageService. To avoid always showing the same first message, the starting index is offset by DateTime.now().minute % 10, so the sequence varies every time the reminders are rescheduled. Spanish messages (_messagesEs)
  1. Pausa activa: estira cuello y hombros durante 2 minutos.
  2. Hidratación: toma un vaso de agua ahora.
  3. Descansa la vista: mira un punto lejano durante 20 segundos.
  4. Respira profundo: inhala 4 s, retén 4 s, exhala 4 s.
  5. Pausa de hombros: eleva y suelta 5 veces lentamente.
  6. Levántate y camina 2 minutos. Tu cuerpo lo agradece.
  7. Estira la espalda: entrelaza los dedos y estira hacia arriba.
  8. Parpadea 20 veces para relajar los ojos.
  9. Mueve los tobillos en círculos mientras estás sentado.
  10. Gira el cuello suavemente de lado a lado, sin forzar.
Kichwa messages (_messagesQu)
  1. Kawsay sayay: kunkata, rikrak’ta samachiy.
  2. Yakuta upiy kunan. Alli kawsaypaqmi.
  3. Ñawikunata samachiy: karupi rikhuriq rurayta qhawaychiy.
  4. Ukhu samay: 4 sigundu ukhu, 4 chariy, 4 llujshiy.
  5. Rikrak’ta sayariy: 5 kutita sinchita wicharichiy, samariy.
  6. Sayariy, 2 minututa puriy. Aychata samachiy.
  7. Wasan q’ipiyta alliyachiy: makikunata wichaypi.
  8. Ñawikunata 20 kutita kinrayachiy.
  9. Chaki moqokunata muyu muyu tukuchiy.
  10. Kunkata sinchiyachishpa muyurichiy.

Notification IDs

NotificationID RangeNotes
Active break reminders100–107Eight lookahead slots, IDs 100 through 107
Daily exercise alarm200Single daily notification
Test notification999Fired immediately; does not affect scheduled slots

Scheduling Flow

NotificationService.instance.scheduleReminders(settings, locale) always calls cancelAll() first, then re-schedules all active slots from scratch. This guarantees no stale notifications remain after any settings change:
  1. cancelAll() — removes every previously registered notification.
  2. _scheduleBreakReminders() — registers up to eight break notifications (IDs 100–107), skipping any slot that falls outside work hours or inside the night silence window.
  3. _scheduleDailyExercise() — registers notification ID 200 for the configured hour (or the same hour next day if it has already passed today).
If notificationsActive is false, cancelAll() is called and steps 2 and 3 are skipped entirely.

StorageService Integration

ReminderSettings is serialized to JSON and stored in SharedPreferences. The two key methods are:
// Read current settings (returns ReminderSettings.defaults() if none saved)
final settings = storage.getReminderSettings();

// Persist updated settings
await storage.saveReminderSettings(settings);
After saving, the screen immediately calls NotificationService.instance.scheduleReminders(settings, locale) to cancel any previously scheduled notifications and replace them with a fresh set derived from the new configuration. The SharedPreferences key used internally is AppConstants.keyReminders ("reminders").

Test Notification

Developers and users can verify that the Android notification channel is properly configured by firing an immediate test notification:
await NotificationService.instance.showTestNotification(locale);
This sends notification ID 999 with the first active break message in the current locale (_testMessageEs or _testMessageQu) without touching any of the scheduled slots. The Settings screen surfaces this as a “Send test notification” row that triggers the call and shows a confirmation snackbar.

Route

Navigate to the Reminders screen via the named route /reminders.

Build docs developers (and LLMs) love