Shell: on wide split layouts the destination tabs sit under the list pane
The four destination buttons move from the bottom right over the detail pane to the bottom of the list pane, centred in the (dragged) list width. The list now keeps the bar's height as bottom clearance; the detail pane clears only the system inset, so its tabs, the chat composer and the artifact actions sit at its bottom edge. Phone layout is unchanged. kStackedBarGap is gone with the stacked bars.
This commit is contained in:
@@ -151,7 +151,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('$host 1200: the item\'s tabs float at the bottom of its '
|
||||
'pane, above the shell\'s tab bar', (tester) async {
|
||||
'pane, the shell\'s tab bar under the list', (tester) async {
|
||||
await setSize(tester, const Size(1200, 800));
|
||||
await tester.pumpWidget(shell(cupertino: cupertino));
|
||||
await tester.pump();
|
||||
@@ -174,11 +174,15 @@ void main() {
|
||||
final body = tester.getRect(
|
||||
find.byKey(const ValueKey('list-detail-body')),
|
||||
);
|
||||
// The shell's tabs keep the bottom right; the item's float a gap
|
||||
// above them in the detail pane, never on them.
|
||||
// The shell's tabs sit at the bottom of the list pane; the item's at
|
||||
// the bottom right of the detail pane, never on them.
|
||||
final list = tester.getRect(
|
||||
find.byKey(const ValueKey('list-detail-list')),
|
||||
);
|
||||
expect(shellTabs.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
|
||||
expect(shellTabs.right, closeTo(1200 - kFloatingBarMargin, 0.5));
|
||||
expect(itemTabs.bottom, closeTo(shellTabs.top - kStackedBarGap, 0.5));
|
||||
expect(shellTabs.right, lessThanOrEqualTo(list.right));
|
||||
expect(itemTabs.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
|
||||
expect(itemTabs.right, closeTo(1200 - kFloatingBarMargin, 0.5));
|
||||
expect(itemTabs.left, greaterThanOrEqualTo(body.left));
|
||||
expect(itemTabs.overlaps(shellTabs), isFalse);
|
||||
// The item's list starts below its bar and clears its tabs at rest.
|
||||
|
||||
@@ -4,13 +4,14 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/shell/adaptive_shell.dart';
|
||||
import 'package:pipelines_app/shell/destination.dart';
|
||||
import 'package:pipelines_app/shell/list_detail.dart';
|
||||
import 'package:pipelines_app/shell/list_pane_widths.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/floating_bar_layout.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
|
||||
|
||||
/// While a tab shows its list beside an open item, the shell's destination
|
||||
/// bar keeps its place at the bottom right (near the thumb). The item's own
|
||||
/// bottom control (its tabs, or a composer) floats above it with a gap, and
|
||||
/// the item's content clears both.
|
||||
/// bar moves to the bottom of the list pane, centred in the list's (dragged)
|
||||
/// width. The list clears the bar; the item keeps its whole height, its own
|
||||
/// bottom control (its tabs, or a composer) at its bottom edge.
|
||||
void main() {
|
||||
Future<void> setSize(WidgetTester tester, Size size) async {
|
||||
tester.view.physicalSize = size;
|
||||
@@ -75,9 +76,11 @@ void main() {
|
||||
bool split = true,
|
||||
bool tabs = false,
|
||||
double textScale = 1,
|
||||
ListPaneWidthStore? store,
|
||||
}) {
|
||||
final app = AdaptiveShell(
|
||||
cupertino: cupertino,
|
||||
listPaneWidthStore: store ?? MemoryListPaneWidthStore(),
|
||||
destination: AppDestination.chat,
|
||||
destinationBodies: {
|
||||
AppDestination.chat: (_) => split
|
||||
@@ -109,8 +112,8 @@ void main() {
|
||||
final host = cupertino ? 'Cupertino' : 'Material';
|
||||
|
||||
for (final width in [1200.0, 1600.0]) {
|
||||
testWidgets('$host $width split: the destination bar stays bottom '
|
||||
'right and the composer floats above it', (tester) async {
|
||||
testWidgets('$host $width split: the destination bar sits under the '
|
||||
'list and the composer at the detail\'s bottom edge', (tester) async {
|
||||
await setSize(tester, Size(width, 800));
|
||||
await tester.pumpWidget(shell(cupertino: cupertino));
|
||||
await tester.pump();
|
||||
@@ -123,29 +126,40 @@ void main() {
|
||||
find.byKey(const ValueKey('list-detail-body')),
|
||||
);
|
||||
final pill = destinationPill(tester);
|
||||
// Compact at the window's right edge, over the detail pane only.
|
||||
expect(pill.right, closeTo(width - kFloatingBarMargin, 0.5));
|
||||
// Centred at the bottom of the list pane, never over the detail.
|
||||
expect(pill.center.dx, closeTo(list.center.dx, 0.5));
|
||||
expect(pill.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
|
||||
expect(pill.width, lessThan(body.width / 2));
|
||||
expect(pill.overlaps(list), isFalse, reason: 'never over the list');
|
||||
expect(pill.left, greaterThan(body.left));
|
||||
expect(pill.right, lessThanOrEqualTo(list.right));
|
||||
expect(pill.overlaps(body), isFalse, reason: 'never over the detail');
|
||||
expect(
|
||||
pill.width,
|
||||
FloatingDestinationBar.rowWidth(cupertino: cupertino, tabs: 4),
|
||||
);
|
||||
|
||||
// The composer's box starts a gap above the shell's pill (the real
|
||||
// composer pads its pill by another 12 inside that box).
|
||||
// The composer reaches the detail's bottom edge: nothing is reserved
|
||||
// there for the shell's bar any more.
|
||||
final composer = tester.getRect(find.byKey(const Key('composer')));
|
||||
expect(composer.left, body.left);
|
||||
expect(composer.bottom, closeTo(800, 0.5));
|
||||
expect(composer.overlaps(pill), isFalse);
|
||||
expect(pill.top - composer.bottom, closeTo(kStackedBarGap, 0.5));
|
||||
|
||||
// The list is not under the bar: it clears only the system inset.
|
||||
// The list clears the bar, so its last rows scroll out from under it.
|
||||
final listContext = tester.element(find.byKey(const Key('list')));
|
||||
expect(MediaQuery.paddingOf(listContext).bottom, 0);
|
||||
expect(
|
||||
MediaQuery.paddingOf(listContext).bottom,
|
||||
greaterThanOrEqualTo(800 - pill.top),
|
||||
);
|
||||
await tester.drag(
|
||||
find.byKey(const Key('list')),
|
||||
const Offset(0, -4000),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
final last = tester.getRect(find.text('row 39'));
|
||||
expect(last.bottom, lessThanOrEqualTo(pill.top));
|
||||
});
|
||||
|
||||
testWidgets('$host $width split: the item tabs float above the '
|
||||
'destination bar with a gap, and its content clears both', (
|
||||
tester,
|
||||
) async {
|
||||
testWidgets('$host $width split: the item tabs sit at the bottom right '
|
||||
'of the detail, and its content clears only them', (tester) async {
|
||||
await setSize(tester, Size(width, 800));
|
||||
await tester.pumpWidget(shell(cupertino: cupertino, tabs: true));
|
||||
await tester.pump();
|
||||
@@ -163,13 +177,13 @@ void main() {
|
||||
)
|
||||
.first,
|
||||
);
|
||||
expect(pill.right, closeTo(width - kFloatingBarMargin, 0.5));
|
||||
expect(tabs.right, closeTo(width - kFloatingBarMargin, 0.5));
|
||||
expect(tabs.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
|
||||
expect(tabs.left, greaterThan(body.left));
|
||||
expect(tabs.overlaps(pill), isFalse);
|
||||
expect(pill.top - tabs.bottom, closeTo(kStackedBarGap, 0.5));
|
||||
expect(pill.right, lessThan(body.left));
|
||||
|
||||
// The item's list pads its end clear of both pills.
|
||||
// The item's list pads its end clear of its own tabs.
|
||||
final listContext = tester.element(
|
||||
find.byKey(const Key('detail-list')),
|
||||
);
|
||||
@@ -180,6 +194,23 @@ void main() {
|
||||
});
|
||||
}
|
||||
|
||||
testWidgets('$host 1200 split: the bar follows a dragged list width', (
|
||||
tester,
|
||||
) async {
|
||||
await setSize(tester, const Size(1200, 800));
|
||||
final store = MemoryListPaneWidthStore({'chat': 300});
|
||||
await tester.pumpWidget(shell(cupertino: cupertino, store: store));
|
||||
await tester.pumpAndSettle();
|
||||
final list = tester.getRect(
|
||||
find.byKey(const ValueKey('list-detail-list')),
|
||||
);
|
||||
expect(list.width, closeTo(300, 0.5));
|
||||
final pill = destinationPill(tester);
|
||||
expect(pill.center.dx, closeTo(list.center.dx, 0.5));
|
||||
expect(pill.left, greaterThanOrEqualTo(kFloatingBarMargin - 0.5));
|
||||
expect(pill.right, lessThanOrEqualTo(list.right - kFloatingBarMargin));
|
||||
});
|
||||
|
||||
testWidgets('$host 1200 unsplit: the bar is compact at the right edge', (
|
||||
tester,
|
||||
) async {
|
||||
@@ -205,8 +236,8 @@ void main() {
|
||||
});
|
||||
|
||||
for (final width in [600.0, 840.0]) {
|
||||
testWidgets('$host $width split at 2x: both bars lay out over the '
|
||||
'detail pane without overflow', (tester) async {
|
||||
testWidgets('$host $width split at 2x: the bar fits the list pane and '
|
||||
'the item tabs the detail, without overflow', (tester) async {
|
||||
await setSize(tester, Size(width, 800));
|
||||
await tester.pumpWidget(
|
||||
shell(cupertino: cupertino, tabs: true, textScale: 2),
|
||||
@@ -214,12 +245,12 @@ void main() {
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
expect(tester.takeException(), isNull);
|
||||
final body = tester.getRect(
|
||||
find.byKey(const ValueKey('list-detail-body')),
|
||||
final list = tester.getRect(
|
||||
find.byKey(const ValueKey('list-detail-list')),
|
||||
);
|
||||
final pill = destinationPill(tester);
|
||||
expect(pill.left, greaterThanOrEqualTo(body.left));
|
||||
expect(pill.right, closeTo(width - kFloatingBarMargin, 0.5));
|
||||
expect(pill.left, greaterThanOrEqualTo(list.left));
|
||||
expect(pill.right, lessThanOrEqualTo(list.right));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,23 +78,26 @@ void main() {
|
||||
for (final cupertino in [false, true]) {
|
||||
final host = cupertino ? 'Cupertino' : 'Material';
|
||||
|
||||
testWidgets('$host 1200: run tabs float above the shell bar, and the '
|
||||
'stage page opens in the pane with its tabs above it too', (
|
||||
testWidgets('$host 1200: run tabs float at the pane\'s bottom beside the '
|
||||
'shell bar under the list, and the stage page opens in the pane', (
|
||||
tester,
|
||||
) async {
|
||||
await pumpSplitRun(tester, cupertino);
|
||||
final body = tester.getRect(
|
||||
find.byKey(const ValueKey('list-detail-body')),
|
||||
);
|
||||
final list = tester.getRect(
|
||||
find.byKey(const ValueKey('list-detail-list')),
|
||||
);
|
||||
var main = shellPill(tester);
|
||||
expect(main.right, closeTo(1200 - kFloatingBarMargin, 0.5));
|
||||
expect(main.center.dx, closeTo(list.center.dx, 0.5));
|
||||
expect(main.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
|
||||
|
||||
final runTabs = pillOf(tester, find.byKey(const Key('run-detail-tabs')));
|
||||
expect(runTabs.left, greaterThanOrEqualTo(body.left));
|
||||
expect(runTabs.right, closeTo(1200 - kFloatingBarMargin, 0.5));
|
||||
expect(runTabs.overlaps(main), isFalse);
|
||||
expect(main.top - runTabs.bottom, closeTo(kStackedBarGap, 0.5));
|
||||
expect(runTabs.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
|
||||
|
||||
// Open the stage page from the timeline.
|
||||
await openRunDetailTab(tester, RunDetailTab.timeline);
|
||||
@@ -115,14 +118,14 @@ void main() {
|
||||
final back = tester.getRect(find.byKey(const Key('run-visit-back')));
|
||||
expect(back.left, greaterThanOrEqualTo(body.left));
|
||||
main = shellPill(tester);
|
||||
expect(main.right, closeTo(1200 - kFloatingBarMargin, 0.5));
|
||||
expect(main.center.dx, closeTo(list.center.dx, 0.5));
|
||||
final visitTabs = pillOf(
|
||||
tester,
|
||||
find.byKey(const Key('run-visit-tabs')).last,
|
||||
);
|
||||
expect(visitTabs.left, greaterThanOrEqualTo(body.left));
|
||||
expect(visitTabs.overlaps(main), isFalse);
|
||||
expect(main.top - visitTabs.bottom, closeTo(kStackedBarGap, 0.5));
|
||||
expect(visitTabs.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
|
||||
expect(tester.takeException(), isNull);
|
||||
|
||||
// The shell's tabs still work over the open stage page.
|
||||
|
||||
@@ -162,8 +162,8 @@ void main() {
|
||||
expect(tester.getTopLeft(find.byKey(const Key('item-list'))).dy, 0);
|
||||
});
|
||||
|
||||
testWidgets('$host split: the item tabs float above the shell tab bar '
|
||||
'at the bottom right of the detail pane', (tester) async {
|
||||
testWidgets('$host split: the item tabs sit at the bottom right of the '
|
||||
'detail pane, the shell tab bar under the list', (tester) async {
|
||||
// A gesture-navigation inset as on the unfolded foldable.
|
||||
await setUp(tester, const Size(1200, 800), bottom: 24);
|
||||
await tester.pumpWidget(shell(cupertino, tabbedItem));
|
||||
@@ -189,13 +189,16 @@ void main() {
|
||||
)
|
||||
.first,
|
||||
);
|
||||
// The shell's bar keeps the bottom right, above the system inset; the
|
||||
// item's tabs sit a gap above it, both at the trailing edge.
|
||||
// Both bars sit above the system inset: the shell's under the list
|
||||
// pane, the item's at the detail pane's trailing edge.
|
||||
final listPane = tester.getRect(
|
||||
find.byKey(const ValueKey('list-detail-list')),
|
||||
);
|
||||
expect(shellTabs.bottom, closeTo(800 - 24, 0.5));
|
||||
expect(shellTabs.right, closeTo(1200 - kFloatingBarMargin, 0.5));
|
||||
expect(shellTabs.right, lessThanOrEqualTo(listPane.right));
|
||||
expect(tabs.bottom, closeTo(800 - 24, 0.5));
|
||||
expect(tabs.right, closeTo(1200 - kFloatingBarMargin, 0.5));
|
||||
expect(shellTabs.overlaps(tabs), isFalse);
|
||||
expect(shellTabs.top - tabs.bottom, closeTo(kStackedBarGap, 0.5));
|
||||
// The item's list clears its tabs at rest.
|
||||
final list = tester.element(find.byKey(const Key('item-list')));
|
||||
expect(
|
||||
|
||||
Reference in New Issue
Block a user