fix(player): 使用根Overlay承载飘心
This commit is contained in:
1 parent
db3e153409
commit
ed2cf4c18c
2 files changed
+71
-33
No files matched your search
@@ -57,6 +57,48 @@ void main() {
|
||||
expect(_opacity(tester, 0), lessThan(0.5));
|
||||
});
|
||||
|
||||
testWidgets('heart position is anchored to the overlay origin', (
|
||||
tester,
|
||||
) async {
|
||||
const origin = Offset(300, 546);
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: PlayerDoubleTapHeartBurst(
|
||||
burstId: 4,
|
||||
origin: origin,
|
||||
onCompleted: _noop,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final firstHeart = find.byKey(const Key('double-tap-heart-0'));
|
||||
expect(
|
||||
(tester.getCenter(firstHeart) - origin).distance,
|
||||
lessThanOrEqualTo(1),
|
||||
);
|
||||
final debugTopLeft = tester.getTopLeft(
|
||||
find.byKey(const Key('heart-burst-elapsed-debug')),
|
||||
);
|
||||
expect(
|
||||
(debugTopLeft - const Offset(308, 556)).distance,
|
||||
lessThanOrEqualTo(1),
|
||||
);
|
||||
|
||||
await tester.pump(const Duration(milliseconds: 750));
|
||||
final midpoint = tester.getCenter(firstHeart);
|
||||
expect(midpoint.dy, lessThan(origin.dy));
|
||||
expect((midpoint.dx - origin.dx).abs(), lessThanOrEqualTo(1));
|
||||
});
|
||||
|
||||
testWidgets('develop heart burst completes after about 1590ms', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
Reference in new issue
Block a user