Files
meshcore-open/lib/widgets/mesh_nav_tile.dart
T
zjs81 462159e803 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.
2026-11-09 21:18:29 -07:00

148 lines
4.4 KiB
Dart

import 'package:flutter/material.dart';
/// Title style of settings rows: [MeshNavTile] and, through
/// [MeshSettingsTileTheme], stock [ListTile]s and [SwitchListTile]s.
TextStyle? meshTileTitleStyle(ThemeData theme) =>
theme.textTheme.bodyLarge?.copyWith(fontWeight: FontWeight.w600);
/// Gives the [ListTile]s, [SwitchListTile]s and [CheckboxListTile]s below it
/// the same semibold title as [MeshNavTile], so settings rows built from
/// either read alike. Subtitles already match (`bodyMedium`,
/// `onSurfaceVariant`). Wrap a settings screen's body in it.
class MeshSettingsTileTheme extends StatelessWidget {
final Widget child;
const MeshSettingsTileTheme({super.key, required this.child});
@override
Widget build(BuildContext context) {
return ListTileTheme.merge(
titleTextStyle: meshTileTitleStyle(Theme.of(context)),
child: child,
);
}
}
/// Settings-style navigation row: leading icon, bold title, secondary
/// subtitle and an optional trailing chevron.
///
/// Sized for readability (24px icons, `bodyLarge` titles, `bodyMedium`
/// subtitles). When [onTap] is null the row is rendered dimmed and reported
/// as disabled to accessibility services, so a tile that cannot be used never
/// looks identical to one that can.
class MeshNavTile extends StatelessWidget {
final IconData icon;
final String title;
final String? subtitle;
final VoidCallback? onTap;
final Color? titleColor;
final Color? iconColor;
final bool showChevron;
final Widget? trailing;
final int? subtitleMaxLines;
final EdgeInsetsGeometry padding;
const MeshNavTile({
super.key,
required this.icon,
required this.title,
this.subtitle,
this.onTap,
this.titleColor,
this.iconColor,
this.showChevron = true,
this.trailing,
this.subtitleMaxLines,
this.padding = const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final scheme = theme.colorScheme;
final textTheme = theme.textTheme;
final enabled = onTap != null;
final effectiveIconColor = iconColor ?? scheme.onSurfaceVariant;
final row = Row(
children: [
Icon(icon, size: 24, color: effectiveIconColor),
const SizedBox(width: 16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: meshTileTitleStyle(theme)?.copyWith(color: titleColor),
),
if (subtitle != null) ...[
const SizedBox(height: 2),
Text(
subtitle!,
maxLines: subtitleMaxLines,
overflow: subtitleMaxLines == null
? null
: TextOverflow.ellipsis,
style: textTheme.bodyMedium?.copyWith(
color: titleColor != null
? titleColor!.withValues(alpha: 0.8)
: scheme.onSurfaceVariant,
),
),
],
],
),
),
?trailing,
if (showChevron && trailing == null)
Icon(Icons.chevron_right, color: scheme.onSurfaceVariant, size: 24),
],
);
return MergeSemantics(
child: Semantics(
button: true,
enabled: enabled,
child: InkWell(
onTap: onTap,
child: Padding(
padding: padding,
// Dimmed rather than recoloured so warn/alert tints still read as
// such while clearly unavailable.
child: Opacity(opacity: enabled ? 1 : 0.5, child: row),
),
),
),
);
}
}
/// One radio-style option row inside a bottom sheet picker.
class MeshSheetOption extends StatelessWidget {
final String label;
final bool selected;
final VoidCallback onTap;
const MeshSheetOption({
super.key,
required this.label,
required this.selected,
required this.onTap,
});
@override
Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
return ListTile(
leading: Icon(
selected ? Icons.radio_button_checked : Icons.radio_button_unchecked,
size: 24,
color: selected ? scheme.primary : scheme.onSurfaceVariant,
),
title: Text(label),
onTap: onTap,
);
}
}