Show each floating tab as its own round glass button
Replace the single glass pill (host NavigationBar/CupertinoTabBar with one gliding highlight) with a row of separate circular GlassPill buttons, 52/50 px with 12/10 px gaps, at the same bottom-right place. The selected button fills with the host selection tint and cross-fades; each button pops in on its own, staggered, only when the bar appears or its tabs change; presses sink like the top bar's. Tab semantics, keys, tooltips and badges are kept; the row shares one BackdropGroup for its blurs.
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/shell/adaptive_shell.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
|
||||
|
||||
/// The Runs tab mirrors the attention count in every mount of both hosts:
|
||||
/// the floating tab bar at full width on a phone and right-aligned on a wide
|
||||
@@ -35,7 +36,7 @@ void main() {
|
||||
) async {
|
||||
final semantics = tester.ensureSemantics();
|
||||
await pumpShell(tester, width: width, cupertino: false, count: 3);
|
||||
expect(find.byType(NavigationBar), findsOneWidget);
|
||||
expect(find.byType(FloatingDestinationBar), findsOneWidget);
|
||||
expect(find.byType(NavigationRail), findsNothing);
|
||||
final badge = find.byType(Badge);
|
||||
expect(badge, findsOneWidget);
|
||||
@@ -74,7 +75,7 @@ void main() {
|
||||
) async {
|
||||
final semantics = tester.ensureSemantics();
|
||||
await pumpShell(tester, width: width, cupertino: true, count: 3);
|
||||
expect(find.byType(CupertinoTabBar), findsOneWidget);
|
||||
expect(find.byType(FloatingDestinationBar), findsOneWidget);
|
||||
expect(find.byType(Badge), findsNothing, reason: 'no Material badge');
|
||||
expect(find.text('3'), findsOneWidget);
|
||||
expect(find.bySemanticsLabel(needingAttention), findsOneWidget);
|
||||
|
||||
@@ -4,14 +4,13 @@ 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/ui/adaptive/floating_destination_bar.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/glass_pill.dart';
|
||||
|
||||
/// The shell's one floating glass tab bar: full width on a phone, sized to its
|
||||
/// tabs at the right edge on a wide window, with content behind it.
|
||||
void main() {
|
||||
Finder pill() => find.descendant(
|
||||
of: find.byType(FloatingDestinationBar),
|
||||
matching: find.byType(GlassPill),
|
||||
matching: find.byKey(FloatingDestinationBar.rowKey),
|
||||
);
|
||||
|
||||
Future<void> setSize(WidgetTester tester, Size size) async {
|
||||
@@ -56,7 +55,7 @@ void main() {
|
||||
final rect = tester.getRect(pill());
|
||||
expect(
|
||||
rect.width,
|
||||
FloatingDestinationBar.pillWidth(cupertino: cupertino, tabs: 4),
|
||||
FloatingDestinationBar.rowWidth(cupertino: cupertino, tabs: 4),
|
||||
);
|
||||
expect(rect.right, 390 - 16);
|
||||
expect(rect.bottom, 844 - 16);
|
||||
@@ -81,7 +80,7 @@ void main() {
|
||||
// Four icon-only tabs, with the wider neighbour gaps derived by the bar.
|
||||
expect(
|
||||
rect.width,
|
||||
FloatingDestinationBar.pillWidth(cupertino: cupertino, tabs: 4),
|
||||
FloatingDestinationBar.rowWidth(cupertino: cupertino, tabs: 4),
|
||||
);
|
||||
// No rail or sidebar: the content starts at the left edge.
|
||||
expect(find.byType(NavigationRail), findsNothing);
|
||||
@@ -135,7 +134,7 @@ void main() {
|
||||
await tester.pump();
|
||||
expect(
|
||||
tester.getRect(pill()).width,
|
||||
FloatingDestinationBar.pillWidth(cupertino: cupertino, tabs: 4),
|
||||
FloatingDestinationBar.rowWidth(cupertino: cupertino, tabs: 4),
|
||||
);
|
||||
expect(tester.getRect(pill()).right, 390 - 16);
|
||||
expect(tester.state(find.byType(StatefulBuilder)), same(state));
|
||||
@@ -199,7 +198,7 @@ void main() {
|
||||
// Sized to its four tabs at the right, as on any width.
|
||||
expect(
|
||||
tester.getRect(pill()).width,
|
||||
FloatingDestinationBar.pillWidth(cupertino: cupertino, tabs: 4),
|
||||
FloatingDestinationBar.rowWidth(cupertino: cupertino, tabs: 4),
|
||||
);
|
||||
expect(tester.getRect(pill()).right, 320 - 16);
|
||||
}
|
||||
|
||||
@@ -161,14 +161,14 @@ void main() {
|
||||
find
|
||||
.ancestor(
|
||||
of: find.byKey(const ValueKey('shell.destination.runs')).first,
|
||||
matching: find.byType(GlassPill),
|
||||
matching: find.byKey(FloatingDestinationBar.rowKey),
|
||||
)
|
||||
.first,
|
||||
);
|
||||
final itemTabs = tester.getRect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('item-tabs')),
|
||||
matching: find.byType(GlassPill),
|
||||
matching: find.byKey(FloatingDestinationBar.rowKey),
|
||||
),
|
||||
);
|
||||
final body = tester.getRect(
|
||||
@@ -214,7 +214,7 @@ void main() {
|
||||
final tabs = tester.getRect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('item-tabs')),
|
||||
matching: find.byType(GlassPill),
|
||||
matching: find.byKey(FloatingDestinationBar.rowKey),
|
||||
),
|
||||
);
|
||||
expect(tabs.bottom, greaterThan(844 - 40));
|
||||
|
||||
@@ -5,7 +5,6 @@ import 'package:pipelines_app/shell/adaptive_shell.dart';
|
||||
import 'package:pipelines_app/shell/destination.dart';
|
||||
import 'package:pipelines_app/shell/shell_bar.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/glass_pill.dart';
|
||||
|
||||
Widget _app({required bool cupertino, required bool open, VoidCallback? back}) {
|
||||
final shell = AdaptiveShell(
|
||||
@@ -88,12 +87,12 @@ void main() {
|
||||
|
||||
final destinationPill = find.descendant(
|
||||
of: find.byType(FloatingDestinationBar),
|
||||
matching: find.byType(GlassPill),
|
||||
matching: find.byKey(FloatingDestinationBar.rowKey),
|
||||
);
|
||||
// Sized to its four tabs at the bottom right.
|
||||
expect(
|
||||
tester.getSize(destinationPill).width,
|
||||
FloatingDestinationBar.pillWidth(cupertino: cupertino, tabs: 4),
|
||||
FloatingDestinationBar.rowWidth(cupertino: cupertino, tabs: 4),
|
||||
);
|
||||
expect(tester.getRect(destinationPill).right, 390 - 16);
|
||||
await tester.tap(find.byKey(const ValueKey('shell.destination.chat')));
|
||||
@@ -154,7 +153,7 @@ void main() {
|
||||
),
|
||||
);
|
||||
await tester.pumpWidget(shell());
|
||||
expect(find.byType(NavigationBar), findsOneWidget);
|
||||
expect(find.byType(FloatingDestinationBar), findsOneWidget);
|
||||
final navigator = tester.state<NavigatorState>(find.byType(Navigator));
|
||||
navigator.push(
|
||||
MaterialPageRoute<void>(
|
||||
@@ -162,13 +161,16 @@ void main() {
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(NavigationBar), findsNothing);
|
||||
expect(find.byType(NavigationBar, skipOffstage: false), findsOneWidget);
|
||||
expect(find.byType(FloatingDestinationBar), findsNothing);
|
||||
expect(
|
||||
find.byType(FloatingDestinationBar, skipOffstage: false),
|
||||
findsOneWidget,
|
||||
);
|
||||
await navigator.maybePop();
|
||||
await tester.pump(const Duration(milliseconds: 16));
|
||||
expect(find.byType(NavigationBar), findsOneWidget);
|
||||
expect(find.byType(FloatingDestinationBar), findsOneWidget);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(NavigationBar), findsOneWidget);
|
||||
expect(find.byType(FloatingDestinationBar), findsOneWidget);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import 'package:pipelines_app/shell/destination.dart';
|
||||
import 'package:pipelines_app/shell/list_detail.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/floating_bar_layout.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/glass_pill.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
|
||||
@@ -101,7 +100,7 @@ void main() {
|
||||
find
|
||||
.ancestor(
|
||||
of: find.byKey(const ValueKey('shell.destination.chat')).first,
|
||||
matching: find.byType(GlassPill),
|
||||
matching: find.byKey(FloatingDestinationBar.rowKey),
|
||||
)
|
||||
.first,
|
||||
);
|
||||
@@ -160,7 +159,7 @@ void main() {
|
||||
find
|
||||
.descendant(
|
||||
of: find.byKey(const Key('detail-tabs')),
|
||||
matching: find.byType(GlassPill),
|
||||
matching: find.byKey(FloatingDestinationBar.rowKey),
|
||||
)
|
||||
.first,
|
||||
);
|
||||
@@ -200,7 +199,7 @@ void main() {
|
||||
final pill = destinationPill(tester);
|
||||
expect(
|
||||
pill.width,
|
||||
FloatingDestinationBar.pillWidth(cupertino: cupertino, tabs: 4),
|
||||
FloatingDestinationBar.rowWidth(cupertino: cupertino, tabs: 4),
|
||||
);
|
||||
expect(pill.right, closeTo(390 - kFloatingBarMargin, 0.5));
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ import 'package:pipelines_app/shell/destination.dart';
|
||||
import 'package:pipelines_app/shell/detail_page.dart';
|
||||
import 'package:pipelines_app/shell/list_detail.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/floating_bar_layout.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/glass_pill.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
|
||||
|
||||
import '../features/runs/ui/run_detail_graph_support.dart';
|
||||
import '../features/runs/ui/run_detail_visit_support.dart';
|
||||
@@ -21,14 +21,17 @@ import '../features/runs/ui/run_detail_visit_support.dart';
|
||||
/// the detail pane instead of covering the shell.
|
||||
void main() {
|
||||
Rect pillOf(WidgetTester tester, Finder owner) => tester.getRect(
|
||||
find.descendant(of: owner, matching: find.byType(GlassPill)).first,
|
||||
find.descendant(
|
||||
of: owner,
|
||||
matching: find.byKey(FloatingDestinationBar.rowKey),
|
||||
),
|
||||
);
|
||||
|
||||
Rect shellPill(WidgetTester tester) => tester.getRect(
|
||||
find
|
||||
.ancestor(
|
||||
of: find.byKey(const ValueKey('shell.destination.runs')).first,
|
||||
matching: find.byType(GlassPill),
|
||||
matching: find.byKey(FloatingDestinationBar.rowKey),
|
||||
)
|
||||
.first,
|
||||
);
|
||||
|
||||
@@ -171,14 +171,19 @@ void main() {
|
||||
final body = tester.getRect(
|
||||
find.byKey(const ValueKey('list-detail-body')),
|
||||
);
|
||||
final tabs = pillsOf(tester, find.byKey(const Key('item-tabs'))).single;
|
||||
final tabs = tester.getRect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('item-tabs')),
|
||||
matching: find.byKey(FloatingDestinationBar.rowKey),
|
||||
),
|
||||
);
|
||||
expect(tabs.left, greaterThanOrEqualTo(body.left));
|
||||
expect(tabs.right, lessThanOrEqualTo(body.right));
|
||||
final shellTabs = tester.getRect(
|
||||
find
|
||||
.ancestor(
|
||||
of: find.byKey(const ValueKey('shell.destination.runs')).first,
|
||||
matching: find.byType(GlassPill),
|
||||
matching: find.byKey(FloatingDestinationBar.rowKey),
|
||||
)
|
||||
.first,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user