feat(app): collapsibles keep their titles pinned; stage facts are coloured and grouped; input and output copy
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/ui/layout/sticky_section.dart';
|
||||
|
||||
class _Host extends StatefulWidget {
|
||||
const _Host();
|
||||
|
||||
@override
|
||||
State<_Host> createState() => _HostState();
|
||||
}
|
||||
|
||||
class _HostState extends State<_Host> {
|
||||
bool open = true;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => CustomScrollView(
|
||||
slivers: [
|
||||
StickySection(
|
||||
title: 'Input',
|
||||
open: open,
|
||||
onToggle: () => setState(() => open = !open),
|
||||
body: Column(children: [for (var i = 0; i < 80; i++) Text('line $i')]),
|
||||
),
|
||||
const SliverToBoxAdapter(child: SizedBox(height: 900)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
void main() {
|
||||
testWidgets(
|
||||
'the title stays pinned while its content scrolls and closes it',
|
||||
(tester) async {
|
||||
tester.view.physicalSize = const Size(390, 600);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
await tester.pumpWidget(const MaterialApp(home: Scaffold(body: _Host())));
|
||||
|
||||
await tester.drag(find.byType(CustomScrollView), const Offset(0, -800));
|
||||
await tester.pumpAndSettle();
|
||||
// Deep in the content, the title is still at the top.
|
||||
expect(tester.getTopLeft(find.text('line 0')).dy, lessThan(0));
|
||||
expect(tester.getTopLeft(find.text('Input')).dy, lessThan(40));
|
||||
|
||||
await tester.tap(find.text('Input'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('line 40'), findsNothing);
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user