merge(app): land settings layout rhythm

This commit is contained in:
2026-10-22 15:21:29 +01:00
4 changed files with 184 additions and 39 deletions
@@ -8,9 +8,10 @@ export 'settings_theme.dart';
/// A native text field with a label and one supporting line. Both platforms lay
/// the label out as wrapping text above the field; Material uses an outlined
/// [TextField] and iOS a [CupertinoTextField]. Labels and helper/error copy are
/// never line-capped, so large text cannot truncate them. No font sizes, heights
/// or colours are fixed here.
/// [TextField] and iOS a [CupertinoTextField]. The label is a compact secondary
/// line (like the web field label) while the section title carries the weight.
/// Labels and helper/error copy are never line-capped, so large text cannot
/// truncate them. No font sizes, heights or colours are fixed here.
class SettingsTextField extends StatelessWidget {
const SettingsTextField({
super.key,
@@ -35,13 +36,17 @@ class SettingsTextField extends StatelessWidget {
final hasError = error.trim().isNotEmpty;
// The label is laid out as normal wrapping text on both platforms. A
// Material floating label is single-line and ellipsizes the workspace label
// at narrow widths or large text, dropping required words.
// at narrow widths or large text, dropping required words. It is a compact
// secondary line, matching the web field label, so the section title is the
// one emphasised line in the group.
final labelWidget = ExcludeSemantics(
child: Text(
label,
style: usesCupertinoControls(context)
? settingsTextStyle(context)
: theme.textTheme.titleSmall,
? settingsTextStyle(context, secondary: true)
: theme.textTheme.labelMedium?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
),
),
);
if (!usesCupertinoControls(context)) {
+18 -8
View File
@@ -3,25 +3,35 @@
/// Everything else (control heights, font sizes, colours, button padding) comes
/// from the active Material or Cupertino theme, so text scaling and platform
/// defaults are never overridden here.
///
/// The rhythm follows the web Settings page: one centred column, an 8px gap
/// between a section's compact title and its grouped body, and 16px between
/// sections. The web's 12px field label and helper lines are secondary type in
/// [settingsTextStyle]/[SettingsTextField], not fixed sizes.
library;
/// A comfortable reading width on wide windows; the body is centred inside it.
const double settingsContentMaxWidth = 720;
/// Space between the Settings sections.
const double settingsSectionGap = 24;
/// Space between the Settings sections (web `.settings` grid gap).
const double settingsSectionGap = 16;
/// Space between a section title and its controls.
const double settingsTitleGap = 12;
/// Space between a compact section title and its grouped body, and between the
/// blocks inside a section (web `.settings-section` grid gap).
const double settingsTitleGap = 8;
/// Space between a field and its supporting text.
const double settingsFieldGap = 6;
/// Space between a field label and its field, and between stacked secondary
/// lines (web `.settings-field` gap).
const double settingsFieldGap = 4;
/// Space between wrapped action buttons.
const double settingsControlGap = 8;
/// Padding around the page body on narrow windows.
const double settingsPagePadding = 16;
/// Page insets on narrow windows: a little more room above the first title,
/// and a clear run-out below the last section (web `.settings` padding).
const double settingsPageTopPadding = 20;
const double settingsPageSidePadding = 16;
const double settingsPageBottomPadding = 32;
/// Padding inside a standard Material card / Cupertino inset row.
const double settingsCardPadding = 16;
+56 -25
View File
@@ -116,7 +116,14 @@ class _SettingsScreenState extends State<SettingsScreen> {
Widget build(BuildContext context) {
final content = SafeArea(
child: SingleChildScrollView(
padding: const EdgeInsets.all(settingsPagePadding),
// Web `.settings` page insets: 20 above the title, 16 at the sides and
// a clear 32 below the last section.
padding: const EdgeInsetsDirectional.fromSTEB(
settingsPageSidePadding,
settingsPageTopPadding,
settingsPageSidePadding,
settingsPageBottomPadding,
),
child: Center(
child: ConstrainedBox(
constraints: const BoxConstraints(
@@ -125,38 +132,48 @@ class _SettingsScreenState extends State<SettingsScreen> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
const _SectionTitle('Connection'),
const SizedBox(height: settingsTitleGap),
SettingsConnectionSection(
controller: _controller,
serverUrlField: _serverUrlField,
_SettingsSection(
title: 'Connection',
child: SettingsConnectionSection(
controller: _controller,
serverUrlField: _serverUrlField,
),
),
const SizedBox(height: settingsSectionGap),
const _SectionTitle('Workspace'),
const SizedBox(height: settingsTitleGap),
SettingsWorkspaceSection(
controller: _controller,
workspaceField: _workspaceField,
_SettingsSection(
title: 'Workspace',
child: SettingsWorkspaceSection(
controller: _controller,
workspaceField: _workspaceField,
),
),
if (widget.notifications != null) ...<Widget>[
const SizedBox(height: settingsSectionGap),
const _SectionTitle('Notifications'),
const SizedBox(height: settingsTitleGap),
SettingsNotificationsSection(
controller: widget.notifications!,
// The permission tile draws its own compact title row, so
// Settings must not add a second "Notifications" heading.
_SettingsSection(
child: SettingsNotificationsSection(
controller: widget.notifications!,
),
),
],
if (widget.onOpenSchedules != null) ...<Widget>[
const SizedBox(height: settingsSectionGap),
const _SectionTitle('Schedules'),
const SizedBox(height: settingsTitleGap),
SettingsSchedulesSection(onOpen: widget.onOpenSchedules!),
_SettingsSection(
title: 'Schedules',
child: SettingsSchedulesSection(
onOpen: widget.onOpenSchedules!,
),
),
],
if (widget.onOpenTemplates != null) ...<Widget>[
const SizedBox(height: settingsSectionGap),
const _SectionTitle('Templates'),
const SizedBox(height: settingsTitleGap),
SettingsTemplatesSection(onOpen: widget.onOpenTemplates!),
_SettingsSection(
title: 'Templates',
child: SettingsTemplatesSection(
onOpen: widget.onOpenTemplates!,
),
),
],
],
),
@@ -178,13 +195,27 @@ class _SettingsScreenState extends State<SettingsScreen> {
}
}
class _SectionTitle extends StatelessWidget {
const _SectionTitle(this.title);
/// One grouped Settings section: a compact title followed by its body at the
/// web's 8px title gap. Sections are separated by [settingsSectionGap]. A null
/// title lets a body (the notification tile) draw its own compact heading.
class _SettingsSection extends StatelessWidget {
const _SettingsSection({required this.child, this.title});
final String title;
final String? title;
final Widget child;
@override
Widget build(BuildContext context) {
return Text(title, style: settingsTextStyle(context, title: true));
final title = this.title;
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
if (title != null) ...<Widget>[
Text(title, style: settingsTextStyle(context, title: true)),
const SizedBox(height: settingsTitleGap),
],
child,
],
);
}
}