Connect a radio: one page with Bluetooth, USB and TCP tabs

Replace the scanner, USB and TCP screens with one page and a tab for
each, so the design and the connection options are consistent. Fixes
#699, where the USB screen's Bluetooth button went back to the main
screens instead of the scanner.

The "Need a new node?" banner shows on every tab, with a close button
that hides it until the page is opened again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
celsoazevedoandClaude Opus 5.5 committed 2026-11-26 08:57:32 +00:00
1 parent 86b3e252c6
commit 9104b4a60a
60 files changed
+989 -1474

No files matched your search

+65 -40
View File
@@ -4,11 +4,12 @@ import 'package:url_launcher/url_launcher.dart';
import '../l10n/l10n.dart';
import '../services/node_banner_service.dart';
import '../theme/mesh_theme.dart';
import 'settings_reveal.dart';
/// Bottom banner on the connect screen pointing new users at a node to buy.
/// Its link (and optionally its text) comes from the `_banner` DNS TXT
/// record; it stays hidden until that loads, and when the lookup fails or the
/// record turns it off.
/// record turns it off. Close hides it until the screen closes.
class GetNodeBanner extends StatefulWidget {
final Future<NodeBannerConfig?> Function()? loadConfig;
@@ -20,6 +21,7 @@ class GetNodeBanner extends StatefulWidget {
class _GetNodeBannerState extends State<GetNodeBanner> {
NodeBannerConfig? _config;
bool _closed = false;
@override
void initState() {
@@ -32,17 +34,34 @@ class _GetNodeBannerState extends State<GetNodeBanner> {
@override
Widget build(BuildContext context) {
final config = _config;
if (config == null) return const SizedBox.shrink();
// A landscape phone has no room for it next to the screen's content.
final roomy = MediaQuery.sizeOf(context).height >= 480;
// The bottom inset stays reserved while hidden, so the screen's content
// keeps clear of the system bar.
return SafeArea(
top: false,
child: RevealOnEnable(
visible: config != null && !_closed && roomy,
child: config == null
? const SizedBox.shrink()
: _buildBanner(context, config),
),
);
}
Widget _buildBanner(BuildContext context, NodeBannerConfig config) {
final l10n = context.l10n;
final scheme = Theme.of(context).colorScheme;
final textTheme = Theme.of(context).textTheme;
final ink = scheme.onPrimaryContainer;
void open() => launchUrl(config.url, mode: LaunchMode.externalApplication);
return SafeArea(
top: false,
child: Padding(
padding: const EdgeInsets.fromLTRB(12, 4, 12, 12),
return Padding(
padding: const EdgeInsets.fromLTRB(16, 4, 16, 12),
child: ConstrainedBox(
constraints: BoxConstraints(
maxHeight: MediaQuery.sizeOf(context).height * 0.4,
),
child: Material(
color: scheme.primaryContainer,
shape: RoundedRectangleBorder(
@@ -52,56 +71,62 @@ class _GetNodeBannerState extends State<GetNodeBanner> {
clipBehavior: Clip.antiAlias,
child: InkWell(
onTap: open,
child: Padding(
padding: const EdgeInsets.fromLTRB(14, 12, 14, 10),
child: SingleChildScrollView(
padding: const EdgeInsetsDirectional.fromSTEB(14, 2, 2, 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),
Icon(Icons.router_outlined, size: 24, color: ink),
const SizedBox(width: 12),
Expanded(
child: Text(
config.title ?? l10n.scanner_getNodeTitle,
style: textTheme.titleMedium?.copyWith(
color: scheme.onPrimaryContainer,
color: ink,
fontWeight: FontWeight.w700,
),
),
),
IconButton(
icon: Icon(Icons.close, color: ink),
tooltip: l10n.common_close,
onPressed: () => setState(() => _closed = true),
),
],
),
const SizedBox(height: 6),
Text(
config.body ?? 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(config.action ?? 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),
),
Padding(
padding: const EdgeInsetsDirectional.only(end: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min,
children: [
Text(
config.body ?? l10n.scanner_getNodeBody,
style: textTheme.bodyMedium?.copyWith(
color: ink,
height: 1.35,
),
),
const SizedBox(height: 10),
FilledButton.icon(
onPressed: open,
icon: const Icon(Icons.shopping_cart_outlined),
label: Text(
config.action ?? l10n.scanner_getNodeAction,
),
),
const SizedBox(height: 6),
Text(
l10n.scanner_getNodeDisclosure,
textAlign: TextAlign.center,
style: textTheme.bodySmall?.copyWith(
color: ink.withValues(alpha: 0.8),
),
),
],
),
),
],