Move send controls into Routing and split retry limits

Direct and flood attempts are separate settings, available with auto
route rotation off. Saved single retry limits migrate to that split,
and reset restores the whole Routing section.

Co-authored-by: zjs81 <zjs81@users.noreply.github.com>
This commit is contained in:
Cursor Agentandzjs81 committed 2026-11-21 00:50:53 +00:00
1 parent 34ea0cb7ca
commit 1b804bd1eb
69 files changed
+2199 -784

No files matched your search

+4 -1
View File
@@ -6,6 +6,7 @@ import 'package:provider/provider.dart';
import '../l10n/l10n.dart';
import '../models/contact.dart';
import '../l10n/contact_localization.dart';
import '../services/app_settings_service.dart';
import '../services/storage_service.dart';
import '../services/repeater_command_service.dart';
import '../connector/meshcore_connector.dart';
@@ -40,7 +41,9 @@ class _RepeaterLoginDialogState extends State<RepeaterLoginDialog> {
String? _loginError;
late MeshCoreConnector _connector;
int _currentAttempt = 0;
static const int _maxAttempts = 5;
int get _maxAttempts =>
context.read<AppSettingsService>().settings.loginAttempts;
@override
void initState() {
+4 -1
View File
@@ -7,6 +7,7 @@ import 'package:provider/provider.dart';
import '../l10n/l10n.dart';
import '../models/contact.dart';
import '../l10n/contact_localization.dart';
import '../services/app_settings_service.dart';
import '../services/storage_service.dart';
import '../connector/meshcore_connector.dart';
import '../connector/meshcore_protocol.dart';
@@ -36,7 +37,9 @@ class _RoomLoginDialogState extends State<RoomLoginDialog> {
bool _obscurePassword = true;
late MeshCoreConnector _connector;
int _currentAttempt = 0;
static const int _maxAttempts = 5;
int get _maxAttempts =>
context.read<AppSettingsService>().settings.loginAttempts;
@override
void initState() {
+111
View File
@@ -0,0 +1,111 @@
import 'package:flutter/material.dart';
/// Shows or hides [child] by animating its height.
///
/// Use this wherever turning something on reveals more controls, and for any
/// other block that grows or collapses in place. Hidden controls are not in
/// the tree, so they are not announced. The duration and curve are fixed so
/// every reveal moves the same way. See documentation/design.md.
class RevealOnEnable extends StatelessWidget {
static const Duration duration = Duration(milliseconds: 200);
static const Curve curve = Curves.easeInOut;
final bool visible;
final Widget child;
final AlignmentGeometry alignment;
const RevealOnEnable({
super.key,
required this.visible,
required this.child,
this.alignment = Alignment.topCenter,
});
@override
Widget build(BuildContext context) {
return AnimatedSize(
duration: duration,
curve: curve,
alignment: alignment,
child: visible
? child
: const SizedBox(width: double.infinity, height: 0),
);
}
}
/// Nested controls under a settings switch: the shared reveal animation on a
/// tinted, indented panel.
class SettingsReveal extends StatelessWidget {
final bool visible;
final List<Widget> children;
const SettingsReveal({
super.key,
required this.visible,
required this.children,
});
@override
Widget build(BuildContext context) {
return RevealOnEnable(
visible: visible,
child: Material(
color: Theme.of(context).colorScheme.surfaceContainerHighest,
child: Padding(
padding: const EdgeInsets.only(left: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: children,
),
),
),
);
}
}
/// A settings slider whose selected value stays visible in the title.
///
/// The drag bubble repeats the same number. Pass a [title] that already
/// includes [value], the way the channel-hop titles do.
class SettingsValueSlider extends StatelessWidget {
final String title;
final String? subtitle;
final int value;
final int min;
final int max;
final ValueChanged<int> onChanged;
const SettingsValueSlider({
super.key,
required this.title,
this.subtitle,
required this.value,
required this.min,
required this.max,
required this.onChanged,
});
@override
Widget build(BuildContext context) {
final clamped = value.clamp(min, max);
return ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
title: Text(title),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (subtitle != null) Text(subtitle!),
Slider(
value: clamped.toDouble(),
min: min.toDouble(),
max: max.toDouble(),
divisions: max > min ? max - min : null,
label: '$clamped',
onChanged: (next) => onChanged(next.round()),
),
],
),
);
}
}