Keep chat controls readable and expose labeled app navigation
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/segmented_bar_overlay.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('reserved header gives scrolling text an independent viewport', (
|
||||
tester,
|
||||
) async {
|
||||
final scroll = ScrollController();
|
||||
addTearDown(scroll.dispose);
|
||||
double? topPadding;
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SegmentedBarOverlay(
|
||||
reserveSpace: true,
|
||||
bar: const SizedBox(key: Key('header'), height: 80),
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
topPadding = MediaQuery.paddingOf(context).top;
|
||||
return ListView(
|
||||
controller: scroll,
|
||||
children: List.generate(
|
||||
50,
|
||||
(i) => ListTile(title: Text('Line $i')),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(
|
||||
tester.getTopLeft(find.byType(ListView)).dy,
|
||||
tester.getBottomLeft(find.byKey(const Key('header'))).dy,
|
||||
);
|
||||
expect(topPadding, 0);
|
||||
await tester.drag(find.byType(ListView), const Offset(0, -300));
|
||||
await tester.pumpAndSettle();
|
||||
expect(scroll.offset, greaterThan(0));
|
||||
expect(tester.getTopLeft(find.byType(ListView)).dy, 80);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user