3ec580c2d9
Servers become rows with a selection mark, addresses as subtitles and a Use/Edit/Remove menu plus an Add server row; the connection is a status row with address and Reconnect/Disconnect rows; Templates and Schedules are chevron rows in a Library group. Material groups are flat surfaceContainer surfaces with primary titleSmall headers (no Cards); Cupertino uses inset-grouped sections on the grouped background, switches for the ntfy choices. The trust warning is a footer, helper copy is shortened, Save workspace is a legible tonal/plain button, and the column starts at the bar's inset (max 720) instead of being centred. The page pads by the top media padding instead of a top SafeArea.
64 lines
2.4 KiB
Dart
64 lines
2.4 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
|
|
import '../../ui/theme/app_theme.dart';
|
|
import 'settings_layout.dart';
|
|
import 'settings_theme.dart';
|
|
|
|
/// The Settings page's scrolling column of groups.
|
|
///
|
|
/// It scrolls behind the floating top bar: instead of a top [SafeArea] it pads
|
|
/// its start by the bar's height (the top media padding), and its end by the
|
|
/// floating tab bar's (the bottom media padding), so at rest nothing is hidden
|
|
/// and scrolled groups pass behind the glass pills. The column starts at the
|
|
/// bar's own side inset, so the groups line up under the title pill, and stops
|
|
/// at [settingsContentMaxWidth] on a wide window. Cupertino paints the page in
|
|
/// the grouped background its inset-grouped sections are designed for.
|
|
class SettingsPageBody extends StatelessWidget {
|
|
const SettingsPageBody({super.key, required this.children});
|
|
|
|
final List<Widget> children;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final insets = MediaQuery.paddingOf(context);
|
|
// The inset-grouped section already pads above its own header.
|
|
final gap = usesCupertinoControls(context)
|
|
? settingsTitleGap
|
|
: settingsSectionGap;
|
|
final Widget list = SingleChildScrollView(
|
|
key: const ValueKey<String>('settings.scroll'),
|
|
padding: EdgeInsets.fromLTRB(
|
|
insets.left + settingsPageSidePadding,
|
|
insets.top + settingsPageTopPadding,
|
|
insets.right + settingsPageSidePadding,
|
|
insets.bottom + settingsPageBottomPadding,
|
|
),
|
|
child: Align(
|
|
alignment: AlignmentDirectional.topStart,
|
|
child: ConstrainedBox(
|
|
constraints: const BoxConstraints(maxWidth: settingsContentMaxWidth),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: <Widget>[
|
|
for (final (index, child) in children.indexed) ...<Widget>[
|
|
if (index > 0) SizedBox(height: gap),
|
|
child,
|
|
],
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
if (!usesCupertinoControls(context)) return list;
|
|
return ColoredBox(
|
|
color: settingsCupertinoBackground.resolveFrom(context),
|
|
child: list,
|
|
);
|
|
}
|
|
}
|
|
|
|
/// The Cupertino Settings page background: the system grouped background, so
|
|
/// the inset sections' rows read as raised cards in light and dark.
|
|
const CupertinoDynamicColor settingsCupertinoBackground =
|
|
AppColors.groupedBackground;
|