Tester feedback: offline mode, pt-PT, menus, layout and translations

Offline (read-only) mode
- The last connected radio is remembered; with no radio the app opens on
  its saved contacts, channels, messages and unread counts.
- Main screens stay open on disconnect. A Connect button replaces the
  battery and signal indicators, with a sheet to reconnect, choose a
  radio or stop a pending reconnect.
- While disconnected everything is read-only: the composer becomes a
  "connect to send" bar (drafts kept) and controls that change the radio
  or stored history are disabled or hidden.
- Resending while disconnected no longer deletes the message; a
  different radio no longer shows the previous radio's channels.
- Notification taps open the saved chat while offline.

Chats and menus
- Channel chat menu: notifications, edit channel, delete channel; the
  filter row lines up with the others; bell moved out of the app bar.
- DM and room menus: remove from contacts; rooms get room management.
- Search field uses the full app bar; long-press a result to copy.
- Hashtag channel titles no longer read "# #name"; more room around the
  radio activity dot.
- Repeat filter: short messages from one sender are caught at the same
  count as long ones.

Layout
- Shared menu row (wraps to two lines) and segment label (never splits
  a word) used across the app.
- One Scan button on the scanner; consistent settings tile titles;
  contact "last seen" wraps instead of truncating; unfetched repeater
  settings are dimmed.

Localization
- New European Portuguese locale (pt_PT); regional locales are handled
  by the language picker, notifications and the background service.
- Fill 67 missing strings per locale, including backup and restore.
- Keep "Flood" and "Zero Hop" untranslated, shorten "last seen" and
  routing labels, and fix mistranslated scan, theme and hop strings.
- Received-image strings, badge and caption come from translations.
- Regenerate the Czech localizations, which were missing strings.

Docs
- Add documentation/design.md (UI reference) and offline-mode.md;
  update channel, chat, navigation and scanner docs.
This commit is contained in:
zjs81 committed 2026-11-09 21:18:29 -07:00
1 parent 47f2293a5c
commit 462159e803
108 files changed
+17435 -4536

No files matched your search

