Files
alan 3933ff980c Remove Cupertino settings branches
Keep the Material settings implementation while preserving public Cupertino parameters for later cleanup. Narrow settings tests to the Material-only behavior.
2026-11-11 05:21:30 +00:00

48 lines
1.2 KiB
Dart

import 'package:flutter/material.dart';
/// One row of a [SettingsGroup]: a Material [ListTile]. The subtitle wraps, so
/// addresses and status details stay readable at large text.
class SettingsRow extends StatelessWidget {
const SettingsRow({
super.key,
required this.title,
this.subtitle,
this.leading,
this.trailing,
this.onTap,
this.chevron = false,
this.action = false,
this.enabled = true,
});
final Widget title;
final Widget? subtitle;
final Widget? leading;
final Widget? trailing;
final VoidCallback? onTap;
/// A navigation row: shows the disclosure chevron.
final bool chevron;
/// A command row (Reconnect, Add server): the title takes the accent
/// colour, as a button would.
final bool action;
final bool enabled;
@override
Widget build(BuildContext context) {
final tap = enabled ? onTap : null;
final scheme = Theme.of(context).colorScheme;
return ListTile(
enabled: enabled,
leading: leading,
iconColor: action ? scheme.primary : null,
textColor: action ? scheme.primary : null,
title: title,
subtitle: subtitle,
trailing: trailing ?? (chevron ? const Icon(Icons.chevron_right) : null),
onTap: tap,
);
}
}