e34fa1050e
- SegmentedBar.titleWidget (and ShellBar/ShellBarSpec titleWidget, backgroundColor): a bar's main pill can be an input in place of the title; Search uses it so the field fills the bar with Kind and info, capped at the result column width so field and results share edges on wide windows. - Templates page/frame drop the top SafeArea again (BelowTopBar gate, TopBarNotices banners); Cupertino uses the grouped background. - Settings on Cupertino in the shell publishes the grouped background so the bar scrim matches the page (no white band or seam). - TopGlassStrip: the run detail header (status, actions, decision, notices) and the Schedules search/filter toolbar float as glass under the bar; tabs and lists scroll behind both. - Stage page: stage title and Visit/Run subtitle in the bar, facts lead the Summary scroll, sections scroll behind the bar under floating tabs. - Tests for content-behind-bar on each page and the title-widget bar mode; notes/chrome-gaps-fixes.md.
100 lines
3.3 KiB
Dart
100 lines
3.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/core/transport/pipelines_client.dart'
|
|
as transport;
|
|
import 'package:pipelines_app/features/settings/settings_group.dart';
|
|
import 'package:pipelines_app/features/settings/settings_screen.dart';
|
|
import 'package:pipelines_app/features/settings/settings_store.dart';
|
|
import 'package:pipelines_app/shell/adaptive_shell.dart';
|
|
import 'package:pipelines_app/shell/destination.dart';
|
|
import 'package:pipelines_app/ui/adaptive/segmented_bar.dart';
|
|
import 'package:pipelines_app/ui/theme/app_theme.dart';
|
|
|
|
import 'fake_channel.dart';
|
|
|
|
/// Settings as the shell's tab: the page runs behind the shell's bar, and on
|
|
/// Cupertino the grouped background reaches the top edge with the bar's
|
|
/// scrim in the same colour, so no white band or seam shows under the bar.
|
|
void main() {
|
|
Future<void> pump(WidgetTester tester, {required bool cupertino}) async {
|
|
await tester.binding.setSurfaceSize(const Size(560, 1000));
|
|
addTearDown(() => tester.binding.setSurfaceSize(null));
|
|
final factory = FakeChannelFactory();
|
|
final client = transport.PipelinesClient(channelFactory: factory.call);
|
|
addTearDown(client.dispose);
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
theme: ThemeData(
|
|
platform: cupertino ? TargetPlatform.iOS : TargetPlatform.android,
|
|
),
|
|
home: AdaptiveShell(
|
|
cupertino: cupertino,
|
|
destination: AppDestination.settings,
|
|
destinationBodies: {
|
|
AppDestination.settings: (_) => SettingsScreen(
|
|
client: client,
|
|
store: MemorySettingsStore(),
|
|
embedded: true,
|
|
),
|
|
},
|
|
),
|
|
),
|
|
);
|
|
await tester.pump();
|
|
await tester.pump();
|
|
}
|
|
|
|
Color scrimOf(WidgetTester tester) => tester
|
|
.widget<ColoredBox>(
|
|
find
|
|
.descendant(
|
|
of: find.byType(SegmentedBar),
|
|
matching: find.byType(ColoredBox),
|
|
)
|
|
.first,
|
|
)
|
|
.color;
|
|
|
|
testWidgets('Cupertino: the grouped background runs under the bar', (
|
|
tester,
|
|
) async {
|
|
await pump(tester, cupertino: true);
|
|
|
|
final grouped = AppColors.groupedBackground.color.toARGB32();
|
|
expect(scrimOf(tester).toARGB32(), grouped);
|
|
// The page's background starts at the top edge, behind the bar.
|
|
final page = find.ancestor(
|
|
of: find.byKey(const ValueKey<String>('settings.scroll')),
|
|
matching: find.byWidgetPredicate(
|
|
(widget) => widget is ColoredBox && widget.color.toARGB32() == grouped,
|
|
),
|
|
);
|
|
expect(page, findsOneWidget);
|
|
expect(tester.getTopLeft(page).dy, 0);
|
|
// The groups start below the bar and scroll behind it.
|
|
final bar = tester.getRect(find.byType(SegmentedBar));
|
|
expect(
|
|
tester.getTopLeft(find.byType(SettingsGroup).first).dy,
|
|
greaterThanOrEqualTo(bar.bottom - 8),
|
|
);
|
|
});
|
|
|
|
testWidgets('Material: the bar keeps the shell page background', (
|
|
tester,
|
|
) async {
|
|
await pump(tester, cupertino: false);
|
|
|
|
final context = tester.element(find.byType(SettingsGroup).first);
|
|
expect(
|
|
scrimOf(tester).toARGB32(),
|
|
Theme.of(context).scaffoldBackgroundColor.toARGB32(),
|
|
);
|
|
expect(
|
|
tester
|
|
.getTopLeft(find.byKey(const ValueKey<String>('settings.scroll')))
|
|
.dy,
|
|
0,
|
|
);
|
|
});
|
|
}
|