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:
@@ -1,3 +1,4 @@
|
||||
import '../../../../ui/adaptive/segmented_bar_overflow.dart';
|
||||
import '../../../../ui/theme/app_theme.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -13,7 +14,7 @@ ChatControlsStyle chatControlsStyleOf(BuildContext context) =>
|
||||
? ChatControlsStyle.cupertino
|
||||
: ChatControlsStyle.material;
|
||||
|
||||
class ChatBarAction extends StatelessWidget {
|
||||
class ChatBarAction extends StatelessWidget implements SegmentedOverflowable {
|
||||
const ChatBarAction({
|
||||
super.key,
|
||||
required this.label,
|
||||
@@ -27,6 +28,14 @@ class ChatBarAction extends StatelessWidget {
|
||||
final IconData materialIcon;
|
||||
final IconData cupertinoIcon;
|
||||
|
||||
/// A narrow bar moves it into its More menu, under the bar's host's icon.
|
||||
@override
|
||||
SegmentedOverflowEntry get overflowEntry => SegmentedOverflowEntry(
|
||||
label: label,
|
||||
icon: materialIcon,
|
||||
onPressed: onPressed,
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (chatControlsStyleOf(context) == ChatControlsStyle.cupertino) {
|
||||
|
||||
@@ -62,7 +62,6 @@ class ChatSessionRow extends StatelessWidget {
|
||||
selected: selected,
|
||||
emphasized: unread,
|
||||
divider: divider,
|
||||
keepMenuWhenCompact: true,
|
||||
onTap: () => onOpen(session),
|
||||
onLongPress: onLongPress,
|
||||
accent: chatColorShade(context, chatSessionColor(session)),
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -113,8 +113,8 @@ class RunListRow extends StatelessWidget {
|
||||
: RelativeTimeLabel(instant: createdAt, now: now),
|
||||
subtitle: Text(subtitle),
|
||||
compactSubtitle: Text(compactSubtitle),
|
||||
// A narrow list pane beside the open run leaves the row no room for a
|
||||
// second control; the open run's detail beside it carries the same menu.
|
||||
// Kept in a narrow list pane too, so every run's actions stay one tap
|
||||
// away from the list.
|
||||
menu:
|
||||
!selecting &&
|
||||
gateway != null &&
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../../../ui/adaptive/segmented_bar_overflow.dart';
|
||||
import '../../../ui/layout/app_sheet_header.dart';
|
||||
import '../../pipelines/pipeline_format.dart' show runStateLabel;
|
||||
import 'runs_controller.dart';
|
||||
@@ -160,8 +161,9 @@ class RunsBarActions {
|
||||
VoidCallback onPressed, {
|
||||
bool active = false,
|
||||
}) {
|
||||
final Widget button;
|
||||
if (cupertino) {
|
||||
return Semantics(
|
||||
button = Semantics(
|
||||
button: true,
|
||||
label: label,
|
||||
excludeSemantics: true,
|
||||
@@ -175,13 +177,23 @@ class RunsBarActions {
|
||||
child: Icon(ios),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
button = IconButton(
|
||||
key: key,
|
||||
tooltip: label,
|
||||
isSelected: active,
|
||||
onPressed: onPressed,
|
||||
icon: Icon(material),
|
||||
);
|
||||
}
|
||||
return IconButton(
|
||||
key: key,
|
||||
tooltip: label,
|
||||
isSelected: active,
|
||||
onPressed: onPressed,
|
||||
icon: Icon(material),
|
||||
// A narrow bar moves it into its More menu.
|
||||
return SegmentedOverflowAction(
|
||||
overflowEntry: SegmentedOverflowEntry(
|
||||
label: label,
|
||||
icon: cupertino ? ios : material,
|
||||
onPressed: onPressed,
|
||||
),
|
||||
child: button,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../../../ui/adaptive/segmented_bar_overflow.dart';
|
||||
import '../../../ui/layout/section_heading.dart';
|
||||
import '../actions/delete_runs_action.dart';
|
||||
import '../domain/run_deletion.dart';
|
||||
@@ -24,29 +25,39 @@ ValueKey<String> runsDaySelectKey(String day) =>
|
||||
/// The Runs bar's `Select` action, entering multi-select.
|
||||
Widget runsSelectAction(BuildContext context, RunsController controller) {
|
||||
void enter() => controller.selection.enter();
|
||||
if (usesCupertinoHost(context)) {
|
||||
return Semantics(
|
||||
button: true,
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
// A narrow bar moves it into its More menu.
|
||||
return SegmentedOverflowAction(
|
||||
overflowEntry: SegmentedOverflowEntry(
|
||||
label: 'Select',
|
||||
excludeSemantics: true,
|
||||
onTap: enter,
|
||||
child: CupertinoButton(
|
||||
key: runsSelectKey,
|
||||
padding: EdgeInsets.zero,
|
||||
minimumSize: const Size.square(kMinInteractiveDimensionCupertino),
|
||||
onPressed: enter,
|
||||
child: const Icon(CupertinoIcons.checkmark_circle),
|
||||
),
|
||||
);
|
||||
}
|
||||
return IconButton(
|
||||
key: runsSelectKey,
|
||||
tooltip: 'Select',
|
||||
onPressed: enter,
|
||||
icon: const Icon(Icons.checklist),
|
||||
icon: cupertino ? CupertinoIcons.checkmark_circle : Icons.checklist,
|
||||
onPressed: enter,
|
||||
),
|
||||
child: cupertino
|
||||
? _selectButtonCupertino(enter)
|
||||
: IconButton(
|
||||
key: runsSelectKey,
|
||||
tooltip: 'Select',
|
||||
onPressed: enter,
|
||||
icon: const Icon(Icons.checklist),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _selectButtonCupertino(VoidCallback enter) => Semantics(
|
||||
button: true,
|
||||
label: 'Select',
|
||||
excludeSemantics: true,
|
||||
onTap: enter,
|
||||
child: CupertinoButton(
|
||||
key: runsSelectKey,
|
||||
padding: EdgeInsets.zero,
|
||||
minimumSize: const Size.square(kMinInteractiveDimensionCupertino),
|
||||
onPressed: enter,
|
||||
child: const Icon(CupertinoIcons.checkmark_circle),
|
||||
),
|
||||
);
|
||||
|
||||
/// What the bar shows in select mode: `N selected` over the selection's size,
|
||||
/// then Delete and Done.
|
||||
({String title, String? subtitle, List<Widget> actions}) runsSelectionBar(
|
||||
|
||||
@@ -52,7 +52,6 @@ class SchedulePipelineRow extends StatelessWidget {
|
||||
'${scheduleRuleSummary(schedule)}',
|
||||
),
|
||||
// A narrow Summary still needs a way to pause or delete.
|
||||
keepMenuWhenCompact: true,
|
||||
menu: AppOverflowMenu<_ScheduleAction>(
|
||||
key: scheduleRowMenuKey(id),
|
||||
cupertino: cupertino,
|
||||
|
||||
Reference in New Issue
Block a user