9551eceaed
Remove obsolete control-family flags and icon metadata across all callers, dead alternate themes and host helpers, obsolete test setup, and the unused icon-font dependency. Preserve native Material Back transitions. Make navigation fixtures independent of update plugins and answer auxiliary shell snapshots so the complete application suite can run deterministically.
77 lines
2.7 KiB
Dart
77 lines
2.7 KiB
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/adaptive/floating_destination_bar.dart';
|
|
import 'package:pipelines_app/ui/adaptive/glass_pill.dart';
|
|
|
|
void main() {
|
|
Widget page({
|
|
required Widget Function(BuildContext) list,
|
|
VoidCallback? onTap,
|
|
}) => MaterialApp(
|
|
home: Scaffold(
|
|
body: FloatingBarOverlay(
|
|
bar: FloatingDestinationBar(
|
|
currentIndex: 0,
|
|
onTap: (_) {},
|
|
items: const [
|
|
FloatingDestinationItem(icon: Icon(Icons.list), label: 'One'),
|
|
FloatingDestinationItem(icon: Icon(Icons.map), label: 'Two'),
|
|
],
|
|
),
|
|
child: GestureDetector(
|
|
behavior: HitTestBehavior.translucent,
|
|
onTap: onTap,
|
|
child: Builder(builder: list),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
|
|
for (final width in [390.0, 1200.0]) {
|
|
testWidgets('a padded list scrolls behind the bar and its last item '
|
|
'clears it at rest (width $width)', (tester) async {
|
|
tester.view.physicalSize = Size(width, 800);
|
|
tester.view.devicePixelRatio = 1;
|
|
addTearDown(tester.view.reset);
|
|
await tester.pumpWidget(
|
|
page(
|
|
list: (context) => ListView(
|
|
padding: withFloatingBarClearance(
|
|
context,
|
|
const EdgeInsets.all(16),
|
|
),
|
|
children: [
|
|
for (var i = 0; i < 40; i += 1)
|
|
SizedBox(height: 48, child: Text('Item $i')),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
final pill = tester.getRect(find.byKey(FloatingDestinationBar.rowKey));
|
|
// The list fills the area, behind the bar.
|
|
expect(tester.getRect(find.byType(ListView)).bottom, 800);
|
|
await tester.drag(find.byType(ListView), const Offset(0, -5000));
|
|
await tester.pumpAndSettle();
|
|
final last = tester.getRect(find.text('Item 39'));
|
|
expect(last.bottom, lessThanOrEqualTo(pill.top));
|
|
});
|
|
}
|
|
|
|
testWidgets('taps beside a wide bar reach the content', (tester) async {
|
|
tester.view.physicalSize = const Size(1200, 800);
|
|
tester.view.devicePixelRatio = 1;
|
|
addTearDown(tester.view.reset);
|
|
var taps = 0;
|
|
await tester.pumpWidget(
|
|
page(list: (_) => const SizedBox.expand(), onTap: () => taps++),
|
|
);
|
|
final pill = tester.getRect(find.byKey(FloatingDestinationBar.rowKey));
|
|
expect(pill.right, 1200 - kFloatingBarMargin);
|
|
await tester.tapAt(Offset(pill.left - 24, pill.center.dy));
|
|
expect(taps, 1);
|
|
await tester.tapAt(tester.getCenter(find.byType(GlassPill).first));
|
|
expect(taps, 1, reason: 'the bar takes its own taps');
|
|
});
|
|
}
|