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.
This commit is contained in:
@@ -1,12 +1,7 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'settings_theme.dart';
|
||||
|
||||
/// One row of a [SettingsGroup]: Material [ListTile], Cupertino
|
||||
/// [CupertinoListTile]. The subtitle wraps (the Cupertino tile otherwise caps
|
||||
/// it at one line), so addresses and status details stay readable at large
|
||||
/// text.
|
||||
/// 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,
|
||||
@@ -26,7 +21,7 @@ class SettingsRow extends StatelessWidget {
|
||||
final Widget? trailing;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
/// A navigation row: shows the platform's disclosure chevron.
|
||||
/// A navigation row: shows the disclosure chevron.
|
||||
final bool chevron;
|
||||
|
||||
/// A command row (Reconnect, Add server): the title takes the accent
|
||||
@@ -34,43 +29,9 @@ class SettingsRow extends StatelessWidget {
|
||||
final bool action;
|
||||
final bool enabled;
|
||||
|
||||
Widget _wrapping(Widget child) => Builder(
|
||||
builder: (context) => DefaultTextStyle(
|
||||
style: DefaultTextStyle.of(context).style,
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final tap = enabled ? onTap : null;
|
||||
final subtitle = this.subtitle;
|
||||
if (usesCupertinoControls(context)) {
|
||||
final accent = CupertinoTheme.of(context).primaryColor;
|
||||
final disabled = CupertinoColors.tertiaryLabel.resolveFrom(context);
|
||||
return CupertinoListTile(
|
||||
leading: leading == null
|
||||
? null
|
||||
: IconTheme.merge(
|
||||
data: IconThemeData(color: enabled ? accent : disabled),
|
||||
child: leading!,
|
||||
),
|
||||
title: DefaultTextStyle.merge(
|
||||
style: TextStyle(
|
||||
color: !enabled
|
||||
? disabled
|
||||
: action
|
||||
? accent
|
||||
: null,
|
||||
),
|
||||
child: title,
|
||||
),
|
||||
subtitle: subtitle == null ? null : _wrapping(subtitle),
|
||||
trailing:
|
||||
trailing ?? (chevron ? const CupertinoListTileChevron() : null),
|
||||
onTap: tap,
|
||||
);
|
||||
}
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
return ListTile(
|
||||
enabled: enabled,
|
||||
|
||||
Reference in New Issue
Block a user