Path map: theme the panels and keep overlays clear of zoom buttons

- Bottom panel, zoom buttons, toggle and panel contents use ColorScheme roles
- On desktop, the observed-path selector and view toggle start past the
  zoom controls
This commit is contained in:
zjs81 committed 2026-11-22 18:09:17 -07:00
1 parent a11f13af73
commit 2ca1ddc1b2
6 files changed
+266 -80

No files matched your search

+12 -8
View File
@@ -1075,7 +1075,7 @@ class _ChannelMessagePathMapScreenState
? l10n.channelPath_primaryPath(selectedIndex + 1)
: l10n.channelPath_pathLabel(selectedIndex + 1);
return Positioned(
left: 16,
left: pathMapTopOverlayInset(),
right: 16,
top: topOffset,
child: SafeArea(
@@ -1375,7 +1375,10 @@ class _ChannelMessagePathMapScreenState
isImperial: isImperial,
l10n: l10n,
),
style: MeshTheme.mono(fontSize: 12, color: MeshPalette.ink2),
style: MeshTheme.mono(
fontSize: 12,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
],
),
@@ -1430,6 +1433,7 @@ class _ChannelMessagePathMapScreenState
Map<int, int> hopUseCount,
) {
final l10n = context.l10n;
final scheme = Theme.of(context).colorScheme;
if (hops.isEmpty) {
return Center(child: Text(l10n.channelPath_noHopDetailsAvailable));
}
@@ -1459,7 +1463,7 @@ class _ChannelMessagePathMapScreenState
color: index == highlightRow
? highlightColor
: isFocused
? MeshPalette.blueBg
? scheme.primary.withValues(alpha: 0.12)
: Colors.transparent,
padding: const EdgeInsets.symmetric(
horizontal: 12,
@@ -1471,10 +1475,10 @@ class _ChannelMessagePathMapScreenState
width: 30,
height: 30,
decoration: BoxDecoration(
color: MeshPalette.blueDim.withValues(alpha: 0.3),
color: scheme.primary.withValues(alpha: 0.18),
shape: BoxShape.circle,
border: Border.all(
color: MeshPalette.blueDim.withValues(alpha: 0.5),
color: scheme.primary.withValues(alpha: 0.5),
),
),
alignment: Alignment.center,
@@ -1482,8 +1486,8 @@ class _ChannelMessagePathMapScreenState
fit: BoxFit.scaleDown,
child: Text(
hop.index.toString(),
style: const TextStyle(
color: MeshPalette.ink,
style: TextStyle(
color: scheme.onSurface,
fontSize: 12,
fontWeight: FontWeight.w700,
),
@@ -1516,7 +1520,7 @@ class _ChannelMessagePathMapScreenState
].join(' · '),
style: MeshTheme.mono(
fontSize: 12,
color: MeshPalette.ink3,
color: scheme.onSurfaceVariant,
),
overflow: TextOverflow.ellipsis,
),
+15 -7
View File
@@ -1235,7 +1235,7 @@ class _PathTraceMapScreenState extends State<PathTraceMapScreen>
mainAxisSize: MainAxisSize.min,
children: [
if (_isLoading)
CircularProgressIndicator(color: MeshPalette.blue),
CircularProgressIndicator(color: scheme.primary),
const SizedBox(height: 16),
if (!_isLoading && _failed2Loaded)
Text(
@@ -1803,7 +1803,7 @@ class _PathTraceMapScreenState extends State<PathTraceMapScreen>
style: MeshTheme.mono(
fontWeight: FontWeight.w600,
fontSize: 13,
color: MeshPalette.ink,
color: Theme.of(context).colorScheme.onSurface,
),
),
combined: combined,
@@ -1880,6 +1880,7 @@ class _PathTraceMapScreenState extends State<PathTraceMapScreen>
itemCount: pathTraceData.pathData.length + 1,
separatorBuilder: (_, _) => const Divider(height: 1),
itemBuilder: (context, index) {
final scheme = Theme.of(context).colorScheme;
final snrUi = snrUiFromSNR(
index < pathTraceData.snrData.length
? pathTraceData.snrData[index]
@@ -1894,15 +1895,18 @@ class _PathTraceMapScreenState extends State<PathTraceMapScreen>
index >= pathTraceData.snrData.length / 2
? Icons.call_received
: Icons.call_made,
color: MeshPalette.ink2,
color: scheme.onSurfaceVariant,
),
title: Text(
formatDirectionText(pathTraceData, index),
style: MeshTheme.mono(fontSize: 13, color: MeshPalette.ink),
style: MeshTheme.mono(fontSize: 13, color: scheme.onSurface),
),
subtitle: Text(
formatDirectionSubText(pathTraceData, index),
style: MeshTheme.mono(fontSize: 12, color: MeshPalette.ink3),
style: MeshTheme.mono(
fontSize: 12,
color: scheme.onSurfaceVariant,
),
),
trailing: Column(
mainAxisAlignment: MainAxisAlignment.center,
@@ -1943,6 +1947,7 @@ class _PathTraceMapScreenState extends State<PathTraceMapScreen>
itemCount: path.totalTransmissions,
separatorBuilder: (_, _) => const Divider(height: 1),
itemBuilder: (context, index) {
final scheme = Theme.of(context).colorScheme;
String title;
String subtitle;
Widget? trailing;
@@ -2017,11 +2022,14 @@ class _PathTraceMapScreenState extends State<PathTraceMapScreen>
),
title: Text(
title,
style: MeshTheme.mono(fontSize: 13, color: MeshPalette.ink),
style: MeshTheme.mono(fontSize: 13, color: scheme.onSurface),
),
subtitle: Text(
subtitle,
style: MeshTheme.mono(fontSize: 12, color: MeshPalette.ink3),
style: MeshTheme.mono(
fontSize: 12,
color: scheme.onSurfaceVariant,
),
),
trailing: trailing,
);
+35 -23
View File
@@ -30,6 +30,16 @@ bool isDesktopMapPlatform([TargetPlatform? platform]) {
p == TargetPlatform.macOS;
}
/// Left edge of the [PathMapDesktopControls] column plus its 48px buttons
/// and a gap; overlays at the top of the map start here on desktop so they
/// don't cover the zoom buttons.
const double kPathMapDesktopControlsInset = 16 + 48 + 8;
/// Horizontal inset for overlays stacked at the top of a path map: clears
/// the desktop zoom controls, otherwise the usual 16px margin.
double pathMapTopOverlayInset([TargetPlatform? platform]) =>
isDesktopMapPlatform(platform) ? kPathMapDesktopControlsInset : 16;
/// The connected radio's position, or null when it is unknown (disconnected)
/// or not a real fix (SELF_INFO reports 0,0 without GPS).
LatLng? plausibleSelfPoint(MeshCoreConnector connector) {
@@ -168,37 +178,38 @@ class PathMapDesktopControls extends StatelessWidget {
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
final scheme = Theme.of(context).colorScheme;
return Positioned(
top: 16,
left: 16,
child: DecoratedBox(
decoration: BoxDecoration(
color: MeshPalette.bg1.withValues(alpha: 0.90),
color: scheme.surfaceContainerLow.withValues(alpha: 0.94),
borderRadius: BorderRadius.circular(MeshRadii.md),
border: Border.all(color: MeshPalette.line2),
border: Border.all(color: scheme.outlineVariant),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(MeshRadii.md),
child: IconTheme(
data: const IconThemeData(color: MeshPalette.ink),
data: IconThemeData(color: scheme.onSurface),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
IconButton(
icon: const Icon(Icons.add),
color: MeshPalette.ink,
color: scheme.onSurface,
tooltip: l10n.map_zoomIn,
onPressed: onZoomIn,
),
IconButton(
icon: const Icon(Icons.remove),
color: MeshPalette.ink,
color: scheme.onSurface,
tooltip: l10n.map_zoomOut,
onPressed: onZoomOut,
),
IconButton(
icon: const Icon(Icons.my_location),
color: MeshPalette.ink,
color: scheme.onSurface,
tooltip: l10n.map_centerMap,
onPressed: onReset,
),
@@ -280,12 +291,12 @@ class PathSharedCountBadge extends StatelessWidget {
}
}
/// Dark, collapsible bottom panel shared by the path map screens: header
/// Collapsible bottom panel shared by the path map screens: header
/// with distance and legend, playback controls, warnings, optional
/// multi-path summary, and the hop list.
///
/// Sets dark-panel text/icon/divider colours explicitly so content does not
/// inherit light-theme colours.
/// Uses the theme's card surface and sets text/icon/divider colours from the
/// [ColorScheme] so the panel matches light, dark and custom themes.
class PathMapBottomPanel extends StatelessWidget {
final Widget header;
final bool combined;
@@ -334,6 +345,7 @@ class PathMapBottomPanel extends StatelessWidget {
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
final scheme = Theme.of(context).colorScheme;
final maxHeight =
MediaQuery.of(context).size.height * (combined ? 0.45 : 0.35);
const hopRowHeight = 60.0;
@@ -348,7 +360,7 @@ class PathMapBottomPanel extends StatelessWidget {
cardHeight = max(196.0, min(maxHeight, estimatedHeight));
}
final warnStyle = const TextStyle(fontSize: 12, color: MeshPalette.warn);
final warnStyle = TextStyle(fontSize: 12, color: scheme.tertiary);
final unresolved = selected?.unresolvedHops ?? 0;
return Positioned(
@@ -360,26 +372,26 @@ class PathMapBottomPanel extends StatelessWidget {
height: cardHeight,
child: Container(
decoration: BoxDecoration(
color: MeshPalette.bg1.withValues(alpha: 0.96),
color: scheme.surfaceContainerLow.withValues(alpha: 0.96),
borderRadius: BorderRadius.circular(MeshRadii.md),
border: Border.all(color: MeshPalette.line2),
border: Border.all(color: scheme.outlineVariant),
),
clipBehavior: Clip.antiAlias,
child: DefaultTextStyle.merge(
style: const TextStyle(color: MeshPalette.ink),
style: TextStyle(color: scheme.onSurface),
child: IconTheme(
data: const IconThemeData(color: MeshPalette.ink),
data: IconThemeData(color: scheme.onSurface),
child: DividerTheme(
data: const DividerThemeData(color: MeshPalette.line),
data: DividerThemeData(color: scheme.outlineVariant),
child: ListTileTheme(
data: const ListTileThemeData(
iconColor: MeshPalette.ink2,
textColor: MeshPalette.ink,
data: ListTileThemeData(
iconColor: scheme.onSurfaceVariant,
textColor: scheme.onSurface,
),
child: TextButtonTheme(
data: TextButtonThemeData(
style: TextButton.styleFrom(
foregroundColor: MeshPalette.ink,
foregroundColor: scheme.onSurface,
),
),
child: LayoutBuilder(
@@ -445,7 +457,7 @@ class PathMapBottomPanel extends StatelessWidget {
? Icons.close_fullscreen
: Icons.open_in_full,
),
color: MeshPalette.ink,
color: scheme.onSurface,
tooltip: isExpanded
? l10n.pathMap_showMap
: l10n.pathMap_expandHopList,
@@ -457,7 +469,7 @@ class PathMapBottomPanel extends StatelessWidget {
? Icons.expand_less
: Icons.expand_more,
),
color: MeshPalette.ink,
color: scheme.onSurface,
tooltip: collapsed
? l10n.pathMap_expandPanel
: l10n.pathMap_collapsePanel,
@@ -489,10 +501,10 @@ class PathMapBottomPanel extends StatelessWidget {
),
child: Row(
children: [
const Icon(
Icon(
Icons.gps_off,
size: 16,
color: MeshPalette.warn,
color: scheme.tertiary,
),
const SizedBox(width: 6),
Expanded(
+61 -40
View File
@@ -8,6 +8,7 @@ import '../models/display_path.dart';
import '../models/path_playback.dart';
import '../theme/mesh_theme.dart';
import 'mesh_ui.dart';
import 'path_map_scaffold.dart';
/// Shared UI for the path map screens (live path trace and received-message
/// path map): packet-flow animation overlays, single/combined view toggle,
@@ -232,6 +233,7 @@ void showSharedNodeSheet(
required ValueChanged<DisplayPath> onSelect,
}) {
final l10n = context.l10n;
final scheme = Theme.of(context).colorScheme;
showModalBottomSheet(
context: context,
builder: (sheetContext) => SafeArea(
@@ -246,7 +248,7 @@ void showSharedNodeSheet(
style: MeshTheme.mono(
fontSize: 14,
fontWeight: FontWeight.w700,
color: MeshPalette.ink,
color: scheme.onSurface,
),
),
),
@@ -254,7 +256,7 @@ void showSharedNodeSheet(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
l10n.pathMap_sharedNodeCount(paths.length),
style: TextStyle(fontSize: 12, color: MeshPalette.ink3),
style: TextStyle(fontSize: 12, color: scheme.onSurfaceVariant),
),
),
const SizedBox(height: 8),
@@ -264,11 +266,14 @@ void showSharedNodeSheet(
leading: _colorDot(path.color),
title: Text(
path.label,
style: MeshTheme.mono(fontSize: 13, color: MeshPalette.ink),
style: MeshTheme.mono(fontSize: 13, color: scheme.onSurface),
),
trailing: Text(
l10n.pathMap_hopCount(path.totalTransmissions),
style: MeshTheme.mono(fontSize: 12, color: MeshPalette.ink3),
style: MeshTheme.mono(
fontSize: 12,
color: scheme.onSurfaceVariant,
),
),
onTap: () {
Navigator.pop(sheetContext);
@@ -302,33 +307,40 @@ class PathViewModeToggle extends StatelessWidget {
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
final scheme = Theme.of(context).colorScheme;
// Symmetric insets keep the toggle centred while clearing the desktop
// zoom controls in the top-left corner.
final inset = isDesktopMapPlatform() ? kPathMapDesktopControlsInset : 0.0;
return Positioned(
top: 12,
left: 0,
right: 0,
left: inset,
right: inset,
child: Center(
child: DecoratedBox(
decoration: BoxDecoration(
color: MeshPalette.bg1.withValues(alpha: 0.92),
borderRadius: BorderRadius.circular(MeshRadii.pill),
),
child: SegmentedButton<PathViewMode>(
style: const ButtonStyle(
visualDensity: VisualDensity(horizontal: -3, vertical: -3),
child: FittedBox(
fit: BoxFit.scaleDown,
child: DecoratedBox(
decoration: BoxDecoration(
color: scheme.surfaceContainerLow.withValues(alpha: 0.94),
borderRadius: BorderRadius.circular(MeshRadii.pill),
),
showSelectedIcon: false,
segments: [
ButtonSegment(
value: PathViewMode.single,
label: MeshSegmentLabel(l10n.pathMap_viewSingle),
child: SegmentedButton<PathViewMode>(
style: const ButtonStyle(
visualDensity: VisualDensity(horizontal: -3, vertical: -3),
),
ButtonSegment(
value: PathViewMode.combined,
label: MeshSegmentLabel(l10n.pathMap_viewCombined),
),
],
selected: {mode},
onSelectionChanged: (selection) => onChanged(selection.first),
showSelectedIcon: false,
segments: [
ButtonSegment(
value: PathViewMode.single,
label: MeshSegmentLabel(l10n.pathMap_viewSingle),
),
ButtonSegment(
value: PathViewMode.combined,
label: MeshSegmentLabel(l10n.pathMap_viewCombined),
),
],
selected: {mode},
onSelectionChanged: (selection) => onChanged(selection.first),
),
),
),
),
@@ -363,6 +375,7 @@ class PathAnimationControls extends StatelessWidget {
animation: playback,
builder: (context, _) {
final l10n = context.l10n;
final scheme = Theme.of(context).colorScheme;
final enabled = animationEnabled && playback.hasPath;
final path = selected;
String? hopLabel;
@@ -408,8 +421,8 @@ class PathAnimationControls extends StatelessWidget {
? l10n.pathMap_animationOff
: l10n.pathMap_animationOn,
color: animationEnabled
? MeshPalette.blue
: MeshPalette.ink4,
? scheme.primary
: scheme.onSurfaceVariant,
onPressed: onToggleAnimation,
),
controlButton(
@@ -441,7 +454,7 @@ class PathAnimationControls extends StatelessWidget {
tooltip: followEnabled
? l10n.pathMap_unfollowPacket
: l10n.pathMap_followPacket,
color: followEnabled ? MeshPalette.blue : null,
color: followEnabled ? scheme.primary : null,
onPressed: enabled ? onToggleFollow : null,
),
TextButton(
@@ -468,7 +481,7 @@ class PathAnimationControls extends StatelessWidget {
overflow: TextOverflow.ellipsis,
style: MeshTheme.mono(
fontSize: 12,
color: MeshPalette.ink2,
color: scheme.onSurfaceVariant,
),
),
),
@@ -494,16 +507,14 @@ class PathMiniLegend extends StatelessWidget {
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
final muted = Theme.of(context).colorScheme.onSurfaceVariant;
Widget item(Widget swatch, String text) => Row(
mainAxisSize: MainAxisSize.min,
children: [
swatch,
const SizedBox(width: 4),
Flexible(
child: Text(
text,
style: TextStyle(fontSize: 12, color: MeshPalette.ink3),
),
child: Text(text, style: TextStyle(fontSize: 12, color: muted)),
),
],
);
@@ -515,7 +526,7 @@ class PathMiniLegend extends StatelessWidget {
width: 5,
height: 3,
margin: const EdgeInsets.only(right: 2),
color: MeshPalette.ink3,
color: muted,
),
],
);
@@ -571,6 +582,7 @@ class PathSummaryList extends StatelessWidget {
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
final scheme = Theme.of(context).colorScheme;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -580,7 +592,10 @@ class PathSummaryList extends StatelessWidget {
children: [
Text(
l10n.pathMap_observedPaths(paths.length),
style: MeshTheme.accentLabel(color: MeshPalette.ink3),
style: MeshTheme.accentLabel(
color: scheme.onSurfaceVariant,
fontSize: 12,
),
),
const Spacer(),
if (hiddenIds.isNotEmpty)
@@ -607,6 +622,7 @@ class PathSummaryList extends StatelessWidget {
Widget _buildRow(BuildContext context, DisplayPath path) {
final l10n = context.l10n;
final scheme = Theme.of(context).colorScheme;
final isSelected = path.id == selectedId;
final hidden = hiddenIds.contains(path.id);
final timestamp = path.record?.timestamp;
@@ -622,7 +638,9 @@ class PathSummaryList extends StatelessWidget {
margin: const EdgeInsets.symmetric(horizontal: 8, vertical: 1),
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
decoration: BoxDecoration(
color: isSelected ? MeshPalette.bg3 : Colors.transparent,
color: isSelected
? scheme.surfaceContainerHighest
: Colors.transparent,
borderRadius: BorderRadius.circular(MeshRadii.sm),
),
child: Row(
@@ -641,7 +659,7 @@ class PathSummaryList extends StatelessWidget {
fontWeight: isSelected
? FontWeight.w700
: FontWeight.w500,
color: MeshPalette.ink,
color: scheme.onSurface,
),
),
],
@@ -655,7 +673,10 @@ class PathSummaryList extends StatelessWidget {
parts.join(' · '),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: MeshTheme.mono(fontSize: 12, color: MeshPalette.ink3),
style: MeshTheme.mono(
fontSize: 12,
color: scheme.onSurfaceVariant,
),
),
),
),
@@ -663,7 +684,7 @@ class PathSummaryList extends StatelessWidget {
icon: Icon(
hidden ? Icons.visibility_off : Icons.visibility,
size: 20,
color: hidden ? MeshPalette.ink4 : MeshPalette.ink3,
color: scheme.onSurfaceVariant,
),
tooltip: hidden ? l10n.pathMap_showPath : l10n.pathMap_hidePath,
padding: EdgeInsets.zero,