import 'package:flutter/material.dart'; import '../../../core/api_gateway.dart'; import '../../graph/widgets/stage_definition_view.dart'; import 'run_detail_content.dart'; import 'run_detail_visit_facts.dart'; /// The Definition section: the authored definition this run pinned for the /// visit's stage, rendered by the landed [StageDefinitionView]. /// /// When the reply's graph does not declare the stage, the pane's exact missing /// sentence is shown instead. Nothing is reconstructed from the current source. class RunVisitDefinition extends StatelessWidget { const RunVisitDefinition({ super.key, required this.run, required this.stageKey, }); final JsonMap run; final String stageKey; @override Widget build(BuildContext context) { final graph = detailGraph(run); if (!detailVisitHasDefinition(graph, stageKey)) { return ListView( key: const Key('run-visit-body-definition'), padding: const EdgeInsets.all(16), children: const [Text(unknownStageDefinition)], ); } final pipelineId = run['pipeline_id']; final version = run['version']; return KeyedSubtree( key: const Key('run-visit-body-definition'), child: StageDefinitionView( graph: graph!, stageKey: stageKey, pipelineId: pipelineId is num ? pipelineId.toInt() : 0, pipelineName: detailPipeline(run), version: version is num ? version.toInt() : 0, ), ); } }