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), ), ), ), ], ), ), ), ), ), ); } }