Align wide desktop tabs to leading edge
This commit is contained in:
@@ -9,8 +9,8 @@ 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 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
|
||||
/// bar moves to the leading edge at the bottom of the list pane, including
|
||||
/// after the list's width is dragged. 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 {
|
||||
@@ -128,8 +128,8 @@ void main() {
|
||||
find.byKey(const ValueKey('list-detail-body')),
|
||||
);
|
||||
final pill = destinationPill(tester);
|
||||
// Centred at the bottom of the list pane, never over the detail.
|
||||
expect(pill.center.dx, closeTo(list.center.dx, 0.5));
|
||||
// Leading at the bottom of the list pane, never over the detail.
|
||||
expect(pill.left, closeTo(list.left + kFloatingBarMargin, 0.5));
|
||||
expect(pill.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
|
||||
expect(pill.right, lessThanOrEqualTo(list.right));
|
||||
expect(pill.overlaps(body), isFalse, reason: 'never over the detail');
|
||||
@@ -227,17 +227,24 @@ void main() {
|
||||
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));
|
||||
for (final width in [300.0, 520.0]) {
|
||||
final store = MemoryListPaneWidthStore({'chat': width});
|
||||
await tester.pumpWidget(
|
||||
KeyedSubtree(
|
||||
key: ValueKey(width),
|
||||
child: shell(cupertino: cupertino, store: store),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
final list = tester.getRect(
|
||||
find.byKey(const ValueKey('list-detail-list')),
|
||||
);
|
||||
expect(list.width, closeTo(width, 0.5));
|
||||
final pill = destinationPill(tester);
|
||||
expect(pill.left, closeTo(list.left + kFloatingBarMargin, 0.5));
|
||||
expect(pill.left, greaterThanOrEqualTo(kFloatingBarMargin - 0.5));
|
||||
expect(pill.right, lessThanOrEqualTo(list.right - kFloatingBarMargin));
|
||||
}
|
||||
});
|
||||
|
||||
testWidgets('$host 1200 Settings: a page without a list keeps the bar '
|
||||
@@ -260,10 +267,7 @@ void main() {
|
||||
final pill = destinationPill(tester);
|
||||
// Same place as beside an open item (Search has no split), so opening
|
||||
// or closing an item never moves the bar across the window.
|
||||
expect(
|
||||
pill.center.dx,
|
||||
closeTo(listDetailListWidth(1200, 1200, null) / 2, 0.5),
|
||||
);
|
||||
expect(pill.left, closeTo(kFloatingBarMargin, 0.5));
|
||||
expect(pill.width, lessThan(1200 * 0.6));
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user