Files
meshcore-open/lib/widgets/get_node_banner.dart
T
zjs81 bc14de586f Add opt-in network map uploads and online map view
- Opt-in upload of header-only packet records and repeater/room server
  adverts to map.meshcoreopen.org about once a minute; payloads, channel
  and DM hashes and transport codes are stripped on the phone, locations
  snapped to a ~2 km grid, install ID rotates daily
- One-time opt-in dialog on first radio connection; toggle and status in
  App settings
- Local / Online / Both switch on the map screen with online repeater
  hexagons, links, add-to-contacts and manage
- Node purchase banner on the connect screen (affiliate link, disclosed)
- Privacy policy and network map documentation
- Translations for all locales
2026-10-11 21:54:16 -07:00

99 lines
3.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import '../l10n/l10n.dart';
import '../theme/mesh_theme.dart';
/// Affiliate link for the SenseCAP MeshTracker X1.
const getNodeUrl =
'https://www.seeedstudio.com/sensecap-meshtracker-x1-meshtastic-gps-tracker-p-6935.html'
'?sensecap_affiliate=JFWID0g&referring_service=link';
/// Bottom banner on the connect screen pointing new users at a node to buy.
class GetNodeBanner extends StatelessWidget {
const GetNodeBanner({super.key});
void _open() =>
launchUrl(Uri.parse(getNodeUrl), mode: LaunchMode.externalApplication);
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
final scheme = Theme.of(context).colorScheme;
final textTheme = Theme.of(context).textTheme;
return SafeArea(
top: false,
child: Padding(
padding: const EdgeInsets.fromLTRB(12, 4, 12, 12),
child: Material(
color: scheme.primaryContainer,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(MeshRadii.md),
side: BorderSide(color: scheme.primary.withValues(alpha: 0.4)),
),
clipBehavior: Clip.antiAlias,
child: InkWell(
onTap: _open,
child: Padding(
padding: const EdgeInsets.fromLTRB(14, 12, 14, 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Row(
children: [
Icon(
Icons.router_outlined,
size: 28,
color: scheme.onPrimaryContainer,
),
const SizedBox(width: 10),
Expanded(
child: Text(
l10n.scanner_getNodeTitle,
style: textTheme.titleMedium?.copyWith(
color: scheme.onPrimaryContainer,
fontWeight: FontWeight.w700,
),
),
),
],
),
const SizedBox(height: 6),
Text(
l10n.scanner_getNodeBody,
style: textTheme.bodyMedium?.copyWith(
color: scheme.onPrimaryContainer,
height: 1.35,
),
),
const SizedBox(height: 10),
SizedBox(
width: double.infinity,
child: FilledButton.icon(
onPressed: _open,
icon: const Icon(Icons.shopping_cart_outlined, size: 22),
label: Text(l10n.scanner_getNodeAction),
),
),
const SizedBox(height: 6),
Center(
child: Text(
l10n.scanner_getNodeDisclosure,
textAlign: TextAlign.center,
style: textTheme.bodySmall?.copyWith(
color: scheme.onPrimaryContainer.withValues(alpha: 0.8),
),
),
),
],
),
),
),
),
),
);
}
}