142 lines
4.5 KiB
Dart
142 lines
4.5 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
|
|
import '../../../core/api_gateway.dart';
|
|
import '../../../ui/status/run_status_icon.dart';
|
|
import '../domain/run_models.dart';
|
|
import 'run_detail_content.dart';
|
|
import 'run_detail_tabs.dart';
|
|
import 'run_more_menu.dart';
|
|
import 'run_pipeline_link.dart';
|
|
|
|
/// The runs detail with standard Cupertino controls. It has no Material
|
|
/// ancestor: the host header keeps native navigation, actions and notices, and
|
|
/// the shared tab body uses native Cupertino expansion tiles and grouped list
|
|
/// sections. Copy feedback is an inline live-region status.
|
|
Widget buildCupertinoRunDetail({
|
|
required BuildContext context,
|
|
required JsonMap run,
|
|
required Widget headerActions,
|
|
bool inShellBar = false,
|
|
ValueChanged<num>? onRunOpened,
|
|
OpenPipeline? onOpenPipeline,
|
|
required bool detailLoading,
|
|
required String? error,
|
|
required bool copying,
|
|
required String? copyStatus,
|
|
required VoidCallback onBack,
|
|
required VoidCallback onCopy,
|
|
required ApiGateway gateway,
|
|
required ValueChanged<JsonMap> onRunChanged,
|
|
required String configuredEndpoint,
|
|
String? initialStageKey,
|
|
int? initialVisit,
|
|
}) {
|
|
final theme = CupertinoTheme.of(context);
|
|
return RunDetailTabs(
|
|
run: run,
|
|
cupertino: true,
|
|
copying: copying,
|
|
copyStatus: copyStatus,
|
|
onCopy: onCopy,
|
|
gateway: gateway,
|
|
onRunChanged: onRunChanged,
|
|
configuredEndpoint: configuredEndpoint,
|
|
initialStageKey: initialStageKey,
|
|
initialVisit: initialVisit,
|
|
header: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
// Inside the app shell, Back and the more menu are in its bar.
|
|
if (!inShellBar)
|
|
Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(16, 8, 16, 0),
|
|
child: Wrap(
|
|
alignment: WrapAlignment.spaceBetween,
|
|
crossAxisAlignment: WrapCrossAlignment.center,
|
|
spacing: 8,
|
|
runSpacing: 4,
|
|
children: [
|
|
CupertinoButton(
|
|
padding: EdgeInsets.zero,
|
|
onPressed: onBack,
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
const Icon(CupertinoIcons.back),
|
|
const SizedBox(width: 4),
|
|
const Text('Back'),
|
|
],
|
|
),
|
|
),
|
|
if (copying) const CupertinoActivityIndicator(),
|
|
RunMoreMenu(
|
|
run: run,
|
|
gateway: gateway,
|
|
onRunChanged: onRunChanged,
|
|
cupertino: true,
|
|
onRunOpened: onRunOpened,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(16, 8, 16, 0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Wrap(
|
|
spacing: 8,
|
|
runSpacing: 4,
|
|
crossAxisAlignment: WrapCrossAlignment.center,
|
|
children: [
|
|
RunStatusKicker(
|
|
state: runStateOf(run['status']),
|
|
label: runStatusLabel(run),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 4),
|
|
Text(
|
|
detailTitle(run),
|
|
style: theme.textTheme.navLargeTitleTextStyle,
|
|
),
|
|
const SizedBox(height: 4),
|
|
Wrap(
|
|
crossAxisAlignment: WrapCrossAlignment.center,
|
|
children: [
|
|
Text('Run ${run['id']} · Pipeline '),
|
|
RunPipelineLink(
|
|
run: run,
|
|
cupertino: true,
|
|
onOpenPipeline: onOpenPipeline,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(16, 8, 16, 0),
|
|
child: Align(
|
|
alignment: AlignmentDirectional.centerStart,
|
|
child: headerActions,
|
|
),
|
|
),
|
|
if (detailLoading) const _CupertinoNotice('Refreshing run details…'),
|
|
if (error != null) _CupertinoNotice(error),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
class _CupertinoNotice extends StatelessWidget {
|
|
const _CupertinoNotice(this.text);
|
|
final String text;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(16, 8, 16, 0),
|
|
child: Semantics(liveRegion: true, child: Text(text)),
|
|
);
|
|
}
|