refactor(#274): move app debug logging toggle into the Debug category

The App Settings pane carried a Debug card holding only the app-debug-logging
switch, while the Debug category already owned the log viewers. Moved the
switch next to the App debug log viewer it controls and dropped the now-empty
Debug card from App Settings.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
pull/419/head
Strycher 2 months ago
parent ab6d0b13b2
commit 480d6a8e27

@ -15,8 +15,9 @@ import '../map_cache_screen.dart';
/// Embeddable view (no Scaffold) for the App Settings shell pane.
///
/// Renders appearance, translation, battery, map, Cyr2Lat, and debug cards.
/// Notifications and message-handling settings live in [MessageSettingsView].
/// Renders appearance, translation, battery, map, and Cyr2Lat cards.
/// Notifications and message-handling settings live in [MessageSettingsView];
/// app debug logging lives in the Debug category on the settings screen.
class AppSettingsView extends StatelessWidget {
const AppSettingsView({super.key});
@ -43,8 +44,6 @@ class AppSettingsView extends StatelessWidget {
_buildMapSettingsCard(context, settingsService),
const SizedBox(height: 16),
_buildCyr2LatCard(context, settingsService),
const SizedBox(height: 16),
_buildDebugCard(context, settingsService),
],
);
},
@ -1355,57 +1354,6 @@ class AppSettingsView extends StatelessWidget {
),
);
}
Widget _buildDebugCard(
BuildContext context,
AppSettingsService settingsService,
) {
return Card(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(16, 16, 16, 8),
child: Text(
context.l10n.appSettings_debugCard,
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
),
SwitchListTile(
secondary: const Icon(Icons.bug_report_outlined),
title: Text(context.l10n.appSettings_appDebugLogging),
subtitle: Text(context.l10n.appSettings_appDebugLoggingSubtitle),
value: settingsService.settings.appDebugLogEnabled,
onChanged: (value) async {
try {
await settingsService.setAppDebugLogEnabled(value);
} catch (_) {
if (context.mounted) {
showDismissibleSnackBar(
context,
content: const Text(
'Could not change debug logging. Please try again.',
),
);
}
return;
}
if (!context.mounted) return;
showDismissibleSnackBar(
context,
content: Text(
value
? context.l10n.appSettings_appDebugLoggingEnabled
: context.l10n.appSettings_appDebugLoggingDisabled,
),
duration: const Duration(seconds: 2),
);
},
),
],
),
);
}
}
/// Owns the [TextEditingController] for the manual model URL field so it

@ -12,6 +12,7 @@ import '../l10n/l10n.dart';
import '../models/offband_gps_status.dart';
import '../models/radio_settings.dart';
import '../services/app_debug_log_service.dart';
import '../services/app_settings_service.dart';
import '../connector/observer_config_client.dart';
import '../helpers/snack_bar_builder.dart';
import 'settings/settings_shell.dart';
@ -571,6 +572,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
Widget _buildDebugCard(BuildContext context) {
final l10n = context.l10n;
final settingsService = context.watch<AppSettingsService>();
return Card(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -597,6 +599,38 @@ class _SettingsScreenState extends State<SettingsScreen> {
},
),
const Divider(height: 1),
SwitchListTile(
secondary: const Icon(Icons.bug_report_outlined),
title: Text(l10n.appSettings_appDebugLogging),
subtitle: Text(l10n.appSettings_appDebugLoggingSubtitle),
value: settingsService.settings.appDebugLogEnabled,
onChanged: (value) async {
try {
await settingsService.setAppDebugLogEnabled(value);
} catch (_) {
if (context.mounted) {
showDismissibleSnackBar(
context,
content: const Text(
'Could not change debug logging. Please try again.',
),
);
}
return;
}
if (!context.mounted) return;
showDismissibleSnackBar(
context,
content: Text(
value
? l10n.appSettings_appDebugLoggingEnabled
: l10n.appSettings_appDebugLoggingDisabled,
),
duration: const Duration(seconds: 2),
);
},
),
const Divider(height: 1),
ListTile(
leading: const Icon(Icons.code_outlined),
title: Text(l10n.settings_appDebugLog),

Loading…
Cancel
Save

Powered by TurnKey Linux.