feat(app): match the web Settings rhythm
Group each Settings section under one compact title, tighten the page to the web's 8/16 spacing and 20/16/32 page insets, and make field labels secondary so only the section title carries emphasis. Drop the duplicate Notifications heading now that the permission tile draws its own title. Adds a rendered-geometry regression for the centred 720px column, the title and section gaps, the secondary label role on both platforms, and the single Notifications heading.
This commit is contained in:
@@ -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,
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user