Files
pipelines/app/test/features/pipelines/pipeline_tabs_test.dart
T
alan 377ff04aaf 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.
2026-11-02 18:43:05 +00:00

90 lines
3.1 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/pipelines/widgets/pipeline_tabs.dart';
import 'package:pipelines_app/features/pipelines/widgets/pipeline_detail_styles.dart';
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
void main() {
testWidgets('code-like values still use native host typography', (
tester,
) async {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: Builder(
builder: (context) {
expect(
pipelineValueStyle(context, monospace: true),
Theme.of(context).textTheme.bodyMedium,
);
return const SizedBox.shrink();
},
),
),
),
);
});
for (final cupertino in [false, true]) {
for (final width in [320.0, 390.0, 720.0, 1200.0]) {
testWidgets('floating tabs at $width, 2x, Cupertino=$cupertino', (
tester,
) async {
tester.view.physicalSize = Size(width, 640);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
PipelineDetailTab? selected;
final body = Align(
alignment: Alignment.bottomCenter,
child: PipelineDetailTabs(
selected: PipelineDetailTab.summary,
onSelected: (value) => selected = value,
),
);
Widget scaled(BuildContext context, Widget? child) => MediaQuery(
data: MediaQuery.of(
context,
).copyWith(textScaler: TextScaler.linear(2)),
child: child!,
);
await tester.pumpWidget(
cupertino
? CupertinoApp(
builder: scaled,
home: CupertinoPageScaffold(child: body),
)
: MaterialApp(
builder: scaled,
home: Scaffold(body: body),
),
);
await tester.pumpAndSettle();
// One floating bar of separate round tab buttons.
expect(find.byType(FloatingDestinationBar), findsOneWidget);
final pill = tester.getRect(find.byKey(FloatingDestinationBar.rowKey));
// Sized to its three tabs at the right edge, on a phone as when wide.
expect(pill.right, width - 16);
expect(
pill.width,
FloatingDestinationBar.rowWidth(
cupertino: cupertino,
tabs: PipelineDetailTab.values.length,
),
);
for (final tab in PipelineDetailTab.values) {
final rect = tester.getRect(
find.byKey(ValueKey('pipeline-detail-tab-${tab.name}')),
);
expect(rect.left, greaterThanOrEqualTo(pill.left), reason: tab.name);
expect(rect.right, lessThanOrEqualTo(pill.right), reason: tab.name);
}
await tester.tap(find.byKey(const Key('pipeline-detail-tab-source')));
await tester.pumpAndSettle();
expect(selected, PipelineDetailTab.source);
expect(tester.takeException(), isNull);
});
}
}
}