Merge upstream/dev (22 commits) [upstream-sync]
build / ci-image (push) Successful in 11s
build / build (push) Successful in 26m36s

Conflicts resolved by hand, our fork changes carried over:
- MainActivity.kt: keep the unread widget hooks next to upstream's
  scroll capture (attach and detach both).
- app_settings_screen.dart: upstream wrapped the list in
  MeshSettingsTileTheme; image-message and translation sections stay
  gated on kOnDeviceMl (ML-free build).
- channel_chat_screen.dart: upstream split build() into methods; took
  theirs and re-applied the terminal-theme list padding.
- chat_composer.dart: both imports (terminal_theme, radio_guard).
- mesh_nav_tile.dart: upstream's meshTileTitleStyle, with the smaller
  terminal-theme title kept.

flutter analyze clean, flutter test 1522 passed (CI image, local).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-11-10 15:30:43 +01:00
commit 185d2aca53
210 files changed
+52066 -5541

No files matched your search

+71 -5
View File
@@ -3,6 +3,8 @@ import 'package:meshcore_open/connector/meshcore_connector.dart';
import 'package:meshcore_open/widgets/battery_indicator.dart';
import 'package:provider/provider.dart';
import '../l10n/l10n.dart';
import 'connect_sheet.dart';
import 'radio_stats_entry.dart';
import 'snr_indicator.dart';
@@ -34,11 +36,24 @@ class AppBarTitle extends StatelessWidget {
? constraints.maxWidth
: MediaQuery.sizeOf(context).width;
final compact = availableWidth < 170;
final showSubtitle =
!compact && connector.isConnected && selfName != null && subtitle;
final connected = connector.isConnected;
final reconnecting =
!connected &&
(connector.state == MeshCoreConnectionState.connecting ||
connector.isAutoReconnectScheduled);
final offlineName = connector.lastRadioName;
final subtitleText = !subtitle || compact
? null
: connected
? selfName
: offlineName != null && offlineName.isNotEmpty
? context.l10n.appBar_offlineSubtitle(offlineName)
: context.l10n.appBar_offline;
final showBattery = showBatteryIndicator && availableWidth >= 60;
final showSnr = availableWidth >= 110;
final showIndicators = (showBattery || showSnr) && indicators;
final showIndicators =
connected && (showBattery || showSnr) && indicators;
final showConnect = !connected && indicators;
return Row(
mainAxisAlignment: MainAxisAlignment.start,
@@ -50,9 +65,9 @@ class AppBarTitle extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Text(title, maxLines: 1, overflow: TextOverflow.ellipsis),
if (showSubtitle)
if (subtitleText != null)
Text(
selfName,
subtitleText,
style: TextStyle(fontSize: 14, color: Colors.grey[600]),
maxLines: 1,
overflow: TextOverflow.ellipsis,
@@ -72,6 +87,11 @@ class AppBarTitle extends StatelessWidget {
const RadioStatsIconButton(compact: true),
],
),
if (showConnect) const SizedBox(width: 6),
if (showConnect)
reconnecting
? _ReconnectingChip(compact: availableWidth < 220)
: ConnectButton(iconOnly: availableWidth < 220),
trailing ?? const SizedBox.shrink(),
],
);
@@ -79,3 +99,49 @@ class AppBarTitle extends StatelessWidget {
);
}
}
class _ReconnectingChip extends StatelessWidget {
final bool compact;
const _ReconnectingChip({required this.compact});
@override
Widget build(BuildContext context) {
final label = context.l10n.appBar_reconnecting;
final scheme = Theme.of(context).colorScheme;
const spinner = SizedBox.square(
dimension: 18,
child: CircularProgressIndicator(strokeWidth: 2.5),
);
// Tapping still opens the sheet, which offers "Stop reconnecting".
return Tooltip(
message: label,
child: InkWell(
borderRadius: BorderRadius.circular(24),
onTap: () => showConnectSheet(context),
child: ConstrainedBox(
constraints: const BoxConstraints(minWidth: 48, minHeight: 48),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
spinner,
if (!compact) ...[
const SizedBox(width: 8),
Text(
label,
style: Theme.of(context).textTheme.labelLarge?.copyWith(
color: scheme.onSurfaceVariant,
),
),
],
],
),
),
),
),
);
}
}
+73 -7
View File
@@ -7,7 +7,9 @@ import '../l10n/l10n.dart';
import '../services/app_settings_service.dart';
import '../theme/mesh_theme.dart';
import '../theme/terminal_theme.dart';
import '../utils/radio_guard.dart';
import 'byte_count_input.dart';
import 'connect_sheet.dart';
import 'gif_message.dart';
import 'gif_picker.dart';
import 'mesh_ui.dart';
@@ -117,13 +119,7 @@ class ChatComposer extends StatelessWidget {
for (final action in actions)
PopupMenuItem(
value: action.id,
child: Row(
children: [
Icon(action.icon),
const SizedBox(width: 12),
Flexible(child: Text(action.label)),
],
),
child: MeshMenuItemRow(icon: action.icon, label: action.label),
),
],
);
@@ -134,6 +130,9 @@ class ChatComposer extends StatelessWidget {
@override
Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
// Offline the chat is read-only. The draft stays in [controller] (owned
// by the screen) and is back when the radio reconnects.
if (context.radioReadOnly) return const OfflineComposerBar();
final translation = context
.select<AppSettingsService, (bool, bool, String?)>(
(s) => (
@@ -297,3 +296,70 @@ class ChatComposer extends StatelessWidget {
);
}
}
/// Stands in for the composer while no radio is connected.
class OfflineComposerBar extends StatelessWidget {
const OfflineComposerBar({super.key});
@override
Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
return Container(
decoration: BoxDecoration(
color: scheme.surfaceContainerLow,
border: Border(top: BorderSide(color: scheme.outlineVariant, width: 1)),
),
child: SafeArea(
child: Padding(
padding: const EdgeInsets.fromLTRB(16, 10, 12, 10),
child: LayoutBuilder(
builder: (context, constraints) {
final message = Row(
children: [
Icon(
Icons.cloud_off,
color: scheme.onSurfaceVariant,
size: 24,
),
const SizedBox(width: 12),
Expanded(
child: Text(
context.l10n.chat_composerOffline,
style: Theme.of(
context,
).textTheme.bodyLarge?.copyWith(color: scheme.onSurface),
),
),
],
);
// Side by side when there is room; otherwise the button goes
// under the message so large text never squeezes it.
final roomy =
constraints.maxWidth /
MediaQuery.textScalerOf(context).scale(1) >=
420;
if (roomy) {
return Row(
children: [
Expanded(child: message),
const SizedBox(width: 8),
const ConnectButton(),
],
);
}
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
message,
const SizedBox(height: 8),
const ConnectButton(),
],
);
},
),
),
),
);
}
}
+245
View File
@@ -0,0 +1,245 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../helpers/message_search.dart';
import '../helpers/snack_bar_builder.dart';
import '../l10n/l10n.dart';
import 'chat_day_separator.dart';
import 'empty_state.dart';
/// Results list for "search in this chat". Loads the full history through
/// [loadEntries] (once, cached) and re-filters on each debounced [query].
class ChatSearchResults extends StatefulWidget {
final String query;
final Future<List<ChatSearchEntry>> Function() loadEntries;
final double textScale;
/// Tapping a result: the chat closes search and jumps to the message.
/// Long-pressing one copies its text.
final ValueChanged<ChatSearchEntry>? onSelect;
const ChatSearchResults({
super.key,
required this.query,
required this.loadEntries,
this.textScale = 1.0,
this.onSelect,
});
@override
State<ChatSearchResults> createState() => _ChatSearchResultsState();
}
class _ChatSearchResultsState extends State<ChatSearchResults> {
static const _debounce = Duration(milliseconds: 250);
Timer? _timer;
List<ChatSearchEntry>? _all;
List<ChatSearchEntry> _results = const [];
String _activeQuery = '';
bool _loading = true;
@override
void initState() {
super.initState();
_run(widget.query);
}
@override
void didUpdateWidget(ChatSearchResults oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.query != widget.query) {
_timer?.cancel();
_timer = Timer(_debounce, () => _run(widget.query));
}
}
@override
void dispose() {
_timer?.cancel();
super.dispose();
}
Future<void> _run(String query) async {
setState(() => _loading = true);
List<ChatSearchEntry> all;
try {
all = _all ??= await widget.loadEntries();
} catch (_) {
all = const [];
}
if (!mounted || query != widget.query) return;
setState(() {
_results = searchEntries(all, query);
_activeQuery = query;
_loading = false;
});
}
@override
Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
final scale = widget.textScale;
final needle = normalizeSearchQuery(_activeQuery);
final showEmpty = !_loading && _results.isEmpty;
return Column(
children: [
SizedBox(
height: 3,
child: _loading ? const LinearProgressIndicator() : null,
),
if (!_loading && _results.isNotEmpty)
Padding(
padding: const EdgeInsets.fromLTRB(16, 10, 16, 6),
child: Align(
alignment: Alignment.centerLeft,
child: Text(
context.l10n.chatSearch_resultCount(_results.length),
style: TextStyle(
fontSize: 14 * scale,
fontWeight: FontWeight.w600,
color: scheme.onSurfaceVariant,
),
),
),
),
Expanded(
child: showEmpty
? EmptyState(
icon: Icons.search_off,
title: context.l10n.chatSearch_noResults,
subtitle: context.l10n.chatSearch_noResultsHint,
)
: ListView.separated(
padding: const EdgeInsets.symmetric(vertical: 4),
itemCount: _results.length,
separatorBuilder: (_, _) => Divider(
height: 1,
color: scheme.outlineVariant.withValues(alpha: 0.5),
),
itemBuilder: (context, index) => _ResultRow(
entry: _results[index],
needle: needle,
textScale: scale,
onTap: widget.onSelect == null
? null
: () => widget.onSelect!(_results[index]),
),
),
),
],
);
}
}
class _ResultRow extends StatelessWidget {
final ChatSearchEntry entry;
final String needle;
final double textScale;
final VoidCallback? onTap;
const _ResultRow({
required this.entry,
required this.needle,
required this.textScale,
this.onTap,
});
@override
Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
final s = textScale;
final translated = entry.translatedText;
final body = translated != null && translated.isNotEmpty
? translated
: entry.text;
// Show whichever text actually contains the query.
final shown = body.toLowerCase().contains(needle) ? body : entry.text;
return InkWell(
onTap: onTap,
onLongPress: () async {
await Clipboard.setData(ClipboardData(text: shown));
if (!context.mounted) return;
showDismissibleSnackBar(
context,
content: Text(context.l10n.chat_messageCopied),
);
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(
child: _highlight(
entry.sender,
entry.matchSender ? needle : '',
TextStyle(
fontSize: 14 * s,
fontWeight: FontWeight.w700,
color: scheme.primary,
),
scheme,
),
),
const SizedBox(width: 8),
Text(
'${formatChatDayLabel(context, entry.time)}, '
'${formatChatTime(context, entry.time)}',
style: TextStyle(
fontSize: 12 * s,
color: scheme.onSurfaceVariant,
),
),
],
),
const SizedBox(height: 4),
_highlight(
shown,
needle,
TextStyle(fontSize: 16 * s, color: scheme.onSurface),
scheme,
),
],
),
),
);
}
Widget _highlight(
String text,
String needle,
TextStyle style,
ColorScheme scheme,
) {
if (needle.isEmpty) return Text(text, style: style);
final lower = text.toLowerCase();
// Case folding can change length for exotic characters; skip highlighting
// rather than risk misaligned ranges.
if (lower.length != text.length) return Text(text, style: style);
final spans = <TextSpan>[];
var start = 0;
while (true) {
final at = lower.indexOf(needle, start);
if (at < 0) break;
if (at > start) spans.add(TextSpan(text: text.substring(start, at)));
spans.add(
TextSpan(
text: text.substring(at, at + needle.length),
style: TextStyle(
fontWeight: FontWeight.w800,
backgroundColor: scheme.primaryContainer,
color: scheme.onPrimaryContainer,
),
),
);
start = at + needle.length;
}
if (start < text.length) spans.add(TextSpan(text: text.substring(start)));
return Text.rich(TextSpan(style: style, children: spans));
}
}
+29
View File
@@ -163,6 +163,35 @@ void copyChatMessageText(BuildContext context, String text) {
);
}
/// Asks before deleting [count] selected messages from this device.
Future<bool> confirmBulkDelete(BuildContext context, int count) async {
final result = await showDialog<bool>(
context: context,
builder: (dialogContext) {
final l10n = dialogContext.l10n;
return AlertDialog(
title: Text(l10n.chat_deleteSelectedTitle),
content: Text(l10n.chat_deleteSelectedConfirm(count)),
actions: [
TextButton(
onPressed: () => Navigator.pop(dialogContext, false),
child: Text(l10n.common_cancel),
),
FilledButton(
style: FilledButton.styleFrom(
backgroundColor: Theme.of(dialogContext).colorScheme.error,
foregroundColor: Theme.of(dialogContext).colorScheme.onError,
),
onPressed: () => Navigator.pop(dialogContext, true),
child: Text(l10n.common_delete),
),
],
);
},
);
return result ?? false;
}
/// Asks before clearing a transcript. [message] says what will be erased.
Future<bool> confirmClearChat(
BuildContext context, {
+166
View File
@@ -0,0 +1,166 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../connector/meshcore_connector.dart';
import '../helpers/snack_bar_builder.dart';
import '../l10n/l10n.dart';
import '../screens/scanner_screen.dart';
import '../screens/usb_screen.dart';
import '../storage/last_radio_store.dart';
import '../utils/dialog_utils.dart';
import '../utils/platform_info.dart';
import 'mesh_ui.dart';
/// Ways to get a radio connected: reconnect to the last one, pick another,
/// or stop a pending automatic reconnect.
Future<void> showConnectSheet(BuildContext context) {
return showMeshSheet<void>(
context,
builder: (sheetContext) => _ConnectSheet(hostContext: context),
);
}
class _ConnectSheet extends StatelessWidget {
/// Context of the screen that opened the sheet; it outlives the sheet.
final BuildContext hostContext;
const _ConnectSheet({required this.hostContext});
Future<void> _reconnect(BuildContext context, String name) async {
final connector = context.read<MeshCoreConnector>();
Navigator.of(context).pop();
final connected = await connector.reconnectToLastRadio();
if (connected || !hostContext.mounted) return;
showDismissibleSnackBar(
hostContext,
content: Text(hostContext.l10n.connectSheet_reconnectFailed(name)),
);
}
void _chooseRadio(BuildContext context, LastRadio? lastRadio) {
Navigator.of(context).pop();
if (!hostContext.mounted) return;
final usb =
PlatformInfo.isWeb ||
(lastRadio?.transport == LastRadio.transportUsb &&
PlatformInfo.supportsUsbSerial);
Navigator.of(hostContext).push(
MaterialPageRoute(
builder: (_) => usb ? const UsbScreen() : const ScannerScreen(),
),
);
}
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
final textTheme = Theme.of(context).textTheme;
final connector = context.watch<MeshCoreConnector>();
final lastRadio = connector.lastRadio;
final name = connector.lastRadioName ?? '';
final connecting = connector.state == MeshCoreConnectionState.connecting;
final canReconnect =
!PlatformInfo.isWeb &&
lastRadio != null &&
name.isNotEmpty &&
(lastRadio.canReconnectBle || lastRadio.canReconnectTcp);
final titleStyle = textTheme.titleMedium;
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
BottomSheetHeader(title: l10n.connectSheet_title),
if (canReconnect)
ListTile(
minTileHeight: 64,
leading: connecting
? const SizedBox.square(
dimension: 28,
child: CircularProgressIndicator(strokeWidth: 3),
)
: Icon(
lastRadio.canReconnectTcp ? Icons.lan : Icons.bluetooth,
size: 28,
),
title: Text(l10n.connectSheet_reconnect(name), style: titleStyle),
enabled: !connecting,
onTap: () => _reconnect(context, name),
),
ListTile(
minTileHeight: 64,
leading: const Icon(Icons.radio, size: 28),
title: Text(l10n.connectSheet_chooseRadio, style: titleStyle),
subtitle: Text(l10n.connectSheet_chooseRadioSubtitle),
onTap: () => _chooseRadio(context, lastRadio),
),
if (connector.isAutoReconnectScheduled)
ListTile(
minTileHeight: 64,
leading: const Icon(Icons.sync_disabled, size: 28),
title: Text(l10n.connectSheet_stopReconnecting, style: titleStyle),
onTap: () {
connector.cancelAutoReconnect();
Navigator.of(context).pop();
},
),
const SizedBox(height: 12),
],
);
}
}
/// Compact Connect button for app bars and read-only bars.
class ConnectButton extends StatelessWidget {
/// Icon only, for narrow app bars.
final bool iconOnly;
const ConnectButton({super.key, this.iconOnly = false});
@override
Widget build(BuildContext context) {
final label = context.l10n.common_connect;
if (iconOnly) {
return IconButton(
icon: const Icon(Icons.link),
tooltip: label,
onPressed: () => showConnectSheet(context),
);
}
return FilledButton.tonalIcon(
style: FilledButton.styleFrom(
minimumSize: const Size(48, 48),
padding: const EdgeInsets.symmetric(horizontal: 14),
visualDensity: VisualDensity.standard,
),
icon: const Icon(Icons.link, size: 20),
label: Text(label),
onPressed: () => showConnectSheet(context),
);
}
}
/// Overflow-menu entry of the main screens: Disconnect (after confirming,
/// staying on the screen offline) while connected, Connect otherwise.
/// [screenContext] must outlive the menu, as onTap runs after it closes.
PopupMenuItem<T> connectionMenuItem<T>(
BuildContext screenContext,
BuildContext menuContext,
) {
final connector = screenContext.read<MeshCoreConnector>();
final l10n = menuContext.l10n;
if (connector.isConnected) {
return PopupMenuItem<T>(
child: MeshMenuItemRow(
icon: Icons.logout,
iconColor: Theme.of(menuContext).colorScheme.error,
label: l10n.common_disconnect,
),
onTap: () => showDisconnectDialog(screenContext, connector),
);
}
return PopupMenuItem<T>(
child: MeshMenuItemRow(icon: Icons.link, label: l10n.common_connect),
onTap: () => showConnectSheet(screenContext),
);
}
+42 -3
View File
@@ -16,12 +16,32 @@ Duration holidayAnimationDuration(HolidayAnimation animation) =>
HolidayAnimation.newYear => const Duration(milliseconds: 5600),
};
/// Quiet time after a holiday animation ends before another may start.
const Duration holidayAnimationMinInterval = Duration(seconds: 5);
/// Clock for the rate limit; tests replace it.
@visibleForTesting
DateTime Function() holidayAnimationClock = DateTime.now;
OverlayEntry? _activeHolidayEntry;
DateTime? _holidayQuietUntil;
/// Forgets the playing animation and the quiet period (tests only).
@visibleForTesting
void resetHolidayAnimationGate() {
_activeHolidayEntry = null;
_holidayQuietUntil = null;
}
/// Plays [animation] over the whole screen, starting from [origin] (global
/// coordinates of the message it came from). Touches pass through, and the
/// overlay removes itself when done.
///
/// Skipped when the user turned holiday animations off or the platform asks
/// for reduced motion.
/// Skipped when the user turned holiday animations off, the platform asks
/// for reduced motion, another holiday animation is still playing, or the
/// last one ended less than [holidayAnimationMinInterval] ago (so a burst of
/// greetings plays once instead of piling up). Skipped animations are
/// dropped, not queued.
void playHolidayAnimation(
BuildContext context,
HolidayAnimation animation, {
@@ -30,6 +50,11 @@ void playHolidayAnimation(
final settings = context.read<AppSettingsService>().settings;
if (!settings.holidayAnimationsEnabled) return;
if (MediaQuery.maybeDisableAnimationsOf(context) ?? false) return;
// Unmounted when it finished or its overlay went away.
if (_activeHolidayEntry?.mounted ?? false) return;
final now = holidayAnimationClock();
final quietUntil = _holidayQuietUntil;
if (quietUntil != null && now.isBefore(quietUntil)) return;
final overlay = Overlay.maybeOf(context, rootOverlay: true);
if (overlay == null) return;
late final OverlayEntry entry;
@@ -37,9 +62,23 @@ void playHolidayAnimation(
builder: (_) => HolidayAnimationView(
animation: animation,
origin: origin,
onDone: () => entry.remove(),
onDone: () {
if (identical(_activeHolidayEntry, entry)) {
_activeHolidayEntry = null;
_holidayQuietUntil = holidayAnimationClock().add(
holidayAnimationMinInterval,
);
}
entry.remove();
},
),
);
_activeHolidayEntry = entry;
// Until it reports its end: the end it should reach, plus the quiet time,
// in case the overlay goes away without finishing it.
_holidayQuietUntil = now
.add(holidayAnimationDuration(animation))
.add(holidayAnimationMinInterval);
overlay.insert(entry);
}
+3 -2
View File
@@ -9,6 +9,7 @@ import '../l10n/l10n.dart';
import '../services/image_chunk_transport.dart';
import '../utils/lora_airtime.dart';
import 'image_send_codec_binding.dart';
import 'mesh_ui.dart';
/// Estimated wall clock above which the sheet warns the user explicitly.
const Duration kImageSendLongAirtime = Duration(seconds: 5);
@@ -426,11 +427,11 @@ class _ImageSendPreviewSheetState extends State<ImageSendPreviewSheet> {
segments: [
ButtonSegment(
value: false,
label: Text(l10n.imageSend_viewOriginal),
label: MeshSegmentLabel(l10n.imageSend_viewOriginal),
),
ButtonSegment(
value: true,
label: Text(l10n.imageSend_viewReconstruction),
label: MeshSegmentLabel(l10n.imageSend_viewReconstruction),
enabled: _encoded != null && !_reconstructionUnavailable,
),
],
+2
View File
@@ -20,11 +20,13 @@ final List<(String?, String Function(AppLocalizations))> appLanguageOptions = [
('pl', (l) => l.appSettings_languagePl),
('sl', (l) => l.appSettings_languageSl),
('pt', (l) => l.appSettings_languagePt),
('pt_PT', (l) => l.appSettings_languagePtPt),
('it', (l) => l.appSettings_languageIt),
('zh', (l) => l.appSettings_languageZh),
('sv', (l) => l.appSettings_languageSv),
('nl', (l) => l.appSettings_languageNl),
('sk', (l) => l.appSettings_languageSk),
('cs', (l) => l.appSettings_languageCs),
('bg', (l) => l.appSettings_languageBg),
('ru', (l) => l.appSettings_languageRu),
('uk', (l) => l.appSettings_languageUk),
+30 -2
View File
@@ -2,6 +2,29 @@ import 'package:flutter/material.dart';
import '../theme/terminal_theme.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.
///
@@ -55,8 +78,13 @@ class MeshNavTile extends StatelessWidget {
children: [
Text(
title,
style: (terminal ? textTheme.bodyMedium : textTheme.bodyLarge)
?.copyWith(fontWeight: FontWeight.w600, color: titleColor),
style:
(terminal
? textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.w600,
)
: meshTileTitleStyle(theme))
?.copyWith(color: titleColor),
),
if (subtitle != null) ...[
const SizedBox(height: 2),
+310 -1
View File
@@ -1,6 +1,7 @@
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import '../l10n/l10n.dart';
@@ -13,7 +14,8 @@ import '../theme/theme_icons.dart';
/// Building blocks used across all screens so the app reads as one product:
/// [SectionHeader], [MeshCard], [StatusChip], [StatTile], [AvatarCircle],
/// [SignalBars], [RouteChip], [PulseDot], [BottomSheetHeader] +
/// [showMeshSheet], [ErrorRetryCard], and [ListEntrance].
/// [showMeshSheet], [ErrorRetryCard], [ListEntrance], [MeshSegmentLabel]
/// and [MeshMenuItemRow].
/// Small-caps mono section label, optionally with a trailing widget.
class SectionHeader extends StatelessWidget {
@@ -788,3 +790,310 @@ class _ListEntranceState extends State<ListEntrance>
);
}
}
/// Contents of a [PopupMenuItem]: a 20px icon, a 12px gap and a label that
/// wraps to at most [maxLines] lines and then ends in an ellipsis, so long
/// translations are never clipped at the menu edge.
///
/// Pass an [icon], or a [leading] widget for custom icons (sized 20). With
/// neither, a 20px gap keeps the label aligned with rows that have one.
/// [color] tints icon and label (e.g. red for a destructive action);
/// [iconColor] tints only the icon. [selected] bolds the label, for menus
/// that mark the current choice.
class MeshMenuItemRow extends StatelessWidget {
final IconData? icon;
final Widget? leading;
final String label;
final Color? color;
final Color? iconColor;
final bool selected;
final int maxLines;
const MeshMenuItemRow({
super.key,
this.icon,
this.leading,
required this.label,
this.color,
this.iconColor,
this.selected = false,
this.maxLines = 2,
});
@override
Widget build(BuildContext context) {
final effectiveIconColor = iconColor ?? color;
return Row(
children: [
IconTheme.merge(
data: IconThemeData(size: 20, color: effectiveIconColor),
child: SizedBox(
width: 20,
child:
leading ??
(icon == null
? null
: Icon(icon, size: 20, color: effectiveIconColor)),
),
),
const SizedBox(width: 12),
Flexible(
child: Text(
label,
maxLines: maxLines,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: color,
fontWeight: selected ? FontWeight.bold : null,
),
),
),
],
);
}
}
/// Label for a [ButtonSegment] that never breaks a word in the middle.
///
/// Uses the button's text style. If the label does not fit on one line it is
/// scaled down, but not below [minFontSize] (before the user's text scale).
/// Below that, a multi-word label wraps at word boundaries onto up to
/// [maxLines] centred lines, shrunk just enough for its longest word to fit.
/// A single word that still does not fit keeps shrinking on one line, as
/// splitting or clipping it would be harder to read than smaller text.
class MeshSegmentLabel extends LeafRenderObjectWidget {
final String text;
final double minFontSize;
final int maxLines;
const MeshSegmentLabel(
this.text, {
super.key,
this.minFontSize = 12,
this.maxLines = 2,
});
TextStyle _style(BuildContext context) {
final style = DefaultTextStyle.of(context).style;
return MediaQuery.boldTextOf(context)
? style.merge(const TextStyle(fontWeight: FontWeight.bold))
: style;
}
@override
RenderObject createRenderObject(BuildContext context) {
return _RenderSegmentLabel(
text: text,
style: _style(context),
textScaler: MediaQuery.textScalerOf(context),
textDirection: Directionality.of(context),
minFontSize: minFontSize,
maxLines: maxLines,
);
}
@override
void updateRenderObject(BuildContext context, RenderObject renderObject) {
(renderObject as _RenderSegmentLabel)
..text = text
..style = _style(context)
..textScaler = MediaQuery.textScalerOf(context)
..textDirection = Directionality.of(context)
..minFontSize = minFontSize
..maxLines = maxLines;
}
}
class _RenderSegmentLabel extends RenderBox {
_RenderSegmentLabel({
required String text,
required TextStyle style,
required TextScaler textScaler,
required TextDirection textDirection,
required double minFontSize,
required int maxLines,
}) : _text = text,
_style = style,
_textScaler = textScaler,
_textDirection = textDirection,
_minFontSize = minFontSize,
_maxLines = maxLines;
final TextPainter _painter = TextPainter(textAlign: TextAlign.center);
String _text;
set text(String value) {
if (value == _text) return;
_text = value;
markNeedsLayout();
markNeedsSemanticsUpdate();
}
TextStyle _style;
set style(TextStyle value) {
if (value == _style) return;
_style = value;
// Layout even for a colour-only change: the painter takes the new style
// (the selected or disabled colour) in _fit, not in paint.
markNeedsLayout();
}
@visibleForTesting
Color? get debugPaintedColor => _painter.text?.style?.color;
TextScaler _textScaler;
set textScaler(TextScaler value) {
if (value == _textScaler) return;
_textScaler = value;
markNeedsLayout();
}
TextDirection _textDirection;
set textDirection(TextDirection value) {
if (value == _textDirection) return;
_textDirection = value;
markNeedsLayout();
markNeedsSemanticsUpdate();
}
double _minFontSize;
set minFontSize(double value) {
if (value == _minFontSize) return;
_minFontSize = value;
markNeedsLayout();
}
int _maxLines;
set maxLines(int value) {
if (value == _maxLines) return;
_maxLines = value;
markNeedsLayout();
}
double get _fontSize => _style.fontSize ?? 14;
/// [_textScaler] further multiplied by [factor].
TextScaler _scaled(double factor) {
if (factor >= 1) return _textScaler;
return TextScaler.linear(_textScaler.scale(_fontSize) * factor / _fontSize);
}
double _lineWidth(TextPainter painter, String text, TextScaler scaler) {
painter
..text = TextSpan(text: text, style: _style)
..textDirection = _textDirection
..textScaler = scaler
..maxLines = 1
..ellipsis = null
..layout();
return painter.width;
}
/// Configures [painter] for [maxWidth] and lays it out.
void _fit(TextPainter painter, double maxWidth) {
final full = _lineWidth(painter, _text, _textScaler);
var factor = 1.0;
var lines = 1;
if (full > maxWidth) {
// A little slack: glyph metrics do not scale exactly linearly.
final fitFactor = maxWidth / full * 0.98;
final floor = math.min(1.0, _minFontSize / _fontSize);
final words = _text.trim().split(RegExp(r'\s+'));
if (fitFactor >= floor || words.length < 2) {
factor = fitFactor;
} else {
final longest = words
.map((w) => _lineWidth(painter, w, _textScaler))
.reduce(math.max);
factor = math.min(1.0, maxWidth / longest * 0.98);
lines = _maxLines;
}
}
painter
..text = TextSpan(text: _text, style: _style)
..textDirection = _textDirection
..textScaler = _scaled(factor)
..maxLines = lines
..ellipsis = '\u2026'
..layout(maxWidth: maxWidth);
}
double _intrinsicHeight(double width) {
final painter = TextPainter(textAlign: TextAlign.center);
_fit(painter, width);
final height = painter.height;
painter.dispose();
return height;
}
@override
double computeMinIntrinsicWidth(double height) {
final painter = TextPainter();
final floor = math.min(1.0, _minFontSize / _fontSize);
final longest = _text
.trim()
.split(RegExp(r'\s+'))
.map((w) => _lineWidth(painter, w, _scaled(floor)))
.reduce(math.max);
painter.dispose();
return longest.ceilToDouble();
}
@override
double computeMaxIntrinsicWidth(double height) {
final painter = TextPainter();
final width = _lineWidth(painter, _text, _textScaler);
painter.dispose();
return width.ceilToDouble();
}
@override
double computeMinIntrinsicHeight(double width) => _intrinsicHeight(width);
@override
double computeMaxIntrinsicHeight(double width) => _intrinsicHeight(width);
@override
Size computeDryLayout(covariant BoxConstraints constraints) {
final painter = TextPainter(textAlign: TextAlign.center);
_fit(painter, constraints.maxWidth);
final size = constraints.constrain(painter.size);
painter.dispose();
return size;
}
Offset get _paintOffset => Offset(
(size.width - _painter.width) / 2,
(size.height - _painter.height) / 2,
);
@override
void performLayout() {
_fit(_painter, constraints.maxWidth);
size = constraints.constrain(_painter.size);
}
@override
double? computeDistanceToActualBaseline(TextBaseline baseline) {
return _paintOffset.dy + _painter.computeDistanceToActualBaseline(baseline);
}
@override
void paint(PaintingContext context, Offset offset) {
_painter.paint(context.canvas, offset + _paintOffset);
}
@override
void describeSemanticsConfiguration(SemanticsConfiguration config) {
super.describeSemanticsConfiguration(config);
config
..label = _text
..textDirection = _textDirection;
}
@override
void dispose() {
_painter.dispose();
super.dispose();
}
}
+87 -40
View File
@@ -25,6 +25,9 @@ class NetworkMapOnlineController extends ChangeNotifier {
final NetworkMapApiClient _client;
final LayerHitNotifier<NetworkMapRepeater> hitNotifier = ValueNotifier(null);
final LayerHitNotifier<NetworkMapRepeater> dotHitNotifier = ValueNotifier(
null,
);
List<NetworkMapRepeater> _repeaters = const [];
List<NetworkMapLink> _links = const [];
@@ -98,6 +101,7 @@ class NetworkMapOnlineController extends ChangeNotifier {
_disposed = true;
_timer?.cancel();
hitNotifier.dispose();
dotHitNotifier.dispose();
_client.close();
super.dispose();
}
@@ -117,6 +121,16 @@ const int networkMapDenseNodeCount = 30;
/// Above this many in-view links, each line is one stroke at half width
const int networkMapDenseLinkCount = 70;
/// Above this many in-view repeaters, each is painted as a plain dot in one
/// layer instead of its own marker widget. A zoomed-out view of a dense mesh
/// (e.g. Moscow) holds thousands of repeaters; one widget subtree each was
/// enough to run mid-range phones out of memory and crash the app.
const int networkMapMarkerWidgetLimit = 250;
/// Above this many in-view links, links are not drawn at all until the user
/// zooms in; thousands of overlapping lines are unreadable and costly.
const int networkMapMaxLinkCount = 1500;
/// Full style is a 3.5 px confirmed stroke or a 2.5 px unconfirmed stroke,
/// each with a 1 px border. Simple style keeps the pattern and drops the
/// border, so the painter records the line once, at half the stroke width.
@@ -126,9 +140,13 @@ Polyline _onlineLinkPolyline(NetworkMapLink link, {required bool simple}) {
return Polyline(
points: [link.aCell.center, link.bCell.center],
strokeWidth: simple ? strokeWidth / 2 : strokeWidth,
color: MapPalette.router.withValues(alpha: confirmed ? 0.85 : 0.6),
// Keep links opaque. flutter_map draws a translucent line that also has
// a border through a full-viewport saveLayer, once per line; with dozens
// of links that exhausted GPU memory and crashed the Impeller (Vulkan)
// raster thread in Canvas::DrawLine on Android.
color: MapPalette.router,
borderStrokeWidth: simple ? 0 : 1,
borderColor: MapPalette.markerOutline.withValues(alpha: 0.7),
borderColor: MapPalette.markerOutline,
pattern: confirmed
? const StrokePattern.solid()
: StrokePattern.dashed(segments: const [10, 8]),
@@ -151,12 +169,18 @@ List<Widget> buildNetworkMapOnlineLayers({
final visibleKeys = {for (final repeater in visibleRepeaters) repeater.key};
final links = [
for (final link in controller.links)
if (visibleKeys.contains(link.a) && visibleKeys.contains(link.b)) link,
if (visibleKeys.contains(link.a) &&
visibleKeys.contains(link.b) &&
// Both ends in one cell: a zero-length line draws nothing useful
// and is a degenerate stroke for the renderer.
link.aCell.center != link.bCell.center)
link,
];
final dropHexagons = visibleRepeaters.length > networkMapDenseNodeCount;
final simpleLines = links.length > networkMapDenseLinkCount;
final useDots = visibleRepeaters.length > networkMapMarkerWidgetLimit;
return [
if (showLinks)
if (showLinks && links.length <= networkMapMaxLinkCount)
PolylineLayer(
polylines: [
for (final link in links)
@@ -191,46 +215,69 @@ List<Widget> buildNetworkMapOnlineLayers({
],
),
),
MarkerLayer(
markers: [
for (final repeater in visibleRepeaters)
if (!localMarkerKeys.contains(repeater.key))
Marker(
point: repeater.cell.center,
width: 34,
height: 34,
child: GestureDetector(
onTap: () => onTap(repeater),
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: networkMapStatusColor(repeater.status),
border: Border.all(
color: MapPalette.markerOutline,
width: 2.5,
if (useDots)
GestureDetector(
onTap: () {
final hits = controller.dotHitNotifier.value?.hitValues;
if (hits != null && hits.isNotEmpty) onTap(hits.first);
},
child: CircleLayer<NetworkMapRepeater>(
hitNotifier: controller.dotHitNotifier,
circles: [
for (final repeater in visibleRepeaters)
if (!localMarkerKeys.contains(repeater.key))
CircleMarker<NetworkMapRepeater>(
point: repeater.cell.center,
radius: 7,
color: networkMapStatusColor(repeater.status),
borderColor: MapPalette.markerOutline,
borderStrokeWidth: 1.5,
hitValue: repeater,
),
],
),
)
else
MarkerLayer(
markers: [
for (final repeater in visibleRepeaters)
if (!localMarkerKeys.contains(repeater.key))
Marker(
point: repeater.cell.center,
width: 34,
height: 34,
child: GestureDetector(
onTap: () => onTap(repeater),
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: networkMapStatusColor(repeater.status),
border: Border.all(
color: MapPalette.markerOutline,
width: 2.5,
),
boxShadow: dropHexagons
? null
: const [
BoxShadow(
color: MapPalette.markerShadow,
blurRadius: 6,
offset: Offset(0, 2),
),
],
),
child: Icon(
repeater.type == advTypeRoom
? Icons.meeting_room
: Icons.router,
color: MapPalette.markerOutline,
size: 20,
),
boxShadow: dropHexagons
? null
: const [
BoxShadow(
color: MapPalette.markerShadow,
blurRadius: 6,
offset: Offset(0, 2),
),
],
),
child: Icon(
repeater.type == advTypeRoom
? Icons.meeting_room
: Icons.router,
color: MapPalette.markerOutline,
size: 20,
),
),
),
),
],
),
],
),
];
}
+108 -51
View File
@@ -304,6 +304,11 @@ class PathMapBottomPanel extends StatelessWidget {
final Widget? summary;
final Widget hopList;
/// Grows the panel to the full map height so the hop list is readable when
/// the map is of little use (e.g. repeaters without locations).
final bool expanded;
final VoidCallback? onToggleExpanded;
const PathMapBottomPanel({
super.key,
required this.header,
@@ -322,6 +327,8 @@ class PathMapBottomPanel extends StatelessWidget {
required this.hopRowCount,
required this.summary,
required this.hopList,
this.expanded = false,
this.onToggleExpanded,
});
@override
@@ -330,9 +337,10 @@ class PathMapBottomPanel extends StatelessWidget {
final maxHeight =
MediaQuery.of(context).size.height * (combined ? 0.45 : 0.35);
const hopRowHeight = 60.0;
final isExpanded = expanded && !collapsed && onToggleExpanded != null;
double? cardHeight;
if (!collapsed) {
if (!collapsed && !isExpanded) {
final summaryHeight = combined ? 34.0 + pathCount * 40.0 : 0.0;
final noteHeight = showNoSelfGpsNote ? 22.0 : 0.0;
final estimatedHeight =
@@ -347,6 +355,7 @@ class PathMapBottomPanel extends StatelessWidget {
left: 16,
right: 16,
bottom: 16,
top: isExpanded ? 16 : null,
child: SizedBox(
height: cardHeight,
child: Container(
@@ -380,66 +389,95 @@ class PathMapBottomPanel extends StatelessWidget {
children: [
ConstrainedBox(
constraints: BoxConstraints(
maxHeight: max(
0.0,
constraints.maxHeight -
(collapsed ? 0.0 : hopRowHeight + 1.0),
),
maxHeight: isExpanded
? constraints.maxHeight * 0.4
: max(
0.0,
constraints.maxHeight -
(collapsed
? 0.0
: hopRowHeight + 1.0),
),
),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(
12,
8,
4,
0,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
header,
const SizedBox(height: 4),
PathMiniLegend(
combined: combined,
showInferred:
showInferredLegend,
GestureDetector(
behavior: HitTestBehavior.translucent,
onVerticalDragEnd: (details) =>
_handleHeaderDrag(
details.primaryVelocity ?? 0,
isExpanded,
),
child: Padding(
padding: const EdgeInsets.fromLTRB(
12,
8,
4,
0,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
header,
const SizedBox(height: 4),
PathMiniLegend(
combined: combined,
showInferred:
showInferredLegend,
),
],
),
),
if (onToggleExpanded != null &&
!collapsed)
IconButton(
icon: Icon(
isExpanded
? Icons.close_fullscreen
: Icons.open_in_full,
),
],
color: MeshPalette.ink,
tooltip: isExpanded
? l10n.pathMap_showMap
: l10n.pathMap_expandHopList,
onPressed: onToggleExpanded,
),
IconButton(
icon: Icon(
collapsed
? Icons.expand_less
: Icons.expand_more,
),
color: MeshPalette.ink,
tooltip: collapsed
? l10n.pathMap_expandPanel
: l10n.pathMap_collapsePanel,
onPressed: onToggleCollapsed,
),
),
IconButton(
icon: Icon(
collapsed
? Icons.expand_less
: Icons.expand_more,
),
color: MeshPalette.ink,
tooltip: collapsed
? l10n.pathMap_expandPanel
: l10n.pathMap_collapsePanel,
onPressed: onToggleCollapsed,
),
],
],
),
),
),
PathAnimationControls(
playback: playback,
selected: selected,
animationEnabled: animationEnabled,
onToggleAnimation: onToggleAnimation,
followEnabled: followEnabled,
onToggleFollow: onToggleFollow,
),
// The map is covered while expanded, so
// the animation controls are pointless.
if (!isExpanded)
PathAnimationControls(
playback: playback,
selected: selected,
animationEnabled: animationEnabled,
onToggleAnimation: onToggleAnimation,
followEnabled: followEnabled,
onToggleFollow: onToggleFollow,
),
if (!collapsed) ...[
if (showNoSelfGpsNote)
Padding(
@@ -503,4 +541,23 @@ class PathMapBottomPanel extends StatelessWidget {
),
);
}
/// Swipe up on the header grows the panel (collapsed -> normal ->
/// expanded); swipe down shrinks it the other way.
void _handleHeaderDrag(double velocity, bool isExpanded) {
const minVelocity = 150.0;
if (velocity < -minVelocity) {
if (collapsed) {
onToggleCollapsed();
} else if (!isExpanded) {
onToggleExpanded?.call();
}
} else if (velocity > minVelocity) {
if (isExpanded) {
onToggleExpanded?.call();
} else if (!collapsed) {
onToggleCollapsed();
}
}
}
}
+3 -2
View File
@@ -7,6 +7,7 @@ import '../l10n/l10n.dart';
import '../models/display_path.dart';
import '../models/path_playback.dart';
import '../theme/mesh_theme.dart';
import 'mesh_ui.dart';
/// Shared UI for the path map screens (live path trace and received-message
/// path map): packet-flow animation overlays, single/combined view toggle,
@@ -319,11 +320,11 @@ class PathViewModeToggle extends StatelessWidget {
segments: [
ButtonSegment(
value: PathViewMode.single,
label: Text(l10n.pathMap_viewSingle),
label: MeshSegmentLabel(l10n.pathMap_viewSingle),
),
ButtonSegment(
value: PathViewMode.combined,
label: Text(l10n.pathMap_viewCombined),
label: MeshSegmentLabel(l10n.pathMap_viewCombined),
),
],
selected: {mode},
+2
View File
@@ -8,6 +8,7 @@ import '../helpers/snack_bar_builder.dart';
import '../l10n/l10n.dart';
import '../models/radio_settings.dart';
import '../services/app_debug_log_service.dart';
import '../utils/radio_guard.dart';
/// Convert device coding-rate value (1-4 on some firmware, 5-8 on others)
/// to the UI enum range (always 5-8).
@@ -382,6 +383,7 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
}
Future<void> _saveSettings() async {
if (!ensureRadioConnected(context)) return;
final l10n = context.l10n;
final freqMHz = double.tryParse(_frequencyController.text);
final txPower = int.tryParse(_txPowerController.text);
+14 -9
View File
@@ -73,15 +73,20 @@ class _RadioStatsIconButtonState extends State<RadioStatsIconButton> {
),
);
}
return Tooltip(
message: context.l10n.radioStats_tooltip,
child: InkWell(
customBorder: const CircleBorder(),
onTap: () => pushCompanionRadioStatsScreen(context),
child: SizedBox(
width: 48,
height: 48,
child: Center(child: dot),
// The gap after the dot keeps it from crowding the next app bar
// action; it is outside the tap target, which stays 48px.
return Padding(
padding: const EdgeInsetsDirectional.only(end: 8),
child: Tooltip(
message: context.l10n.radioStats_tooltip,
child: InkWell(
customBorder: const CircleBorder(),
onTap: () => pushCompanionRadioStatsScreen(context),
child: SizedBox(
width: 48,
height: 48,
child: Center(child: dot),
),
),
),
);
+54 -43
View File
@@ -33,15 +33,17 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
import '../l10n/app_localizations.dart';
import '../l10n/l10n.dart';
import '../services/received_image_store.dart';
import 'image_send_codec_binding.dart' show ImageCodecAvailability;
/// User-visible strings for the NON-decoded states.
///
/// Exists so the wiring agent can hand in `AppLocalizations` values once the
/// `receivedImage_*` ARB keys land (they do not exist yet, so English defaults
/// ship inline). Deliberately contains no field for the R6 badge or caption:
/// those must not be overridable, shortenable or blankable.
/// Built from `AppLocalizations` by [ReceivedImageStrings.of]; the widget does
/// that itself when no [ReceivedImageMessage.strings] override is passed.
/// Deliberately contains no field for the R6 badge or caption: those must not
/// be overridable, shortenable or blankable.
@immutable
class ReceivedImageStrings {
final String Function(int received, int total) incoming;
@@ -67,11 +69,8 @@ class ReceivedImageStrings {
required this.incoming,
required this.queued,
required this.tapToDecode,
// Optional on purpose: `channel_chat_screen.dart` builds this object and is
// owned by another workstream, so the two tap-to-process strings must not
// break that call site before the `receivedImage_*` ARB keys land.
this.awaiting = _defaultAwaiting,
this.tapToProcess = 'Tap to process',
required this.awaiting,
required this.tapToProcess,
required this.decoding,
required this.incomplete,
required this.corrupt,
@@ -82,41 +81,52 @@ class ReceivedImageStrings {
required this.openSettings,
});
// TODO(l10n): replace with context.l10n.receivedImage_* once app_en.arb has
// the keys listed in section 5(k) of the receive spec.
static ReceivedImageStrings english = ReceivedImageStrings(
incoming: (received, total) => '$received of $total packets',
queued: 'Waiting to decode',
tapToDecode: 'Tap to decode',
awaiting: _defaultAwaiting,
tapToProcess: 'Tap to process',
decoding: 'Reconstructing… about 1 s',
incomplete: (received, total) =>
'Image incomplete — $received of $total packets arrived',
corrupt: 'Image could not be reconstructed',
decoderMissing: 'Image received — image decoding is off',
evicted: 'Image no longer stored',
retry: 'Try again',
decodeAgain: 'Decode again',
openSettings: 'Set up',
);
/// The app's `receivedImage_*` strings for [l10n]'s locale.
factory ReceivedImageStrings.of(AppLocalizations l10n) =>
ReceivedImageStrings(
incoming: l10n.receivedImage_incoming,
queued: l10n.receivedImage_queued,
tapToDecode: l10n.receivedImage_tapToDecode,
awaiting: l10n.receivedImage_awaiting,
tapToProcess: l10n.receivedImage_tapToProcess,
decoding: l10n.receivedImage_decoding,
incomplete: l10n.receivedImage_incomplete,
corrupt: l10n.receivedImage_corrupt,
decoderMissing: l10n.receivedImage_decoderMissing,
evicted: l10n.receivedImage_evicted,
retry: l10n.receivedImage_retry,
decodeAgain: l10n.receivedImage_decodeAgain,
openSettings: l10n.receivedImage_openSettings,
);
}
/// English default for [ReceivedImageStrings.awaiting]. A top-level function so
/// it can be a `const` default value on the constructor.
String _defaultAwaiting(int bytes, int packets) =>
'$bytes bytes · $packets packets';
/// The R6 label texts, localised but never injectable and never empty.
///
/// Resolved inside the private R6 widgets from the widget tree, so no caller
/// can pass a replacement. If the tree has no `AppLocalizations`, or a
/// translation is blank, the English text is used instead: a missing
/// translation must never be able to remove the label.
AppLocalizations _r6Strings(BuildContext context) {
final l10n = Localizations.of<AppLocalizations>(context, AppLocalizations);
if (l10n != null &&
l10n.receivedImage_syntheticBadge.trim().isNotEmpty &&
l10n.receivedImage_shareCaption(0).trim().isNotEmpty) {
return l10n;
}
return lookupAppLocalizations(const Locale('en'));
}
/// Text of the R6 label. Private and const: not injectable, not localisable
/// yet, and never empty.
const String _kSyntheticBadge = 'AI-reconstructed';
/// Text of the R6 badge burnt into the image.
String _syntheticBadge(BuildContext context) =>
_r6Strings(context).receivedImage_syntheticBadge;
/// The caption is built from the ACTUAL bitstream size, never a nominal one:
/// quoting a fixed "~156 bytes" under an image that took 209 is its own small
/// dishonesty, in a label whose whole job is honesty.
String _syntheticCaptionFor(int bytes) =>
'Reconstructed by an AI model from $bytes bytes. '
'Fine detail is generated, not transmitted.';
/// dishonesty, in a label whose whole job is honesty. Same sentence as the
/// share text in the channel screen, so the label reads identically wherever
/// the image goes.
String _syntheticCaptionFor(BuildContext context, int bytes) =>
_r6Strings(context).receivedImage_shareCaption(bytes);
class ReceivedImageMessage extends StatefulWidget {
/// 14 hex chars, as parsed out of the message text by
@@ -225,7 +235,8 @@ class _ReceivedImageMessageState extends State<ReceivedImageMessage> {
);
}
ReceivedImageStrings get _s => widget.strings ?? ReceivedImageStrings.english;
ReceivedImageStrings get _s =>
widget.strings ?? ReceivedImageStrings.of(context.l10n);
Widget _buildForEntry(
BuildContext context,
@@ -558,7 +569,7 @@ class _SyntheticBanner extends StatelessWidget {
const SizedBox(width: 4),
Flexible(
child: Text(
_kSyntheticBadge,
_syntheticBadge(context),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 12, color: Colors.white),
@@ -572,8 +583,8 @@ class _SyntheticBanner extends StatelessWidget {
/// R6, part 2: the full sentence, immediately under the image.
class _SyntheticCaption extends StatelessWidget {
/// Contrast variant only. The TEXT is the same const in both cases; there is
/// no parameter that can shorten, blank or restyle it away.
/// Contrast variant only. The TEXT is the same in both cases; there is no
/// parameter that can shorten, blank or restyle it away.
final bool onDark;
/// Size of the bitstream this image was reconstructed from.
@@ -586,7 +597,7 @@ class _SyntheticCaption extends StatelessWidget {
return Padding(
padding: const EdgeInsets.only(top: 4),
child: Text(
_syntheticCaptionFor(bytes),
_syntheticCaptionFor(context, bytes),
// No maxLines: the bubble is narrow and the sentence must never be
// truncated. A label that reads "Details are invented. Not a" is worse
// than none — it clips exactly where the warning was going.
+16 -38
View File
@@ -15,6 +15,7 @@ import '../widgets/mesh_ui.dart';
import '../utils/app_logger.dart';
import '../helpers/utf8_length_limiter.dart';
import 'routing_sheet.dart';
import '../utils/radio_guard.dart';
class RepeaterLoginDialog extends StatefulWidget {
final Contact repeater;
@@ -93,6 +94,7 @@ class _RepeaterLoginDialogState extends State<RepeaterLoginDialog> {
Future<void> _handleLogin() async {
if (_isLoggingIn) return;
if (!ensureRadioConnected(context)) return;
setState(() {
_isLoggingIn = true;
@@ -446,48 +448,24 @@ class _RepeaterLoginDialogState extends State<RepeaterLoginDialog> {
itemBuilder: (context) => [
PopupMenuItem(
value: 'auto',
child: Row(
children: [
Icon(
Icons.auto_mode,
size: 20,
color: !isFloodMode
? scheme.primary
: null,
),
const SizedBox(width: 8),
Text(
l10n.login_autoUseSavedPath,
style: TextStyle(
fontWeight: !isFloodMode
? FontWeight.bold
: FontWeight.normal,
),
),
],
child: MeshMenuItemRow(
icon: Icons.auto_mode,
label: l10n.login_autoUseSavedPath,
iconColor: !isFloodMode
? scheme.primary
: null,
selected: !isFloodMode,
),
),
PopupMenuItem(
value: 'flood',
child: Row(
children: [
Icon(
Icons.waves,
size: 20,
color: isFloodMode
? scheme.primary
: null,
),
const SizedBox(width: 8),
Text(
l10n.login_forceFloodMode,
style: TextStyle(
fontWeight: isFloodMode
? FontWeight.bold
: FontWeight.normal,
),
),
],
child: MeshMenuItemRow(
icon: Icons.waves,
label: l10n.login_forceFloodMode,
iconColor: isFloodMode
? scheme.primary
: null,
selected: isFloodMode,
),
),
],
+16 -38
View File
@@ -16,6 +16,7 @@ import '../utils/app_logger.dart';
import '../helpers/snack_bar_builder.dart';
import '../helpers/utf8_length_limiter.dart';
import 'routing_sheet.dart';
import '../utils/radio_guard.dart';
class RoomLoginDialog extends StatefulWidget {
final Contact room;
@@ -90,6 +91,7 @@ class _RoomLoginDialogState extends State<RoomLoginDialog> {
Future<void> _handleLogin() async {
if (_isLoggingIn) return;
if (!ensureRadioConnected(context)) return;
setState(() {
_isLoggingIn = true;
@@ -378,48 +380,24 @@ class _RoomLoginDialogState extends State<RoomLoginDialog> {
itemBuilder: (context) => [
PopupMenuItem(
value: 'auto',
child: Row(
children: [
Icon(
Icons.auto_mode,
size: 20,
color: !isFloodMode
? scheme.primary
: null,
),
const SizedBox(width: 8),
Text(
l10n.login_autoUseSavedPath,
style: TextStyle(
fontWeight: !isFloodMode
? FontWeight.bold
: FontWeight.normal,
),
),
],
child: MeshMenuItemRow(
icon: Icons.auto_mode,
label: l10n.login_autoUseSavedPath,
iconColor: !isFloodMode
? scheme.primary
: null,
selected: !isFloodMode,
),
),
PopupMenuItem(
value: 'flood',
child: Row(
children: [
Icon(
Icons.waves,
size: 20,
color: isFloodMode
? scheme.primary
: null,
),
const SizedBox(width: 8),
Text(
l10n.login_forceFloodMode,
style: TextStyle(
fontWeight: isFloodMode
? FontWeight.bold
: FontWeight.normal,
),
),
],
child: MeshMenuItemRow(
icon: Icons.waves,
label: l10n.login_forceFloodMode,
iconColor: isFloodMode
? scheme.primary
: null,
selected: isFloodMode,
),
),
],
+94 -40
View File
@@ -10,9 +10,11 @@ import '../models/contact.dart';
import '../models/path_history.dart';
import '../screens/path_trace_map.dart';
import '../services/path_history_service.dart';
import '../utils/radio_guard.dart';
import 'mesh_ui.dart';
import 'path_editor_sheet.dart';
enum _RoutingMode { auto, flood, manual }
enum _RoutingMode { auto, flood, direct, manual }
enum _PathQuality { strong, good, fair, proven, flood, untested }
@@ -72,7 +74,8 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> {
_RoutingMode _modeOf(Contact contact) {
final override = contact.pathOverride;
if (override == null) return _RoutingMode.auto;
return override < 0 ? _RoutingMode.flood : _RoutingMode.manual;
if (override < 0) return _RoutingMode.flood;
return override == 0 ? _RoutingMode.direct : _RoutingMode.manual;
}
Future<void> _selectMode(
@@ -87,6 +90,13 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> {
case _RoutingMode.flood:
setState(() => _syncStatus = null);
await connector.setPathOverride(contact, pathLen: -1);
case _RoutingMode.direct:
setState(() => _syncStatus = null);
await connector.setPathOverride(
contact,
pathLen: 0,
pathBytes: Uint8List(0),
);
case _RoutingMode.manual:
await _editManualPath(connector, contact);
}
@@ -224,6 +234,7 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> {
return switch (mode) {
_RoutingMode.auto => l10n.routing_modeAutoHint,
_RoutingMode.flood => l10n.routing_modeFloodHint,
_RoutingMode.direct => l10n.routing_modeDirectHint,
_RoutingMode.manual => l10n.routing_modeManualHint,
};
}
@@ -238,6 +249,8 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> {
switch (mode) {
case _RoutingMode.flood:
return l10n.routing_floodBroadcast;
case _RoutingMode.direct:
return l10n.routing_directNoHops;
case _RoutingMode.manual:
final bytes = contact.pathOverrideBytes ?? Uint8List(0);
if (bytes.isEmpty) return l10n.routing_directNoHops;
@@ -262,7 +275,7 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> {
Uint8List _displayBytes(Contact contact, _RoutingMode mode) {
return switch (mode) {
_RoutingMode.flood => Uint8List(0),
_RoutingMode.flood || _RoutingMode.direct => Uint8List(0),
_RoutingMode.manual => contact.pathOverrideBytes ?? Uint8List(0),
_RoutingMode.auto => contact.path,
};
@@ -378,9 +391,11 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> {
color: scheme.primary,
),
const SizedBox(width: 8),
Text(
l10n.routing_currentRoute,
style: theme.textTheme.titleSmall,
Flexible(
child: Text(
l10n.routing_currentRoute,
style: theme.textTheme.titleSmall,
),
),
],
),
@@ -435,7 +450,11 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> {
TextButton.icon(
icon: const Icon(Icons.restart_alt, size: 18),
label: Text(l10n.routing_forgetPath),
onPressed: () => _forgetPath(connector, contact),
// Resets the path on the radio; offline it would do
// nothing yet report success.
onPressed: isRadioReadOnly(connector)
? null
: () => _forgetPath(connector, contact),
),
],
),
@@ -543,14 +562,24 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> {
};
final hasBytes = record.pathBytes.isNotEmpty;
final inUse =
hasBytes &&
((mode == _RoutingMode.manual &&
listEquals(record.pathBytes, contact.pathOverrideBytes)) ||
(mode == _RoutingMode.auto &&
listEquals(record.pathBytes, contact.path)));
// A zero-hop record is the direct path: usable even without hop bytes.
final isDirect = !hasBytes && record.hopCount == 0;
final usable = hasBytes || isDirect;
final inUse = isDirect
? mode == _RoutingMode.direct ||
(mode == _RoutingMode.auto && contact.pathLength == 0)
: hasBytes &&
((mode == _RoutingMode.manual &&
listEquals(
record.pathBytes,
contact.pathOverrideBytes,
)) ||
(mode == _RoutingMode.auto &&
listEquals(record.pathBytes, contact.path)));
final title = hasBytes
final title = isDirect
? l10n.routing_directNoHops
: hasBytes
? PathHelper.resolvePathNames(
record.pathBytes,
connector.allContacts,
@@ -583,7 +612,7 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> {
child: Card(
margin: const EdgeInsets.symmetric(vertical: 4),
child: ListTile(
enabled: hasBytes,
enabled: usable,
leading: CircleAvatar(
radius: 18,
backgroundColor: bg,
@@ -623,7 +652,7 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> {
),
],
),
onTap: hasBytes && !inUse
onTap: usable && !inUse
? () => _applyHistoryPath(connector, contact, record)
: null,
onLongPress: hasBytes
@@ -698,30 +727,55 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> {
),
),
const SizedBox(height: 16),
SegmentedButton<_RoutingMode>(
style: const ButtonStyle(
minimumSize: WidgetStatePropertyAll(Size.fromHeight(44)),
),
segments: [
ButtonSegment(
value: _RoutingMode.auto,
icon: const Icon(Icons.auto_mode),
label: Text(l10n.routing_modeAuto),
),
ButtonSegment(
value: _RoutingMode.flood,
icon: const Icon(Icons.waves),
label: Text(l10n.routing_modeFlood),
),
ButtonSegment(
value: _RoutingMode.manual,
icon: const Icon(Icons.edit_road),
label: Text(l10n.routing_modeManual),
),
],
selected: {mode},
onSelectionChanged: (selection) =>
_selectMode(connector, contact, selection.first),
LayoutBuilder(
builder: (context, constraints) {
// Four modes share one row: on phones drop the icons and let
// labels shrink rather than clip, so every word stays whole.
final showIcons = constraints.maxWidth >= 480;
ButtonSegment<_RoutingMode> segment(
_RoutingMode value,
IconData icon,
String label,
) => ButtonSegment(
value: value,
icon: showIcons ? Icon(icon) : null,
label: MeshSegmentLabel(label),
);
return SegmentedButton<_RoutingMode>(
showSelectedIcon: false,
style: const ButtonStyle(
minimumSize: WidgetStatePropertyAll(Size.fromHeight(48)),
padding: WidgetStatePropertyAll(
EdgeInsets.symmetric(horizontal: 6),
),
),
segments: [
segment(
_RoutingMode.auto,
Icons.auto_mode,
l10n.routing_modeAuto,
),
segment(
_RoutingMode.flood,
Icons.waves,
l10n.routing_modeFlood,
),
segment(
_RoutingMode.direct,
Icons.near_me,
l10n.routing_modeDirect,
),
segment(
_RoutingMode.manual,
Icons.edit_road,
l10n.routing_modeManual,
),
],
selected: {mode},
onSelectionChanged: (selection) =>
_selectMode(connector, contact, selection.first),
);
},
),
const SizedBox(height: 8),
Text(
+157
View File
@@ -0,0 +1,157 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../connector/meshcore_connector.dart';
import '../helpers/contact_share_message.dart';
import '../l10n/contact_localization.dart';
import '../l10n/l10n.dart';
import '../models/contact.dart';
import '../theme/mesh_theme.dart';
import 'mesh_ui.dart';
/// Lets the user pick a saved contact (or themself) and appends the encoded
/// share token to [controller] so they can review and press send.
Future<void> showShareContactSheet(
BuildContext context,
TextEditingController controller, {
FocusNode? focusNode,
}) async {
final connector = context.read<MeshCoreConnector>();
final token = await showMeshSheet<String>(
context,
builder: (_) => _ShareContactSheet(connector: connector),
);
if (token == null) return;
controller.value = TextEditingValue(
text: token,
selection: TextSelection.collapsed(offset: token.length),
);
focusNode?.requestFocus();
}
class _ShareContactSheet extends StatefulWidget {
final MeshCoreConnector connector;
const _ShareContactSheet({required this.connector});
@override
State<_ShareContactSheet> createState() => _ShareContactSheetState();
}
class _ShareContactSheetState extends State<_ShareContactSheet> {
String _query = '';
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
final connector = widget.connector;
final selfKey = connector.selfPublicKey;
final needle = _query.trim().toLowerCase();
final contacts =
connector.contacts
.where(
(c) =>
c.publicKey.length == 32 &&
(needle.isEmpty || c.name.toLowerCase().contains(needle)),
)
.toList()
..sort(
(a, b) => a.name.toLowerCase().compareTo(b.name.toLowerCase()),
);
final selfName = connector.selfName ?? '';
final showSelf =
selfKey != null &&
selfKey.length == 32 &&
(needle.isEmpty ||
selfName.toLowerCase().contains(needle) ||
l10n.contactShare_myContact.toLowerCase().contains(needle));
return SafeArea(
child: ConstrainedBox(
constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.height * 0.8,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
BottomSheetHeader(title: l10n.contactShare_pickerTitle),
Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
child: TextField(
autofocus: false,
decoration: InputDecoration(
prefixIcon: const Icon(Icons.search),
hintText: l10n.contactShare_searchHint,
),
onChanged: (value) => setState(() => _query = value),
),
),
Flexible(
child: ListView(
shrinkWrap: true,
children: [
if (showSelf)
_tile(
context,
name: selfName.isEmpty
? l10n.contactShare_myContact
: selfName,
subtitle: l10n.contactShare_myContact,
token: encodeContactShare(
publicKey: selfKey,
type: 1,
name: selfName,
),
),
for (final c in contacts) _contactTile(context, c),
if (!showSelf && contacts.isEmpty)
Padding(
padding: const EdgeInsets.all(24),
child: Center(
child: Text(
l10n.contactShare_noContacts,
style: const TextStyle(fontSize: 14),
),
),
),
],
),
),
],
),
),
);
}
Widget _contactTile(BuildContext context, Contact c) {
return _tile(
context,
name: c.name,
subtitle: c.typeLabel(context.l10n),
token: encodeContactShare(
publicKey: c.publicKey,
type: c.type >= 1 && c.type <= 4 ? c.type : 1,
name: c.name,
),
);
}
Widget _tile(
BuildContext context, {
required String name,
required String subtitle,
required String token,
}) {
final scheme = Theme.of(context).colorScheme;
return ListTile(
minTileHeight: 56,
leading: AvatarCircle(name: name, size: 40),
title: Text(name, style: const TextStyle(fontSize: 16)),
subtitle: Text(
subtitle,
style: MeshTheme.mono(fontSize: 12, color: scheme.onSurfaceVariant),
),
onTap: () => Navigator.of(context).pop(token),
);
}
}
+214
View File
@@ -0,0 +1,214 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../connector/meshcore_connector.dart';
import '../helpers/contact_share_message.dart';
import '../helpers/snack_bar_builder.dart';
import '../l10n/app_localizations.dart';
import '../l10n/l10n.dart';
import '../theme/mesh_theme.dart';
import 'mesh_ui.dart';
String contactShareTypeLabel(AppLocalizations l10n, int type) {
switch (type) {
case 2:
return l10n.contact_typeRepeater;
case 3:
return l10n.contact_typeRoom;
case 4:
return l10n.contact_typeSensor;
default:
return l10n.contact_typeChat;
}
}
/// Card shown in chat bubbles for a `<PUBKEY:TYPE:NAME>` contact share, with a
/// one-tap "Add contact" action for incoming shares not yet on the radio.
class SharedContactCard extends StatefulWidget {
final ContactShare share;
final bool isOutgoing;
final double textScale;
final Color textColor;
final Color metaColor;
const SharedContactCard({
super.key,
required this.share,
required this.isOutgoing,
required this.textScale,
required this.textColor,
required this.metaColor,
});
@override
State<SharedContactCard> createState() => _SharedContactCardState();
}
class _SharedContactCardState extends State<SharedContactCard> {
bool _adding = false;
Future<void> _add(MeshCoreConnector connector) async {
if (_adding) return;
setState(() => _adding = true);
var ok = true;
try {
await connector.addContactFromCard(widget.share.toScannedContact());
} catch (_) {
ok = false;
}
if (!mounted) return;
setState(() => _adding = false);
final l10n = context.l10n;
showDismissibleSnackBar(
context,
content: Text(
ok ? l10n.contacts_contactImported : l10n.contacts_contactImportFailed,
),
);
}
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
final share = widget.share;
final scale = widget.textScale;
final connector = context.watch<MeshCoreConnector>();
final isSelf = connector.selfPublicKeyHex == share.publicKeyHex;
final isSaved = connector.getContactByPubKeyHex(share.publicKeyHex) != null;
final displayName = share.name.isEmpty ? share.shortKey : share.name;
Widget? action;
if (!widget.isOutgoing) {
if (isSelf) {
action = _status(Icons.person_outline, l10n.contactShare_isYou);
} else if (isSaved) {
// Still offer a re-add: the app's list can lag the radio (e.g. the
// contact was dropped on the radio or by another client), and adding
// again just refreshes an existing entry.
action = Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
spacing: 8,
children: [
_status(Icons.check_circle_outline, l10n.contactShare_saved),
TextButton(
onPressed: connector.isConnected && !_adding
? () => _add(connector)
: null,
style: TextButton.styleFrom(
foregroundColor: widget.textColor,
minimumSize: const Size(48, 48),
),
child: Text(
_adding ? l10n.contactShare_adding : l10n.contactShare_addAgain,
style: TextStyle(
fontSize: 14 * scale,
fontWeight: FontWeight.w600,
decoration: TextDecoration.underline,
decorationColor: widget.textColor,
),
),
),
],
);
} else {
action = SizedBox(
width: double.infinity,
height: 48,
child: FilledButton.icon(
onPressed: connector.isConnected && !_adding
? () => _add(connector)
: null,
icon: _adding
? const SizedBox(
width: 18,
height: 18,
child: CircularProgressIndicator(strokeWidth: 2),
)
: const Icon(Icons.person_add_alt),
label: Text(
_adding ? l10n.contactShare_adding : l10n.contactShare_add,
style: TextStyle(
fontSize: 14 * scale,
fontWeight: FontWeight.w600,
),
),
),
);
}
}
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
widget.isOutgoing
? l10n.contactShare_headerOutgoing
: l10n.contactShare_headerIncoming,
style: TextStyle(
color: widget.metaColor,
fontSize: 12 * scale,
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 8),
Row(
children: [
AvatarCircle(name: displayName, size: 44),
const SizedBox(width: 12),
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
displayName,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: widget.textColor,
fontSize: 16 * scale,
fontWeight: FontWeight.w700,
),
),
Text(
contactShareTypeLabel(l10n, share.type),
style: TextStyle(
color: widget.metaColor,
fontSize: 13 * scale,
),
),
Text(
'<${share.shortKey}>',
style: MeshTheme.mono(
fontSize: 12 * scale,
color: widget.metaColor,
),
),
],
),
),
],
),
if (action != null) ...[const SizedBox(height: 10), action],
],
);
}
Widget _status(IconData icon, String label) {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(icon, size: 20 * widget.textScale, color: widget.textColor),
const SizedBox(width: 6),
Text(
label,
style: TextStyle(
color: widget.textColor,
fontSize: 14 * widget.textScale,
fontWeight: FontWeight.w600,
),
),
],
);
}
}