feat(app): icon-only tab bars, Settings from the Pipelines bar, main bar bottom right with detail bars above it
Settings leaves the tab bar (Pipelines, Runs, Chat, Search) and opens as a page from a gear in the Pipelines bar, keeping /settings, its keys and a Back to Pipelines (also the system Back). Every floating tab bar shows icons only, named for assistive technology. On wide windows the shell's tab bar stays at the bottom right; a split detail learns its height plus a 12px gap, so its tabs or the chat composer float above it, and pages the detail opens (the stage page) stay in its pane through its own navigator.
This commit is contained in:
@@ -5,11 +5,13 @@ 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/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 floats over the list pane only: it never covers the item, and the
|
||||
/// item's own bottom control (a composer) owns the pane's bottom edge.
|
||||
/// 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.
|
||||
void main() {
|
||||
Future<void> setSize(WidgetTester tester, Size size) async {
|
||||
tester.view.physicalSize = size;
|
||||
@@ -43,9 +45,36 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
/// A detail with its own floating tabs over a list, like run detail.
|
||||
Widget tabsDetail(bool cupertino) => FloatingBarOverlay(
|
||||
bar: KeyedSubtree(
|
||||
key: const Key('detail-tabs'),
|
||||
child: FloatingDestinationBar(
|
||||
cupertino: cupertino,
|
||||
currentIndex: 0,
|
||||
onTap: (_) {},
|
||||
items: const [
|
||||
FloatingDestinationItem(icon: Icon(Icons.summarize), label: 'One'),
|
||||
FloatingDestinationItem(icon: Icon(Icons.timeline), label: 'Two'),
|
||||
FloatingDestinationItem(icon: Icon(Icons.inventory), label: 'Three'),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: Builder(
|
||||
builder: (context) => ListView(
|
||||
key: const Key('detail-list'),
|
||||
children: [
|
||||
for (var index = 0; index < 40; index++)
|
||||
SizedBox(height: 40, child: Text('item $index')),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Widget shell({
|
||||
required bool cupertino,
|
||||
bool split = true,
|
||||
bool tabs = false,
|
||||
double textScale = 1,
|
||||
}) {
|
||||
final app = AdaptiveShell(
|
||||
@@ -53,7 +82,10 @@ void main() {
|
||||
destination: AppDestination.chat,
|
||||
destinationBodies: {
|
||||
AppDestination.chat: (_) => split
|
||||
? ListDetailPanes(list: listBody(), detail: composerDetail())
|
||||
? ListDetailPanes(
|
||||
list: listBody(),
|
||||
detail: tabs ? tabsDetail(cupertino) : composerDetail(),
|
||||
)
|
||||
: listBody(),
|
||||
},
|
||||
);
|
||||
@@ -78,8 +110,8 @@ void main() {
|
||||
final host = cupertino ? 'Cupertino' : 'Material';
|
||||
|
||||
for (final width in [1200.0, 1600.0]) {
|
||||
testWidgets('$host $width split: the destination bar stays over the '
|
||||
'list pane and the composer owns the detail bottom', (tester) async {
|
||||
testWidgets('$host $width split: the destination bar stays bottom '
|
||||
'right and the composer floats above it', (tester) async {
|
||||
await setSize(tester, Size(width, 800));
|
||||
await tester.pumpWidget(shell(cupertino: cupertino));
|
||||
await tester.pump();
|
||||
@@ -92,23 +124,59 @@ void main() {
|
||||
find.byKey(const ValueKey('list-detail-body')),
|
||||
);
|
||||
final pill = destinationPill(tester);
|
||||
expect(pill.right, lessThanOrEqualTo(list.right));
|
||||
expect(pill.left, greaterThanOrEqualTo(list.left));
|
||||
expect(pill.overlaps(body), isFalse, reason: 'no overlap with detail');
|
||||
// Compact at the window's right edge, over the detail pane only.
|
||||
expect(pill.right, closeTo(width - kFloatingBarMargin, 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));
|
||||
|
||||
// The detail keeps only the system inset (none here): its composer
|
||||
// reaches the bottom edge, below the level of the shell's pill.
|
||||
// The composer's box starts a gap above the shell's pill (the real
|
||||
// composer pads its pill by another 12 inside that box).
|
||||
final composer = tester.getRect(find.byKey(const Key('composer')));
|
||||
expect(composer.bottom, 800);
|
||||
expect(composer.left, body.left);
|
||||
expect(composer.top, greaterThan(pill.top));
|
||||
expect(composer.overlaps(pill), isFalse);
|
||||
expect(pill.top - composer.bottom, closeTo(kStackedBarGap, 0.5));
|
||||
|
||||
// The list still clears the bar.
|
||||
// The list is not under the bar: it clears only the system inset.
|
||||
final listContext = tester.element(find.byKey(const Key('list')));
|
||||
expect(MediaQuery.paddingOf(listContext).bottom, 0);
|
||||
});
|
||||
|
||||
testWidgets('$host $width split: the item tabs float above the '
|
||||
'destination bar with a gap, and its content clears both', (
|
||||
tester,
|
||||
) async {
|
||||
await setSize(tester, Size(width, 800));
|
||||
await tester.pumpWidget(shell(cupertino: cupertino, tabs: true));
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
|
||||
final body = tester.getRect(
|
||||
find.byKey(const ValueKey('list-detail-body')),
|
||||
);
|
||||
final pill = destinationPill(tester);
|
||||
final tabs = tester.getRect(
|
||||
find
|
||||
.descendant(
|
||||
of: find.byKey(const Key('detail-tabs')),
|
||||
matching: find.byType(GlassPill),
|
||||
)
|
||||
.first,
|
||||
);
|
||||
expect(pill.right, closeTo(width - kFloatingBarMargin, 0.5));
|
||||
expect(tabs.right, closeTo(width - kFloatingBarMargin, 0.5));
|
||||
expect(tabs.left, greaterThan(body.left));
|
||||
expect(tabs.overlaps(pill), isFalse);
|
||||
expect(pill.top - tabs.bottom, closeTo(kStackedBarGap, 0.5));
|
||||
|
||||
// The item's list pads its end clear of both pills.
|
||||
final listContext = tester.element(
|
||||
find.byKey(const Key('detail-list')),
|
||||
);
|
||||
expect(
|
||||
MediaQuery.paddingOf(listContext).bottom,
|
||||
greaterThanOrEqualTo(pill.height),
|
||||
closeTo(800 - tabs.top, 0.5),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -134,17 +202,21 @@ void main() {
|
||||
});
|
||||
|
||||
for (final width in [600.0, 840.0]) {
|
||||
testWidgets('$host $width split at 2x: the narrow list pane bar lays '
|
||||
'out without overflow', (tester) async {
|
||||
testWidgets('$host $width split at 2x: both bars lay out over the '
|
||||
'detail pane without overflow', (tester) async {
|
||||
await setSize(tester, Size(width, 800));
|
||||
await tester.pumpWidget(shell(cupertino: cupertino, textScale: 2));
|
||||
await tester.pumpWidget(
|
||||
shell(cupertino: cupertino, tabs: true, textScale: 2),
|
||||
);
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
expect(tester.takeException(), isNull);
|
||||
final list = tester.getRect(
|
||||
find.byKey(const ValueKey('list-detail-list')),
|
||||
final body = tester.getRect(
|
||||
find.byKey(const ValueKey('list-detail-body')),
|
||||
);
|
||||
expect(destinationPill(tester).right, lessThanOrEqualTo(list.right));
|
||||
final pill = destinationPill(tester);
|
||||
expect(pill.left, greaterThanOrEqualTo(body.left));
|
||||
expect(pill.right, closeTo(width - kFloatingBarMargin, 0.5));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user