merge(app): land Templates entry from Settings after retained-run recovery
This commit is contained in:
@@ -9,4 +9,5 @@ abstract final class SettingsKeys {
|
||||
static const reconnect = ValueKey<String>('settings.reconnect');
|
||||
static const workspace = ValueKey<String>('settings.workspace');
|
||||
static const saveWorkspace = ValueKey<String>('settings.saveWorkspace');
|
||||
static const templates = ValueKey<String>('settings.templates');
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import 'settings_controls.dart';
|
||||
import 'settings_layout.dart';
|
||||
import 'settings_sections.dart';
|
||||
import 'settings_store.dart';
|
||||
import 'settings_templates_section.dart';
|
||||
|
||||
/// The Settings destination: the server connection and the server-side
|
||||
/// workspace, in native Material (native platforms) or Cupertino (iOS) controls.
|
||||
@@ -27,6 +28,7 @@ class SettingsScreen extends StatefulWidget {
|
||||
this.store,
|
||||
this.ping,
|
||||
this.embedded = false,
|
||||
this.onOpenTemplates,
|
||||
});
|
||||
|
||||
final transport.PipelinesClient client;
|
||||
@@ -44,6 +46,10 @@ class SettingsScreen extends StatefulWidget {
|
||||
/// The application shell already owns the native navigation bar and safe area.
|
||||
final bool embedded;
|
||||
|
||||
/// Opens the Templates gallery. Null keeps Settings standalone/incomplete
|
||||
/// without a dead row that would go nowhere.
|
||||
final VoidCallback? onOpenTemplates;
|
||||
|
||||
@override
|
||||
State<SettingsScreen> createState() => _SettingsScreenState();
|
||||
}
|
||||
@@ -121,6 +127,12 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
controller: _controller,
|
||||
workspaceField: _workspaceField,
|
||||
),
|
||||
if (widget.onOpenTemplates != null) ...<Widget>[
|
||||
const SizedBox(height: settingsSectionGap),
|
||||
const _SectionTitle('Templates'),
|
||||
const SizedBox(height: settingsTitleGap),
|
||||
SettingsTemplatesSection(onOpen: widget.onOpenTemplates!),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'settings_keys.dart';
|
||||
import 'settings_theme.dart';
|
||||
|
||||
/// The Settings entry to the Templates gallery.
|
||||
///
|
||||
/// The row wording matches the current web Settings page: `Browse templates`
|
||||
/// with the server-catalogue secondary line, under its `Templates` heading. It
|
||||
/// only opens the route; loading the catalogue is the gallery's own read.
|
||||
const String settingsTemplatesLabel = 'Browse templates';
|
||||
const String settingsTemplatesSecondary =
|
||||
'Reusable pipeline definitions offered by the server.';
|
||||
|
||||
class SettingsTemplatesSection extends StatelessWidget {
|
||||
const SettingsTemplatesSection({super.key, required this.onOpen});
|
||||
|
||||
final VoidCallback onOpen;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (usesCupertinoControls(context)) {
|
||||
return CupertinoListSection.insetGrouped(
|
||||
margin: EdgeInsets.zero,
|
||||
children: <Widget>[
|
||||
CupertinoListTile(
|
||||
key: SettingsKeys.templates,
|
||||
title: const Text(settingsTemplatesLabel),
|
||||
subtitle: const Text(settingsTemplatesSecondary),
|
||||
trailing: const CupertinoListTileChevron(),
|
||||
onTap: onOpen,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
return Card(
|
||||
margin: EdgeInsets.zero,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: ListTile(
|
||||
key: SettingsKeys.templates,
|
||||
leading: const Icon(Icons.widgets_outlined),
|
||||
title: const Text(settingsTemplatesLabel),
|
||||
subtitle: const Text(settingsTemplatesSecondary),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: onOpen,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user