Files
pipelines/app/lib/features/settings/settings_templates_section.dart
T

53 lines
1.7 KiB
Dart

import '../../ui/theme/app_theme.dart';
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(
backgroundColor: AppColors.groupedBackground,
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,
),
);
}
}