fix(player): 使用根Overlay承载飘心
This commit is contained in:
1 parent
db3e153409
commit
ed2cf4c18c
2 files changed
+71
-33
No files matched your search
@@ -123,47 +123,43 @@ class _PlayerDoubleTapHeartBurstState extends State<PlayerDoubleTapHeartBurst>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return IgnorePointer(
|
||||
child: SizedBox.shrink(
|
||||
child: AnimatedBuilder(
|
||||
animation: _controller,
|
||||
builder: (context, _) {
|
||||
final elapsed =
|
||||
_controller.value * _controller.duration!.inMilliseconds;
|
||||
return Stack(
|
||||
fit: StackFit.expand,
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
for (var index = 0; index < _hearts.length; index++)
|
||||
_heart(_hearts[index], elapsed, index),
|
||||
if (kDebugMode)
|
||||
Positioned(
|
||||
left: widget.origin.dx + 8,
|
||||
top: widget.origin.dy,
|
||||
child: IgnorePointer(
|
||||
child: Text(
|
||||
'${elapsed.round()}ms',
|
||||
key: const Key('heart-burst-elapsed-debug'),
|
||||
style: const TextStyle(
|
||||
color: Colors.white60,
|
||||
fontSize: 11,
|
||||
),
|
||||
child: AnimatedBuilder(
|
||||
animation: _controller,
|
||||
builder: (context, _) {
|
||||
final elapsed =
|
||||
_controller.value * _controller.duration!.inMilliseconds;
|
||||
return Stack(
|
||||
fit: StackFit.expand,
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
for (var index = 0; index < _hearts.length; index++)
|
||||
_heart(_hearts[index], elapsed, index),
|
||||
if (kDebugMode)
|
||||
Positioned(
|
||||
left: widget.origin.dx + 8,
|
||||
top: widget.origin.dy + 10,
|
||||
child: IgnorePointer(
|
||||
child: Text(
|
||||
'${elapsed.round()}ms',
|
||||
key: const Key('heart-burst-elapsed-debug'),
|
||||
style: const TextStyle(
|
||||
color: Colors.white60,
|
||||
fontSize: 11,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _heart(_HeartParticle heart, double elapsed, int index) {
|
||||
final progress = ((elapsed - heart.delay) / _heartDurationMs).clamp(
|
||||
0.0,
|
||||
1.0,
|
||||
);
|
||||
if (progress <= 0) return const SizedBox.shrink();
|
||||
final rawProgress = (elapsed - heart.delay) / _heartDurationMs;
|
||||
if (rawProgress < 0) return const SizedBox.shrink();
|
||||
final progress = rawProgress.clamp(0.0, 1.0);
|
||||
final move = Curves.easeOutCubic.transform(progress);
|
||||
final scale = progress < _heartPopPortion
|
||||
? _heartStartScale +
|
||||
|
||||
Reference in new issue
Block a user