diff --git a/app/lib/features/pipelines/widgets/pipeline_list_panel.dart b/app/lib/features/pipelines/widgets/pipeline_list_panel.dart index 36efa302..5ee9175f 100644 --- a/app/lib/features/pipelines/widgets/pipeline_list_panel.dart +++ b/app/lib/features/pipelines/widgets/pipeline_list_panel.dart @@ -127,11 +127,21 @@ class PipelineListPanel extends StatelessWidget { if (empty == null) return const SizedBox.shrink(); return _empty(context, empty); } - return useCupertinoControls(context) - ? _cupertinoList(context, items) - : _materialList(context, items); + // A list pane beside a detail can be very narrow (a 640px window leaves + // it ~130px): there the rows drop the identity icon and chevron so the + // name keeps the width. + return LayoutBuilder( + builder: (context, constraints) { + final compact = constraints.maxWidth < _compactRowWidth; + return useCupertinoControls(context) + ? _cupertinoList(context, items, compact: compact) + : _materialList(context, items, compact: compact); + }, + ); } + static const double _compactRowWidth = 220; + Widget _centered(BuildContext context, List messages) { return Center( child: Padding( @@ -139,12 +149,6 @@ class PipelineListPanel extends StatelessWidget { child: Column( mainAxisSize: MainAxisSize.min, children: [ - Icon( - useCupertinoControls(context) - ? CupertinoIcons.flowchart - : Icons.account_tree_outlined, - ), - const SizedBox(height: 12), const PipelineProgress(label: 'Loading pipelines'), for (final message in messages) Padding( @@ -164,12 +168,6 @@ class PipelineListPanel extends StatelessWidget { child: Column( mainAxisSize: MainAxisSize.min, children: [ - Icon( - useCupertinoControls(context) - ? CupertinoIcons.tray - : Icons.inbox_outlined, - ), - const SizedBox(height: 12), Text( empty.message, textAlign: TextAlign.center, @@ -186,7 +184,11 @@ class PipelineListPanel extends StatelessWidget { ); } - Widget _materialList(BuildContext context, List items) { + Widget _materialList( + BuildContext context, + List items, { + required bool compact, + }) { final now = DateTime.now(); return ListView.separated( key: const Key('pipeline-list'), @@ -205,7 +207,7 @@ class PipelineListPanel extends StatelessWidget { horizontal: kPipelineListInset, ), visualDensity: VisualDensity.compact, - leading: _pipelineIdentityIcon(context), + leading: compact ? null : _pipelineIdentityIcon(context), title: _rowTitle(context, pipeline), subtitle: _rowMetadata(context, pipeline, now), ); @@ -213,7 +215,11 @@ class PipelineListPanel extends StatelessWidget { ); } - Widget _cupertinoList(BuildContext context, List items) { + Widget _cupertinoList( + BuildContext context, + List items, { + required bool compact, + }) { final now = DateTime.now(); return ListView( key: const Key('pipeline-list'), @@ -229,10 +235,10 @@ class PipelineListPanel extends StatelessWidget { backgroundColor: controller.selectedId == pipeline.id ? CupertinoColors.tertiarySystemFill.resolveFrom(context) : null, - leading: _pipelineIdentityIcon(context), + leading: compact ? null : _pipelineIdentityIcon(context), title: _rowTitle(context, pipeline), subtitle: _rowMetadata(context, pipeline, now), - trailing: const CupertinoListTileChevron(), + trailing: compact ? null : const CupertinoListTileChevron(), onTap: () => controller.openPipeline( pipeline.id, version: pipeline.version, diff --git a/app/lib/features/runs/ui/runs_list.dart b/app/lib/features/runs/ui/runs_list.dart index c53b6b90..5956e6eb 100644 --- a/app/lib/features/runs/ui/runs_list.dart +++ b/app/lib/features/runs/ui/runs_list.dart @@ -173,27 +173,30 @@ class RunsList extends StatelessWidget { } Widget _emptyError(BuildContext context) => Center( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Icon( + child: SingleChildScrollView( + padding: const EdgeInsets.symmetric(horizontal: 24), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + usesCupertinoHost(context) + ? CupertinoIcons.exclamationmark_triangle + : Icons.error_outline, + ), + const SizedBox(height: 8), + Text(controller.error!), + const SizedBox(height: 8), usesCupertinoHost(context) - ? CupertinoIcons.exclamationmark_triangle - : Icons.error_outline, - ), - const SizedBox(height: 8), - Text(controller.error!), - const SizedBox(height: 8), - usesCupertinoHost(context) - ? CupertinoButton( - onPressed: controller.load, - child: const Text('Retry'), - ) - : FilledButton( - onPressed: controller.load, - child: const Text('Retry'), - ), - ], + ? CupertinoButton( + onPressed: controller.load, + child: const Text('Retry'), + ) + : FilledButton( + onPressed: controller.load, + child: const Text('Retry'), + ), + ], + ), ), ); @@ -203,7 +206,9 @@ class RunsList extends StatelessWidget { required String title, String? subtitle, }) => Center( - child: Padding( + // A short pane (a list beside a detail, or the keyboard up) scrolls the + // state instead of overflowing it. + child: SingleChildScrollView( padding: const EdgeInsets.all(24), child: Column( mainAxisSize: MainAxisSize.min, @@ -262,6 +267,9 @@ class RunsList extends StatelessWidget { /// number on top, the pipeline and duration below, then when it ran and how /// far it got. class RunListRow extends StatelessWidget { + /// The narrowest row that still shows its own actions menu. + static const double _menuMinRowWidth = 280; + const RunListRow({ super.key, required this.run, @@ -356,7 +364,7 @@ class RunListRow extends StatelessWidget { }, ); final scheduled = run['scheduled'] == true; - final body = Row( + Widget body(bool withMenu) => Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( @@ -389,7 +397,10 @@ class RunListRow extends StatelessWidget { ], ), ), - if (gateway != null && onRunChanged != null && showRunMoreMenu(run)) + if (withMenu && + gateway != null && + onRunChanged != null && + showRunMoreMenu(run)) RunMoreMenu( run: run, gateway: gateway!, @@ -400,9 +411,15 @@ class RunListRow extends StatelessWidget { ), ], ); + // A narrow list pane beside the open run leaves the row no room for a + // second control (a tap on its centre would land on the menu); the open + // run's detail beside it carries the same menu. final padded = Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), - child: body, + child: LayoutBuilder( + builder: (context, constraints) => + body(constraints.maxWidth >= _menuMinRowWidth), + ), ); return Semantics( selected: selected,