Narrow list panes: readable bar title, More overflow menu, rows keep status and actions
The floating bar keeps the title at its own width (up to half the bar) and moves overflowable actions into one More menu instead of squeezing them below their touch targets. List rows keep their leading status avatar and More actions at any list-pane width; the time moves under the subtitle.
This commit is contained in:
@@ -327,24 +327,14 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
|
||||
Widget _settingsButton(BuildContext context) =>
|
||||
pipelineSettingsButton(context, widget.onOpenSettings);
|
||||
|
||||
Widget _refreshButton(BuildContext context) {
|
||||
if (useCupertinoControls(context)) {
|
||||
return Semantics(
|
||||
button: true,
|
||||
label: 'Refresh',
|
||||
child: CupertinoButton(
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: _controller.load,
|
||||
child: const Icon(CupertinoIcons.refresh),
|
||||
),
|
||||
);
|
||||
}
|
||||
return IconButton(
|
||||
tooltip: 'Refresh',
|
||||
onPressed: _controller.load,
|
||||
icon: const Icon(Icons.refresh),
|
||||
);
|
||||
}
|
||||
Widget _refreshButton(BuildContext context) => pipelineBarIconButton(
|
||||
context,
|
||||
key: const Key('pipelines-refresh'),
|
||||
label: 'Refresh',
|
||||
icon: Icons.refresh,
|
||||
cupertinoIcon: CupertinoIcons.refresh,
|
||||
onPressed: _controller.load,
|
||||
);
|
||||
|
||||
Widget _materialShell(BuildContext context, Widget body) {
|
||||
return Scaffold(
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/segmented_bar_overflow.dart';
|
||||
import 'pipeline_controls.dart';
|
||||
|
||||
/// One icon action in the Pipelines bar's actions pill: a Material
|
||||
/// [IconButton] with its tooltip, or a Cupertino button named for
|
||||
/// accessibility.
|
||||
/// accessibility. A narrow bar moves it into its More menu.
|
||||
Widget pipelineBarIconButton(
|
||||
BuildContext context, {
|
||||
required Key key,
|
||||
@@ -15,7 +16,8 @@ Widget pipelineBarIconButton(
|
||||
required VoidCallback? onPressed,
|
||||
}) {
|
||||
final Widget button;
|
||||
if (useCupertinoControls(context)) {
|
||||
final cupertino = useCupertinoControls(context);
|
||||
if (cupertino) {
|
||||
button = CupertinoButton(
|
||||
key: key,
|
||||
padding: EdgeInsets.zero,
|
||||
@@ -30,10 +32,17 @@ Widget pipelineBarIconButton(
|
||||
icon: Icon(icon),
|
||||
);
|
||||
}
|
||||
return Semantics(
|
||||
button: true,
|
||||
label: label,
|
||||
child: ExcludeSemantics(child: button),
|
||||
return SegmentedOverflowAction(
|
||||
overflowEntry: SegmentedOverflowEntry(
|
||||
label: label,
|
||||
icon: cupertino ? cupertinoIcon : icon,
|
||||
onPressed: onPressed,
|
||||
),
|
||||
child: Semantics(
|
||||
button: true,
|
||||
label: label,
|
||||
child: ExcludeSemantics(child: button),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../shell/shell_list_shortcuts.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../../../ui/adaptive/segmented_bar_overflow.dart';
|
||||
import '../../../ui/status/run_status_icon.dart';
|
||||
import '../pipeline_format.dart';
|
||||
import '../pipeline_models.dart';
|
||||
@@ -322,7 +323,13 @@ List<Widget> pipelineListActions(
|
||||
final label = filters.count == 0
|
||||
? 'Filter pipelines'
|
||||
: '${filters.count} active ${filters.count == 1 ? 'filter' : 'filters'}';
|
||||
final filter = useCupertinoControls(context)
|
||||
final cupertino = useCupertinoControls(context);
|
||||
final filterIcon = cupertino
|
||||
? (filters.count > 0
|
||||
? CupertinoIcons.line_horizontal_3_decrease_circle_fill
|
||||
: CupertinoIcons.line_horizontal_3_decrease_circle)
|
||||
: (filters.count > 0 ? Icons.filter_alt : Icons.filter_alt_outlined);
|
||||
final filter = cupertino
|
||||
? Semantics(
|
||||
button: true,
|
||||
label: label,
|
||||
@@ -332,11 +339,7 @@ List<Widget> pipelineListActions(
|
||||
padding: EdgeInsets.zero,
|
||||
minimumSize: const Size.square(kMinInteractiveDimensionCupertino),
|
||||
onPressed: openFilters,
|
||||
child: Icon(
|
||||
filters.count > 0
|
||||
? CupertinoIcons.line_horizontal_3_decrease_circle_fill
|
||||
: CupertinoIcons.line_horizontal_3_decrease_circle,
|
||||
),
|
||||
child: Icon(filterIcon),
|
||||
),
|
||||
)
|
||||
: IconButton(
|
||||
@@ -344,17 +347,38 @@ List<Widget> pipelineListActions(
|
||||
tooltip: label,
|
||||
isSelected: filters.count > 0,
|
||||
onPressed: openFilters,
|
||||
icon: Icon(
|
||||
filters.count > 0 ? Icons.filter_alt : Icons.filter_alt_outlined,
|
||||
),
|
||||
icon: Icon(filterIcon),
|
||||
);
|
||||
// A narrow bar moves either into its More menu; sorting is then a
|
||||
// submenu (Material) or a second action sheet (Cupertino).
|
||||
return [
|
||||
filter,
|
||||
PipelineSortButton(
|
||||
key: const Key('pipeline-sort'),
|
||||
sort: controller.sort,
|
||||
onSelected: controller.setSort,
|
||||
icon: true,
|
||||
SegmentedOverflowAction(
|
||||
overflowEntry: SegmentedOverflowEntry(
|
||||
label: label,
|
||||
icon: filterIcon,
|
||||
onPressed: openFilters,
|
||||
),
|
||||
child: filter,
|
||||
),
|
||||
SegmentedOverflowAction(
|
||||
overflowEntry: SegmentedOverflowEntry(
|
||||
label: 'Sort pipelines: ${controller.sort.label}',
|
||||
icon: cupertino ? CupertinoIcons.arrow_up_arrow_down : Icons.sort,
|
||||
choices: [
|
||||
for (final option in PipelineSort.values)
|
||||
SegmentedMenuChoice(
|
||||
label: option.label,
|
||||
selected: option == controller.sort,
|
||||
onSelected: () => controller.setSort(option),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: PipelineSortButton(
|
||||
key: const Key('pipeline-sort'),
|
||||
sort: controller.sort,
|
||||
onSelected: controller.setSort,
|
||||
icon: true,
|
||||
),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user