fix(app): pipeline row items on the right end flush with the row edge
This commit is contained in:
@@ -199,27 +199,29 @@ class PipelineListPanel extends StatelessWidget {
|
||||
/// The row's title line: its name, and its version and id in the corner.
|
||||
Widget _rowTitle(BuildContext context, PipelineSummary pipeline) {
|
||||
final muted = _mutedStyle(context);
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
pipeline.displayName,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
// Weight only: the native tile owns size and the selected colour.
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
return _measured(
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
pipeline.displayName,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
// Weight only: the native tile owns size and the selected colour.
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Flexible(
|
||||
child: Text(
|
||||
'${pipelineVersionLabel(pipeline)} · #${pipeline.id}',
|
||||
style: muted,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
const SizedBox(width: 8),
|
||||
_RightCorner(
|
||||
child: Text(
|
||||
'${pipelineVersionLabel(pipeline)} · #${pipeline.id}',
|
||||
style: muted,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -266,47 +268,49 @@ class PipelineListPanel extends StatelessWidget {
|
||||
: controller.runsLoaded
|
||||
? Text('no runs recorded', style: style)
|
||||
: const SizedBox.shrink();
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(child: Text(what, style: style)),
|
||||
if (shape != null) ...[
|
||||
const SizedBox(width: 8),
|
||||
// The miniature keeps to its corner and scales down when narrow.
|
||||
Flexible(
|
||||
child: FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
child: PipelineMiniGraph(
|
||||
key: Key('pipeline-mini-${pipeline.id}'),
|
||||
shape: shape,
|
||||
return _measured(
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(child: Text(what, style: style)),
|
||||
if (shape != null) ...[
|
||||
const SizedBox(width: 8),
|
||||
// The miniature keeps to its corner and scales down when narrow.
|
||||
_RightCorner(
|
||||
child: FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
child: PipelineMiniGraph(
|
||||
key: Key('pipeline-mini-${pipeline.id}'),
|
||||
shape: shape,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: lastRun),
|
||||
if (updated != null) ...[
|
||||
const SizedBox(width: 8),
|
||||
Flexible(
|
||||
child: Text(
|
||||
updated,
|
||||
style: style,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: lastRun),
|
||||
if (updated != null) ...[
|
||||
const SizedBox(width: 8),
|
||||
_RightCorner(
|
||||
child: Text(
|
||||
updated,
|
||||
style: style,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -549,3 +553,44 @@ List<Widget> pipelineListActions(
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
/// A row's right-hand item: its own width, flush against the trailing edge,
|
||||
/// never more than about half the row, so the left side keeps the rest.
|
||||
class _RightCorner extends StatelessWidget {
|
||||
const _RightCorner({required this.child});
|
||||
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final width = _RowWidth.of(context);
|
||||
return ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: width * 0.45),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// The width of the row a [_RightCorner] sits in.
|
||||
class _RowWidth extends InheritedWidget {
|
||||
const _RowWidth({required this.width, required super.child});
|
||||
|
||||
final double width;
|
||||
|
||||
static double of(BuildContext context) =>
|
||||
context.dependOnInheritedWidgetOfExactType<_RowWidth>()?.width ??
|
||||
MediaQuery.sizeOf(context).width;
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(_RowWidth oldWidget) => width != oldWidget.width;
|
||||
}
|
||||
|
||||
/// Gives the [_RightCorner]s inside [child] the row's own width.
|
||||
Widget _measured(Widget child) => LayoutBuilder(
|
||||
builder: (context, constraints) => _RowWidth(
|
||||
width: constraints.hasBoundedWidth
|
||||
? constraints.maxWidth
|
||||
: MediaQuery.sizeOf(context).width,
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user