Float glass tab bars everywhere the app has bottom tabs
One floating frosted tab bar (host NavigationBar / CupertinoTabBar in the shared GlassPill) replaces the NavigationRail, the Cupertino sidebar and the run detail, stage page and pipeline detail tab strips. Below 600px it spans the width minus 16px margins; wider it is sized to its tabs at the right edge. Content keeps the full width, scrolls behind the bar and learns its height as bottom media padding; lists pad their end clear of it and FABs sit above it. The bar now sizes itself from its own constraints instead of the screen size, which fixes the widget_test failure where a MediaQuery without a size gave it negative width constraints.
This commit is contained in:
@@ -73,13 +73,16 @@ void main() {
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(decisionWaitingTitle), findsOneWidget);
|
||||
// The web's decision banner spans the header, with Decide trailing.
|
||||
// The web's decision banner spans the header at its 16px inset, with
|
||||
// Decide trailing.
|
||||
final banner = tester.getRect(
|
||||
find.byKey(const Key('run-decision-banner')),
|
||||
);
|
||||
final tabs = tester.getRect(find.byKey(const Key('run-detail-tabs')));
|
||||
expect(banner.left, tabs.left);
|
||||
expect(banner.width, greaterThanOrEqualTo(tabs.width));
|
||||
final pane = tester.getRect(
|
||||
find.byKey(const ValueKey('list-detail-body')),
|
||||
);
|
||||
expect(banner.left, pane.left + 16);
|
||||
expect(banner.right, pane.right - 16);
|
||||
expect(
|
||||
tester.getCenter(find.byKey(decisionActionKey)).dx,
|
||||
greaterThan(banner.center.dx),
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:pipelines_app/features/runs/ui/run_more_menu.dart';
|
||||
import 'package:pipelines_app/features/graph/widgets/run_graph_view.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_tab.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_tab_strip.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/glass_pill.dart';
|
||||
|
||||
import 'run_detail_graph_support.dart';
|
||||
|
||||
@@ -48,19 +49,15 @@ void main() {
|
||||
previous = center.dx;
|
||||
}
|
||||
expect(find.byKey(runMoreMenuKey), findsOneWidget);
|
||||
// The strip lines up with the header's 16px inset on both hosts: the
|
||||
// first label sits within its segment's own padding of that inset, not
|
||||
// behind a second 16px control inset (which put it at 48 on Cupertino).
|
||||
expect(
|
||||
tester
|
||||
.getTopLeft(
|
||||
find.descendant(of: strip, matching: find.text('Summary')),
|
||||
)
|
||||
.dx,
|
||||
// Segments share the widest label's width, so a short first label
|
||||
// sits a little in from its edge; a doubled inset would be 48+.
|
||||
lessThan(46),
|
||||
// The tabs are the floating glass bar: on this 900px detail it is sized
|
||||
// to its tabs at the right edge, above the bottom.
|
||||
final pill = tester.getRect(
|
||||
find.descendant(of: strip, matching: find.byType(GlassPill)),
|
||||
);
|
||||
expect(pill.right, 900 - 16);
|
||||
expect(pill.bottom, 1000 - 16);
|
||||
// (The test font draws every glyph a full em wide.)
|
||||
expect(pill.width, lessThan(900 * 0.7));
|
||||
|
||||
for (final tab in [
|
||||
RunDetailTab.timeline,
|
||||
@@ -74,30 +71,50 @@ void main() {
|
||||
}
|
||||
});
|
||||
|
||||
testWidgets('${platform.name} phone tabs sit at the bottom, wide ones '
|
||||
'under the header', (tester) async {
|
||||
testWidgets('${platform.name} tabs float full width on a phone and at '
|
||||
'the right edge when wide, over content that scrolls behind them', (
|
||||
tester,
|
||||
) async {
|
||||
await pumpRunDetail(tester, platform, size: const Size(390, 844));
|
||||
final strip = tester.getRect(find.byKey(const Key('run-detail-tabs')));
|
||||
final body = tester.getRect(
|
||||
find.byKey(const Key('run-detail-tab-body-summary')),
|
||||
final strip = find.byKey(const Key('run-detail-tabs'));
|
||||
final pill = tester.getRect(
|
||||
find.descendant(of: strip, matching: find.byType(GlassPill)),
|
||||
);
|
||||
expect(strip.top, greaterThanOrEqualTo(body.bottom));
|
||||
expect(strip.bottom, greaterThan(844 - 80));
|
||||
final body = find.byKey(const Key('run-detail-tab-body-summary'));
|
||||
// Full width minus the margins, floating above the bottom.
|
||||
expect(pill.left, 16);
|
||||
expect(pill.right, 390 - 16);
|
||||
expect(pill.bottom, 844 - 16);
|
||||
// The tab's content reaches the bottom edge, behind the bar.
|
||||
expect(tester.getRect(body).bottom, 844);
|
||||
// Every tab is on screen without scrolling the bar.
|
||||
for (final tab in renderedRunDetailTabs) {
|
||||
final rect = tester.getRect(runDetailTab(tab));
|
||||
expect(rect.left, greaterThanOrEqualTo(0), reason: tab.name);
|
||||
expect(rect.right, lessThanOrEqualTo(390), reason: tab.name);
|
||||
expect(rect.left, greaterThanOrEqualTo(pill.left), reason: tab.name);
|
||||
expect(rect.right, lessThanOrEqualTo(pill.right), reason: tab.name);
|
||||
}
|
||||
// At rest after scrolling to the end, the last content clears the bar.
|
||||
final scrollable = find.descendant(
|
||||
of: body,
|
||||
matching: find.byType(Scrollable),
|
||||
);
|
||||
final position = tester.state<ScrollableState>(scrollable.first).position;
|
||||
position.jumpTo(position.maxScrollExtent);
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
MediaQuery.paddingOf(tester.element(body)).bottom,
|
||||
greaterThanOrEqualTo(844 - pill.top),
|
||||
);
|
||||
|
||||
await pumpRunDetail(tester, platform, size: const Size(1000, 844));
|
||||
final wideStrip = tester.getRect(
|
||||
find.byKey(const Key('run-detail-tabs')),
|
||||
final widePill = tester.getRect(
|
||||
find.descendant(of: strip, matching: find.byType(GlassPill)),
|
||||
);
|
||||
final wideBody = tester.getRect(
|
||||
find.byKey(const Key('run-detail-tab-body-summary')),
|
||||
);
|
||||
expect(wideStrip.bottom, lessThanOrEqualTo(wideBody.top));
|
||||
expect(widePill.right, 1000 - 16);
|
||||
expect(widePill.bottom, 844 - 16);
|
||||
expect(widePill.width, lessThan(1000 * 0.6));
|
||||
// Beside the bar the content takes taps: the body spans the width.
|
||||
expect(tester.getRect(body).width, 1000);
|
||||
});
|
||||
|
||||
testWidgets('${platform.name} missing graph states the exact wording', (
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:pipelines_app/features/graph/widgets/stage_definition_view.dart'
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_visit_facts.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_visit_sections.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_visit_session_state.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/glass_pill.dart';
|
||||
import 'package:pipelines_app/ui/layout/sticky_section.dart';
|
||||
|
||||
import 'run_detail_graph_support.dart';
|
||||
@@ -236,6 +237,22 @@ void main() {
|
||||
final strip = tester.getRect(find.byType(RunVisitSectionStrip));
|
||||
expect(strip.bottom, size.height, reason: section.name);
|
||||
}
|
||||
// The floating glass bar: full width on a phone, sized to its tabs
|
||||
// at the right edge of a wide page.
|
||||
final pill = tester.getRect(
|
||||
find.descendant(
|
||||
of: find.byType(RunVisitSectionStrip),
|
||||
matching: find.byType(GlassPill),
|
||||
),
|
||||
);
|
||||
expect(pill.right, size.width - 16);
|
||||
expect(pill.bottom, size.height - 16);
|
||||
if (size.width < 600) {
|
||||
expect(pill.left, 16);
|
||||
} else {
|
||||
// (The test font draws every glyph a full em wide.)
|
||||
expect(pill.width, lessThan(size.width * 0.7));
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user