+2
View File
@@ -31,6 +31,8 @@ MeshCore Open is an open-source Flutter client for MeshCore LoRa mesh networking
18. [Network Map](network-map.md) - Online repeater map, adding and managing repeaters from it, opt-in uploads, and hiding a repeater
19. [Themes](themes.md) - Color themes, custom icons and map markers, chat backgrounds, automatic holiday themes, and holiday message animations
20. [Message Filter](message-filter.md) - Hide spam and repeated channel messages with your own rules, automatic checks, and learning from Spam taps, all on the device
21. [UI Design Reference](design.md) - Contributor reference: theme, typography, spacing, shared widgets, sheets vs dialogs vs pages, states, and localization rules for UI changes
22. [Offline Mode](offline-mode.md) - Read-only view of the last radio's contacts, channels and messages while no radio is connected, and the Connect sheet
## App Overview
+2 -1
View File
@@ -77,7 +77,8 @@ Tap a channel card to open the channel chat screen.
- Channel name
- Subtitle: channel type and effective region when set, with `(default)` when inherited
- Tap the title or landscape icon to select a region; see [Regions](regions.md)
- Bell icon: mute or unmute notifications for this channel (crossed-out bell when muted)
- Overflow menu (⋮) → **Notifications**: choose all messages, mentions only or muted for this channel. The row shows the current mode
- Overflow menu (⋮) → **Edit channel** and **Delete channel**: the same sheet and confirmation as a long-press in the channel list
- Overflow menu (⋮) → **Chat background**: a color or picture, with a fade slider, behind this channel only. See [Chat backgrounds](themes.md#chat-backgrounds). Holiday greetings in new messages play a short animation, as in [direct chat](chat-and-messaging.md#message-list)
### Message Display
+1 -1
View File
@@ -20,7 +20,7 @@ From the Contacts screen, tap any Chat-type contact to open the ChatScreen.
- **Subtitle**: Current routing path label (e.g., "2 hops", "flood (auto)", "direct (forced)") and unread count. Tapping the subtitle shows the full path details.
- **Action buttons**:
- **Search** (magnifier icon): Replaces the title with a search field and lists every message in this conversation's full history whose text (or translation) contains the typed word, newest first, with matches highlighted. Channel search also matches sender names and skips messages caught by the [message filter](message-filter.md). Back, Esc or the arrow closes search. Channel chats have the same button.
- **Overflow menu** (⋮ icon): Contains Routing, Info, Telemetry, Settings, Chat background, and Clear Chat. Routing opens the routing sheet where you can switch between Auto, Direct, and Flood routing and manage recent paths (hop count, round-trip time, age, success count, color-coded by repeater). Info shows a dialog with contact type, path, GPS coordinates, and public key. Chat background sets a color or picture (with a fade slider) behind this chat only; see [Chat backgrounds](themes.md#chat-backgrounds).
- **Overflow menu** (⋮ icon): Contains Routing, Info, Telemetry, Settings, Chat background, Clear Chat, and Remove from contacts (rooms also have Room Server Management). Routing opens the routing sheet where you can switch between Auto, Direct, and Flood routing and manage recent paths (hop count, round-trip time, age, success count, color-coded by repeater). Info shows a dialog with contact type, path, GPS coordinates, and public key. Chat background sets a color or picture (with a fade slider) behind this chat only; see [Chat backgrounds](themes.md#chat-backgrounds).
### Message List
+249
View File
@@ -0,0 +1,249 @@
# UI Design Reference
How MeshCore Open's interface is built today, and the rules to follow when adding or changing UI. Every value below comes from the code it cites. If you change one of those sources, or settle on a new pattern, update this page in the same change.
The source of truth is `lib/theme/mesh_theme.dart` (theme), `lib/widgets/mesh_ui.dart` (shared widgets) and `lib/widgets/mesh_nav_tile.dart` (settings rows). Where the code disagrees with this page, fix one of them; do not copy the inconsistency.
## 1. Principles
- **Readable first.** Many users are older. Use the sizes in [Typography](#3-typography) as minimums, keep text and icons high-contrast, and never use colour as the only signal.
- **Theme and shared widgets, not ad-hoc values.** Take colours from `Theme.of(context).colorScheme` (or the theme extensions), text styles from `Theme.of(context).textTheme`, radii from `MeshRadii`, and build rows, cards, menus and sheets from the shared widgets in section 5.
- **Every label must survive a long translation.** The app ships 19 locales. Text wraps or scales; it never clips or breaks mid-word.
- **Respect the system text size.** The app does not clamp the system text scale (only `ReviewModeBanner` uses `MediaQuery.withClampedTextScaling`). Layouts must grow, wrap or scroll at large scales.
- **Material only.** No Cupertino widgets (`AGENTS.md`).
## 2. Colour and theme
`lib/main.dart` applies `MeshTheme.light()`, `MeshTheme.dark()`, or `MeshTheme.fromCustom(customTheme)` for custom, preset and holiday themes. All three go through `MeshTheme._build`, so component themes are identical; only the `ColorScheme` and three extensions change.
| Need | Use |
|---|---|
| Page background | `scheme.surface` (scaffold default) |
| Card / sheet / dialog / menu surface | `scheme.surfaceContainerLow` (cards, sheets, dialogs), `surfaceContainerHigh` (popup menus, snackbars, input fill) |
| Primary text | `scheme.onSurface` |
| Secondary text, icons, subtitles | `scheme.onSurfaceVariant` (the default `iconTheme` colour) |
| Borders and dividers | `scheme.outlineVariant` (card borders, dividers); `scheme.outline` (stronger: outlined buttons, input border) |
| Accent, selection, primary actions | `scheme.primary` / `onPrimary` |
| Destructive or error | `scheme.error`; banners use `errorContainer` / `onErrorContainer` |
| Warning | `scheme.tertiary` (amber), or `MeshPalette.warn` |
| Good / bad signal | `MeshTheme.snrColor(snr, blocked:)`; `MeshPalette.signal`, `.warn`, `.alert` for status ramps (e.g. battery in `repeater_status_screen.dart`) |
| Own chat bubbles | `MeshBubbleTheme.of(context)` |
| Map overlays and markers | `MapPalette`, `MeshMapTheme.of(context)`; line-of-sight charts use `LosPalette` |
| Coloured text or icon on a tinted background | pass it through `readableAccent(color, background, minContrast:)` (`mesh_ui.dart`), 4.5 for text, 3 for icons |
Rules:
- Do not use `MeshPalette.ink*`, `bg*` or `line*` directly in normal screens. They are the dark-theme values and are wrong in the light theme and in custom themes. Use the matching `ColorScheme` role.
- Do not use raw `Colors.red`, `Colors.grey[600]` and so on for UI chrome.
- Status colours (`error`, `tertiary`, `secondary`) are copied from the stock scheme of the same brightness in `fromCustom`, so they keep their meaning in custom themes.
- `StatusChip` shows how to colour a status: the label keeps `onSurface`, and only the dot or icon carries the colour.
Custom, preset and holiday themes (colours, icons, map markers, chat backgrounds) are described in [themes.md](themes.md). Use `ThemedIcon(ThemeIconSlot.…)` for the icons a theme can replace (tabs, send, settings, node avatars).
## 3. Typography
Fonts (`MeshFonts`): `Inter` (sans, the default), `JetBrains Mono` (mono), each with system fallbacks. `MeshTheme.display()` (serif) exists but is not used.
The text theme is the Material 3 2021 type scale (`Typography.material2021`) with Inter and `onSurface` colour applied in `MeshTheme._build`. Sizes are Flutter's defaults:
| Style | Size / weight | Used for |
|---|---|---|
| `titleLarge` | 22 / 400 | Rare large headings |
| `titleMedium` | 16 / 500 | Sheet titles (`BottomSheetHeader`, w700), empty-state titles (`EmptyState`, w600) |
| `titleSmall` | 14 / 500 | Sub-headings inside cards, banner titles (`RadioDisconnectedBanner`, w700) |
| `bodyLarge` | 16 / 400 | Body text; **settings tile titles at w600** (`meshTileTitleStyle`) |
| `bodyMedium` | 14 / 400 | Default `Text`; tile subtitles in `onSurfaceVariant` |
| `bodySmall` | 12 / 400 | Sheet subtitles, captions |
| `labelMedium` | 12 / 500 | Bottom navigation labels (`QuickSwitchBar`) |
| `labelSmall` | 11 / 500 | Avoid for anything the user must read |
Component text set explicitly in `MeshTheme._build`:
| Component | Style |
|---|---|
| App bar title | 20, w600, letter-spacing -0.2 |
| Filled / elevated button | 14, w600 |
| Segmented button | 13, w600 |
| Tab bar | 13.5, w700 selected, w500 unselected |
| Chip label | 12.5, w600 |
| Snackbar content | 16 |
| Tooltip | 12 |
| Slider value label | mono 12 |
Which style to use:
| Text | Style |
|---|---|
| Screen title | App bar default (20/w600); don't override |
| Section header above a card | `SectionHeader` (upper-cased `MeshTheme.accentLabel`, 13, w700, letter-spacing 0.6, `onSurfaceVariant`) |
| Settings / list row title | `meshTileTitleStyle(theme)` = `bodyLarge` w600. Inside `MeshSettingsTileTheme`, stock `ListTile`/`SwitchListTile`/`CheckboxListTile` titles get it automatically |
| Row subtitle | `bodyMedium`, `onSurfaceVariant` (stock `ListTile` default; `MeshNavTile` sets it) |
| Body copy, dialog content | `bodyMedium` / `bodyLarge` |
| Numbers, units, keys, hashes, CLI output, counts | `MeshTheme.mono(...)` (tabular figures). `StatTile` values are mono 20/w600 with a mono 12 unit |
| Timestamps, meta text | 12 minimum (`bodySmall` or `fontSize: 12`) |
| Chat message body | 14 × chat text scale (`chat_screen.dart` `bodyFontSize`) |
Minimum sizes: no hard-coded `fontSize` below 12 exists in `lib/screens` or `lib/widgets`; keep it that way. `MeshTheme.accentLabel()` defaults to 11, so always pass `fontSize:` (12 or more). Prefer a `textTheme` style over a literal `fontSize`.
**Chat text scale.** `ChatTextScaleService` (0.8–1.8, pinch in `chat_zoom_wrapper.dart`) multiplies chat text only. It stacks with the system scale. Read it with `context.select<ChatTextScaleService, double>((s) => s.scale)`.
## 4. Spacing, shape and sizing
| Thing | Value | Source |
|---|---|---|
| Screen side padding | 16 | `MeshCard.margin`, `SectionHeader.padding`, `MeshNavTile.padding` |
| Card | margin 16 horizontal / 4 vertical, padding 14, radius `MeshRadii.md` (14), 1px `outlineVariant` border, `surfaceContainerLow` fill, no elevation | `MeshCard` |
| Card holding tiles | `MeshCard(padding: EdgeInsets.zero)`, rows separated by `Divider(height: 1, indent: 16)` | `app_settings_screen.dart`, `settings_screen.dart` |
| Section header | padding 16, 20, 16, 8 (LTRB) | `SectionHeader` |
| Settings row | padding 16 / 12, 24px icon, 16 gap, chevron 24 | `MeshNavTile` |
| Switch row | `SwitchListTile`, `contentPadding` 16 / 4, `secondary` icon size 24 | `app_settings_screen.dart` |
| Popup menu row | 20px icon, 12 gap | `MeshMenuItemRow` |
| Banner | padding 16 / 12, 24px icon, 12 gap | `RadioDisconnectedBanner` |
| Sheet header | padding 20, 8, 8, 4 (LTRB), 36×4 drag handle | `BottomSheetHeader` |
| Radii | `MeshRadii.xs` 6, `sm` 10, `md` 14 (cards, inputs, menus, snackbars, list tiles), `lg` 18 (sheets, dialogs), `xl` 24, `pill` 999 (buttons, chips, FAB) | `MeshRadii` |
| Default icon size | 22 | `iconTheme` |
| Avatar | 40 | `AvatarCircle` |
| List bottom padding under a FAB | 88 | `channels_screen.dart` |
Icon sizes in use: 24 for tile and banner icons, 20 for menu icons and small action buttons, 18 for inline refresh icons and spinners. Keep tappable icons at 20 or more.
**Tap targets.** Keep Flutter's 48×48 minimum (the default `materialTapTargetSize` and `IconButton` size). Don't shrink with `VisualDensity.compact`, `MaterialTapTargetSize.shrinkWrap` or small `BoxConstraints` unless the control sits inside a larger tappable row.
## 5. Components
| Need | Use | Notes |
|---|---|---|
| Group of related content | `MeshCard` | `onTap`/`onLongPress` give ink feedback; long-press adds a selection haptic |
| Label above a group | `SectionHeader(label, trailing:)` | Upper-cases for you; pass the normal-case l10n string |
| Settings navigation row | `MeshNavTile` | `onTap: null` dims it to 50 % and reports it as disabled; use `subtitle` to say why |
| Settings switch | `SwitchListTile` inside `MeshSettingsTileTheme` | Wrap the settings screen body once in `MeshSettingsTileTheme` |
| Radio-style choice in a sheet | `MeshSheetOption` | Used by the language picker and map time filter |
| Popup menu row | **always** `PopupMenuItem(child: MeshMenuItemRow(icon:, label:))` | Label wraps to 2 lines then ellipsizes; `leading:` for `ThemedIcon`; no icon keeps the 20px slot |
| Segmented button label | **always** `ButtonSegment(label: MeshSegmentLabel(text))` | Shrinks to 12 (before system scale), then wraps at word boundaries onto 2 centred lines; never breaks a word |
| Status | `StatusChip` | Mono label, coloured dot or icon |
| Metric | `StatTile` | Label wraps to 2 lines; value wraps |
| Signal | `SignalBars`, `MeshTheme.snrColor` | |
| Route kind | `RouteChip` | Direct / hop count / Flood |
| Count badge | `Badge` on nav icons (`QuickSwitchBar`, caps at 99+), `UnreadBadge` in lists (alert red, mono 12) | |
| Empty list | `EmptyState(icon:, title:, subtitle:, action:)` | Scrolls rather than overflowing at large text |
| Inline error with retry | `ErrorRetryCard(message:, onRetry:, retryLabel:)` | Pass `retryLabel: context.l10n.common_retry` |
| Radio offline on a remote-node screen | `RadioDisconnectedBanner` | Renders nothing while connected |
| Sync progress | `SyncProgressAppBarBottom` as the app bar `bottom` | 3px bar |
| Toast message | `showDismissibleSnackBar(context, content: Text(...))` | Tap to dismiss, replaces the current snackbar, safe after an async gap |
| List item entrance | `ListEntrance(index:)` | Optional |
**Buttons.** Theme shapes are all pill-shaped. In use:
- `FilledButton` / `FilledButton.icon`: the primary action of a dialog, sheet, empty state or form (e.g. "Add public channel" in `EmptyState`, Save in the discard dialog in `repeater_settings_screen.dart`). One per view.
- `FilledButton.tonal`: a secondary action that still needs weight (rare).
- `OutlinedButton(.icon)`: secondary actions next to a filled one.
- `TextButton`: Cancel and low-emphasis actions in dialogs; inline actions in cards.
- Destructive confirm: `FilledButton` with `backgroundColor: scheme.error`, `foregroundColor: scheme.onError` (`showConfirmClearDialog` in `widgets/confirm_clear_dialog.dart`), or a `TextButton` with `foregroundColor: scheme.error` when it is not the primary action.
- Dialog action order: Cancel first, primary last.
- Avoid `ElevatedButton` in new code.
**FAB.** One per screen, for the main "add" action (`contacts_screen.dart`, `channels_screen.dart`) or primary action (`FloatingActionButton.extended` in `themes_screen.dart`, `scanner_screen.dart`). Always give it a `tooltip` or a label.
**IconButton.** Always set `tooltip:` with a localized string. It is the accessible name.
## 6. Sheets, dialogs and pages
What the code does:
| Container | Call | Used for | Examples |
|---|---|---|---|
| Bottom sheet | `showMeshSheet` + `BottomSheetHeader` (28 calls in 17 files) | Choosing from a list, an item's actions, quick tools tied to the current screen | Language picker, notification mode, add contact/channel options, emoji and GIF pickers, node info, share contact, image actions |
| Draggable sheet | `showModalBottomSheet` + `DraggableScrollableSheet` | Tall, scrollable panels that need a drag size | `ContactRoutingSheet` (`routing_sheet.dart`), path editor, image send preview |
| Dialog | `showDialog` + `AlertDialog` (72 calls in 35 files) | Confirming an action, a short input (one to three fields), a short message | Disconnect (`showDisconnectDialog`), clear (`showConfirmClearDialog`), unsaved changes, edit node name, rename point |
| Page | `Navigator.push(MaterialPageRoute(...))` | Anything with sections, many fields, its own save, or that the user stays in | App Settings, Repeater Settings, Themes, Theme editor, Message filter, Region management |
Rules for new UI:
1. **Confirmation or a single short input → dialog.** Title, one sentence, Cancel + one action.
2. **Pick one of several options, or act on one item → sheet.** Use `showMeshSheet` and start the content with `BottomSheetHeader(title:, subtitle:)`. It handles the keyboard and navigation-bar insets. Use raw `showModalBottomSheet` only when you need `DraggableScrollableSheet`.
3. **Forms with sections, live remote values, or anything that needs Save/Discard → page.** Guard unsaved changes with `PopScope` and a discard dialog, as `repeater_settings_screen.dart` does.
4. Never stack a dialog on a sheet on a dialog. Close the sheet first, or move the flow to a page.
## 7. App bars
- Title: a plain localized string, ellipsized on one line. Use `AppBarTitle` on top-level and settings screens; it adds the connected node name as a subtitle and battery/SNR indicators when there is room, dropping them in that order on narrow widths. Use `AdaptiveAppBarTitle` for a plain one-line title.
- Centre the title (`centerTitle: true`, `AGENTS.md`); 31 screens set it explicitly because the theme default is `false`. Chat screens (`chat_screen.dart`, `channel_chat_screen.dart`) deliberately use `centerTitle: false` for their two-line name + route title.
- Actions: at most two icon buttons plus the overflow (`Icons.more_vert`) menu, for example `RadioStatsIconButton`, search, ⋮ in `chat_screen.dart`. Put everything else in the overflow menu.
- Overflow menu order: things about this screen first, then app-level items (Disconnect, Settings), with destructive items last. Destructive items use `MeshMenuItemRow(color: scheme.error)` so both icon and label turn red (Clear chat in `chat_screen.dart`; Clear / Delete channel in `channel_chat_screen.dart`). Use `PopupMenuDivider` between groups.
- Search: tapping search swaps the title for the field and hides all actions (`actions: _searching ? null : [...]`). The leading back arrow and the system back gesture close the search (`PopScope(canPop: !_searching)`) instead of leaving the screen.
- Long operations: show progress as the app bar `bottom` (`SyncProgressAppBarBottom`, or a 4px `LinearProgressIndicator` for Refresh all in `repeater_settings_screen.dart`).
## 8. States
| State | How to show it |
|---|---|
| Loading, nothing to show yet | `Center(child: CircularProgressIndicator())`, only until the first data arrives; then show partial data (`channels_screen.dart`). |
| Loading in place | Swap the control's icon for an 18×18 `CircularProgressIndicator(strokeWidth: 2)` and disable it (`_buildRefreshButton` in `repeater_settings_screen.dart`). |
| Background sync | `SyncProgressAppBarBottom`. |
| Empty | `EmptyState` with an icon, a short title, and an action when there is an obvious next step. Use a separate "no results" state (`Icons.search_off`) when a search or filter hides everything. |
| Error | A snackbar for a failed action. `ErrorRetryCard` for a failed load the user can retry. Never show raw exception text alone. |
| Companion radio disconnected | Main and chat screens stay open, read-only ([offline mode](offline-mode.md)). Decide with `isRadioReadOnly(connector)` / `context.radioReadOnly` (`lib/utils/radio_guard.dart`): disable menu items (`PopupMenuItem(enabled: false)`, drop destructive colors) and buttons, hide FABs, and call `ensureRadioConnected(context)` as the safety net in handlers. The chat composer shows `OfflineComposerBar`. Repeater screens stay open with `RadioDisconnectedBanner` at the top and disable radio-dependent actions. Settings rows that need the radio pass `onTap: null` and show `settings_requiresConnection` as the subtitle (`settings_screen.dart`). |
| Feature unsupported by firmware | Disabled row with a subtitle that says why (`settings_requiresFirmware('v1.10')`). |
| Remote value not fetched yet | See below. |
**Unknown remote values.** A value that lives on a remote node (repeater settings, status) must not look like a real value until it has been fetched or set. `repeater_settings_screen.dart` does this:
- `_known(key)` is true once the value was fetched (`_loadedKeys`) or edited by the user (`_dirtyKeys`).
- Unknown values display as an em dash `—` (sliders' value label, and every `StatTile` value in `repeater_status_screen.dart`); `common_notAvailable` is the localized form.
- `_dimIfUnknown` fades the control to 60 % opacity. It stays usable; changing it makes the value known.
- Unknown switches show off, unknown dropdowns show no selection, and unknown text fields stay empty.
- While nothing is loaded, a card at the top explains this (`repeater_settings_screen.dart`, `repeater_settingsNotLoaded`) with a Refresh all button. Each setting also has its own refresh button.
Follow the same pattern for any new remote-value screen.
## 9. Text and localization
- All user-facing strings go through `context.l10n` (`lib/l10n/l10n.dart`). Add keys to `lib/l10n/app_en.arb` first. No string literals in widgets, including fallbacks.
- Keep strings short: labels are a few words, subtitles one sentence.
- Keep established radio terms in English in every locale: Flood, Zero Hop, hop, SNR, RSSI, LoRa, advert, repeater names and CLI commands.
- Never put text in a fixed-width box (`SizedBox(width: 80, child: Text(...))`). Use `Expanded`/`Flexible`, or let a `Row` wrap into a `Column`/`Wrap` when space runs out.
- Labels must wrap or scale, never clip and never break mid-word:
- Menus: `MeshMenuItemRow` (2 lines, then ellipsis).
- Segmented buttons: `MeshSegmentLabel`.
- Tile titles and subtitles: let them wrap. Set `maxLines` only on lists where height matters, and add `overflow: TextOverflow.ellipsis` with it.
- Do not use `TextOverflow.clip` or `softWrap: false` on translated text.
- Upper-casing is done in code (`SectionHeader`, `StatTile`, `RouteChip`); keep the ARB strings in normal case.
- Test with a long locale (German, Portuguese) and a large system font (at least 1.3×, ideally 2.0×) on a narrow phone (320dp). `test/screens/small_screen_layout_test.dart` checks many screens at 320×568 at 1.0, 1.3 and 2.0× in English; add new screens to it.
## 10. Checklist for a UI change
- [ ] Colours from `colorScheme` or theme extensions; no raw `Colors.*` or `MeshPalette.ink/bg/line` in chrome.
- [ ] Text styles from `textTheme` or `MeshTheme.mono`; nothing below 12.
- [ ] Settings rows use `MeshNavTile` / `SwitchListTile` inside `MeshSettingsTileTheme`; cards are `MeshCard` with a `SectionHeader`.
- [ ] Popup menu rows use `MeshMenuItemRow`; segmented buttons use `MeshSegmentLabel`; destructive menu items last, in `scheme.error`.
- [ ] Every `IconButton` and FAB has a localized `tooltip`.
- [ ] Tap targets at least 48×48.
- [ ] Right container: dialog for confirm/short input, `showMeshSheet` + `BottomSheetHeader` for choices and item actions, page for forms.
- [ ] Loading, empty, error, offline and unknown-value states handled.
- [ ] All strings in `app_en.arb`; checked in German or Portuguese at 1.3× and 2.0× on a narrow screen.
- [ ] Light, dark and one custom theme checked.
- [ ] This page updated if you introduced or changed a pattern.
## 11. Known inconsistencies
The current code does not yet follow this page everywhere:
- **App bar centring.** `MeshTheme._build` sets `centerTitle: false`, but `AGENTS.md` asks for centred titles and 31 screens override it. `contacts_screen.dart` does not, so its title is left-aligned while Channels and Settings are centred.
- **Disconnect placement in overflow menus.** It is the first item in `channels_screen.dart`, but just above Settings in `contacts_screen.dart` and `map_screen.dart`. It tints only the icon (`iconColor`), while Clear chat / Delete tint icon and label (`color`).
- **Menu rows not using `MeshMenuItemRow`.** `channel_chat_screen.dart` bulk-select menu (Select all / Copy) puts a `ListTile` inside `PopupMenuItem`. `widgets/list_filter_widget.dart` and the group menu in `contacts_screen.dart` use plain `Text` items, which is acceptable for icon-less lists but does not limit wrapping.
- **Settings toggles in two sizes.** `FeatureToggleRow` (`widgets/elements_ui.dart`, used in `settings_screen.dart` dialogs) uses a `bodyMedium` w600 title and `bodySmall` subtitle with a 32px refresh button. `MeshNavTile` and themed `SwitchListTile`s use `bodyLarge` w600 / `bodyMedium`. Only App Settings, Message Filter and Repeater Settings wrap their body in `MeshSettingsTileTheme`.
- **`ErrorRetryCard` is unused** and its fallback label is the hard-coded English `'Retry'` (`mesh_ui.dart`); screens show load errors in their own ways.
- **Fixed-width label boxes.** `chat_screen.dart` `_buildInfoRow` (80px), `line_of_sight_map_screen.dart` endpoint label (54px, `fontSize: 12`), `channel_message_path_screen.dart` (72px, upper-cased `accentLabel` at its 11px default).
- **11px text.** `MeshTheme.accentLabel()` without `fontSize` gives 11px in `channel_message_path_screen.dart` and `widgets/path_map_ui.dart` (which also uses dark-only `MeshPalette.ink3`). The type scale's `labelSmall` (11) is used in `list_filter_widget.dart` section titles.
- **Hard-coded colours.** `SyncProgressAppBarBottom` uses `Colors.red`, `Colors.blue` and `Colors.green`; `AppBarTitle` subtitle uses `Colors.grey[600]` at a literal 14 instead of `onSurfaceVariant`; `telemetry_location_map.dart` uses raw `Colors.*`. `MeshPalette.ink/bg/line` appear directly in eight screen/widget files (mostly map panels, where they are intentional; also `channels_screen.dart` and `channel_chat_screen.dart` community dots with an 8px icon).
- **Literal sizes instead of the theme.** About 300 literal `fontSize:` values in `lib/screens` and `lib/widgets` (most 12–14), e.g. `EmptyState` subtitle at 13.5; and 36 `BorderRadius.circular(<number>)` calls (8 and 12 most common) instead of `MeshRadii`.
- **Navigation bar theme.** `navigationBarTheme` colours selected labels `onPrimary`, which is white-on-white in light mode; `QuickSwitchBar` overrides it. Any other `NavigationBar` would inherit the problem.
- **Two badge styles.** `QuickSwitchBar` uses Material `Badge` capped at 99+; `UnreadBadge` caps at 9999+.
- **Sheets without `showMeshSheet`.** Besides the draggable sheets, `chat_background.dart`, `map_screen.dart`, `theme_editor_screen.dart`, `repeater_cli_screen.dart`, `message_translation_button.dart` and `path_map_ui.dart` call `showModalBottomSheet` directly, so they skip the shared inset handling and most skip `BottomSheetHeader`.
- **Large forms in dialogs.** `RadioSettingsDialog` (`widgets/radio_settings_dialog.dart`, nine inputs) and the contact settings dialog in `chat_screen.dart` are dialogs although they behave like forms.
- **Dialog buttons.** `showDisconnectDialog` (`utils/dialog_utils.dart`) uses two `TextButton`s with no emphasis; `showConfirmClearDialog` uses a red `FilledButton`.
- **Snackbars.** A few places still call `ScaffoldMessenger.showSnackBar` directly (`discovery_screen.dart`, `app_settings_screen.dart`, `message_filter_settings_screen.dart`, `region_management_screen.dart`, `helpers/image_send_flow.dart`) and so miss tap-to-dismiss and replace-instead-of-queue.
- **Small tap targets.** `FeatureToggleRow` refresh (32px) and 40px buttons in `chat_screen.dart`, `channel_chat_screen.dart`, `reaction_chips.dart`, `snr_indicator.dart`, `path_map_ui.dart`; 44px in `routing_sheet.dart`, `path_editor_sheet.dart`.
- **Unknown placeholders.** Repeater and companion stats screens use `—`; `line_of_sight_map_screen.dart` uses `--`.
- **Missing tooltip.** The Contacts FAB (`contacts_screen.dart`) has no tooltip; about 18 of 111 `IconButton`s have no tooltip nearby.
- **Stale doc comments.** `SectionHeader` is described as "mono" but uses the sans `accentLabel`; the `StatusChip` comment sits above `meshContrastRatio`.
+1 -1
View File
@@ -27,7 +27,7 @@ The message is then checked in this order. The first check that matches decides,
2. **Text rule**: one of your rules matches the message text.
3. **Repeated characters** (automatic): one character repeated 20 or more times in a row, such as "aaaaaaaaaaaaaaaaaaaa". Digits and spaces don't count, so long numbers (frequencies, coordinates) are safe. Shorter runs, like "Noooooooo!", a `--------` separator or a row of emoji, are ordinary chat and are left alone.
4. **Repeated messages** (automatic):
- The **same sender** sends the same message again, each send within 10 minutes of the previous one. By default the second send is caught; **Sends to count as a repeat** (2–5) lets people re-send a few times first, for example when they see no repeat or reply. This only applies to messages of at least 3 words and 10 characters, because people naturally repeat short replies such as "ok", "yes" or "test".
- The **same sender** sends the same message again, each send within 10 minutes of the previous one. By default the second send is caught; **Sends to count as a repeat** (2–5) lets people re-send a few times first, for example when they see no repeat or reply. This applies to messages of any length, so one word sent over and over, such as "hello", is caught too.
- The **same text from 3 or more different senders** within 30 minutes. This only applies to longer messages, at least 10 characters and at least 6 words, so short greetings such as "Happy New Year!" are never caught.
- Replies and messages that mention someone (`@[name]`) are never checked for repeats, so asking several people the same question is fine.
5. **Learned from your Spam taps** (automatic): a small classifier scores how much the message looks like the messages you marked as spam (see below). It needs at least 2 messages marked as spam, and it hides a message only when it is at least 80% confident.
+8 -8
View File
@@ -6,6 +6,7 @@ The app follows this general flow:
```
Launch → Scanner Screen → [Connect via BLE/USB/TCP] → Channels Screen
Launch (a radio connected before) → Channels Screen (offline until connected)
```
After connecting, the three main screens (Contacts, Channels, Map) are accessible via a persistent bottom navigation bar called the **QuickSwitchBar**.
@@ -24,9 +25,8 @@ Tapping a tab replaces the current screen with a subtle fade + slight horizontal
## Disconnection
- The disconnect button (available in the overflow menu of each main screen) shows a confirmation dialog before disconnecting
- If the device disconnects unexpectedly, the app automatically navigates back to the Scanner screen (fires after the current frame completes via a post-frame callback)
- This auto-navigation behavior (`DisconnectNavigationMixin`) is shared across all main screens
- The disconnect entry in the overflow menu of each main screen shows a confirmation dialog, then leaves you on the same screen, offline. While offline the entry reads **Connect** and opens the connect sheet.
- If the radio disconnects unexpectedly, the screens stay where they are and become read-only; see [offline mode](offline-mode.md).
## Theme and Locale
@@ -37,12 +37,12 @@ Tapping a tab replaces the current screen with a subtle fade + slight horizontal
## Full Navigation Graph
```
ScannerScreen (root, always on stack)
├─ [BLE connect] → push → ChannelsScreen
ScannerScreen (root when no radio is remembered; otherwise pushed from the connect sheet)
├─ [BLE connect] → ChannelsScreen as the only route
├─ [TCP icon button] → push → TcpScreen
│ └─ [TCP connected] → pushReplacement → ChannelsScreen
│ └─ [TCP connected] → ChannelsScreen as the only route
└─ [USB icon button] → push → UsbScreen
└─ [USB connected] → pushReplacement → ChannelsScreen
└─ [USB connected] → ChannelsScreen as the only route
ContactsScreen (selected=0)
├─ [quick-switch 1] → pushReplacement → ChannelsScreen
@@ -70,7 +70,7 @@ Settings (push from any main screen)
└─ [Offline Map Cache] → push → MapCacheScreen
```
Screens using disconnect navigation trigger `popUntil(route.isFirst)`, returning to the Scanner.
A connection made from the scanner, USB, TCP or review mode replaces the whole stack with ChannelsScreen (`navigateToMainAfterConnect`). Leaving the scanner cancels only a Bluetooth connection it started; a pending automatic reconnect is left alone.
## Additional settings destinations
+45
View File
@@ -0,0 +1,45 @@
# Offline Mode
When no radio is connected, the app keeps showing the last radio you connected to, read-only.
## What you see
- **Launch.** If a radio has connected before, the app opens on Channels instead of the scanner. With no remembered radio it opens on the scanner, as before.
- **Contacts, channels, messages, unread counts and the map** show that radio's saved data. Chats open, scroll, search and jump as usual.
- **App bar.** The battery and signal indicators are replaced by a **Connect** button (icon only on narrow screens). The subtitle reads "Offline · *radio name*". While the app is connecting, or a dropped link will be retried, a "Reconnecting…" chip shows instead; tapping it opens the same sheet.
- **Message box.** Each chat replaces the message box with "Connect to a radio to send messages" and a Connect button. Text you typed before the link dropped is kept and comes back when the radio reconnects.
## Connecting
The Connect button and the overflow menu's **Connect** entry (it replaces **Disconnect** while offline) open a sheet with:
- **Reconnect to *name*.** For a Bluetooth or TCP radio. It connects directly, without the scanner. Not offered on web.
- **Choose a radio.** Opens the scanner (Bluetooth, USB or TCP). For a USB radio, or on web, it opens the USB screen.
- **Stop reconnecting.** Shown while an automatic reconnect is pending.
After a connection made from the scanner, USB, TCP or review mode, the app shows Channels as its only screen. Reconnecting from the sheet keeps you on the screen you were on.
**Disconnect** asks for confirmation and then leaves you on the same screen, offline. The app no longer returns to the scanner when a radio disconnects.
## What is available offline
Available: reading, scrolling, opening chats, search and jump, copy, message details and paths, path maps, translating a message for reading, notification mode, chat background, text size, channel region labels, contact groups, app settings, message filter settings, themes and language.
Unavailable (shown disabled or hidden):
- Sending: messages, reactions, replies, resend, GIFs, images, location and contact sharing, map pins.
- Channels: add, edit, delete, join or leave a community, pull to refresh.
- Contacts: add (clipboard, QR, discovered), remove, favourite, share, adverts, path trace, forget path, discovered-contact import/export and delete.
- Repeaters and rooms: login, management and telemetry. Tapping a room opens its saved chat without a login, read-only.
- Region fetching, radio settings and other radio commands in Settings.
- Changing stored history: clear chat, delete messages, bulk delete, mark spam / not spam.
Routing overrides in the routing sheet can still be chosen offline; they are saved on the phone and used on the next send ("Path saved locally").
## Notes
- Notification taps open the saved chat even while offline.
- Only one radio is remembered: the last one that completed a connection. Review mode never replaces it, and the remembered radio's data is shown again when a review session ends.
- Connecting to a different radio replaces the shown data with that radio's.
- The remembered radio is stored in the app-wide preference `last_radio`.
- USB radios cannot be reconnected from the sheet; use **Choose a radio**.
+4 -4
View File
@@ -2,13 +2,13 @@
## BLE Scanner (Home Screen)
The BLE Scanner is the app's home screen, displayed immediately on launch.
The BLE Scanner is the app's home screen until a radio has connected once. After that the app opens on Channels with the last radio's saved data ([offline mode](offline-mode.md)).
### How to Access
- Opens automatically when the app starts
- Returns here when disconnecting from any device
- Accessible by navigating back from a connected session
- Opens automatically when the app starts and no radio is remembered
- From the main screens: **Connect** (app bar or overflow menu) → **Choose a radio**
- Disconnecting no longer returns here; the main screens stay open, read-only
### What the User Sees