Fix sticky section content overlap

This commit is contained in:
2026-11-01 01:50:17 +00:00
parent 944a26ce1a
commit 977407bcca
2 changed files with 120 additions and 13 deletions
@@ -1,5 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/ui/adaptive/floating_bar_layout.dart';
import 'package:pipelines_app/ui/layout/section_heading.dart';
import 'package:pipelines_app/ui/layout/sticky_section.dart';
@@ -16,6 +18,7 @@ class _HostState extends State<_Host> {
@override
Widget build(BuildContext context) => CustomScrollView(
slivers: [
const SliverTopBarClearance(),
StickySection(
title: 'Input',
open: open,
@@ -48,6 +51,39 @@ void main() {
},
);
for (final host in ['Material', 'Cupertino']) {
testWidgets('pins an opaque section edge below the top bar in $host', (
tester,
) async {
tester.view.physicalSize = const Size(390, 600);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
final child = MediaQuery(
data: const MediaQueryData(padding: EdgeInsets.only(top: 64)),
child: _Host(),
);
await tester.pumpWidget(
host == 'Cupertino'
? CupertinoApp(home: child)
: MaterialApp(home: Scaffold(body: child)),
);
await tester.drag(find.byType(CustomScrollView), const Offset(0, -800));
await tester.pumpAndSettle();
final title = tester.widget<StickySectionTitle>(
find.byType(StickySectionTitle),
);
expect(title.pinned, isTrue);
expect(
find.byWidgetPredicate(
(widget) => widget is Positioned && widget.top == -64,
),
findsOneWidget,
);
});
}
testWidgets('a tap anywhere on the title strip toggles the section', (
tester,
) async {