d1b05217c9
Keep the pipeline feature on its existing Material path because the app runs under MaterialApp and never selects Cupertino hosts. Preserve public cupertino parameters and required Cupertino icon values for later cleanup and shared controls.
133 lines
3.4 KiB
Dart
133 lines
3.4 KiB
Dart
import '../../../ui/adaptive/app_menu_anchor.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../../../ui/adaptive/segmented_bar.dart';
|
|
|
|
import '../pipeline_query.dart';
|
|
|
|
/// Standard Material activity indicator with an accessible status label.
|
|
class PipelineProgress extends StatelessWidget {
|
|
const PipelineProgress({super.key, this.label = 'Loading'});
|
|
|
|
final String label;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Semantics(
|
|
label: label,
|
|
liveRegion: true,
|
|
child: const CircularProgressIndicator(),
|
|
);
|
|
}
|
|
}
|
|
|
|
/// A standard Material text action.
|
|
class PipelineTextButton extends StatelessWidget {
|
|
const PipelineTextButton({
|
|
super.key,
|
|
required this.label,
|
|
required this.onPressed,
|
|
});
|
|
|
|
final String label;
|
|
final VoidCallback? onPressed;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return TextButton(onPressed: onPressed, child: Text(label));
|
|
}
|
|
}
|
|
|
|
/// Back affordance used by the narrow list/detail layout.
|
|
class PipelineBackButton extends StatelessWidget {
|
|
const PipelineBackButton({super.key, required this.onPressed});
|
|
|
|
final VoidCallback onPressed;
|
|
|
|
/// The same round Back as every page's segmented bar.
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Semantics(
|
|
label: 'Back to pipelines',
|
|
child: SegmentedPill(
|
|
cupertino: false,
|
|
child: SegmentedBackButton(cupertino: false, onPressed: onPressed),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
/// The list's sort control: a Material menu. The label is the current choice,
|
|
/// exactly as on web.
|
|
class PipelineSortButton extends StatelessWidget {
|
|
const PipelineSortButton({
|
|
super.key,
|
|
required this.sort,
|
|
required this.onSelected,
|
|
this.icon = false,
|
|
});
|
|
|
|
final PipelineSort sort;
|
|
final ValueChanged<PipelineSort> onSelected;
|
|
|
|
/// An app-bar icon instead of a labelled button.
|
|
final bool icon;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final label = 'Sort: ${sort.label}';
|
|
return AppMenuAnchor(
|
|
menuChildren: [
|
|
for (final option in PipelineSort.values)
|
|
MenuItemButton(
|
|
onPressed: () => onSelected(option),
|
|
child: Text(option.label),
|
|
),
|
|
],
|
|
builder: (context, menu, child) => icon
|
|
? IconButton(
|
|
tooltip: 'Sort pipelines: ${sort.label}',
|
|
onPressed: () => menu.isOpen ? menu.close() : menu.open(),
|
|
icon: const Icon(Icons.sort),
|
|
)
|
|
: TextButton(
|
|
onPressed: () => menu.isOpen ? menu.close() : menu.open(),
|
|
child: Text(label),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
/// A truthful, non-blocking error line with an optional retry action.
|
|
class PipelineErrorBanner extends StatelessWidget {
|
|
const PipelineErrorBanner({
|
|
super.key,
|
|
required this.message,
|
|
this.retryLabel = 'Retry',
|
|
this.onRetry,
|
|
});
|
|
|
|
final String message;
|
|
final String retryLabel;
|
|
final VoidCallback? onRetry;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final color = Theme.of(context).colorScheme.error;
|
|
return Semantics(
|
|
liveRegion: true,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(message, style: TextStyle(color: color)),
|
|
if (onRetry != null)
|
|
PipelineTextButton(label: retryLabel, onPressed: onRetry),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|