fix(player): 使用根Overlay承载飘心
This commit is contained in:
1 parent
810ca5bf9d
commit
db3e153409
3 files changed
+17
-7
No files matched your search
@@ -38,10 +38,12 @@ const List<_HeartParticle> _hearts = [
|
||||
class PlayerDoubleTapHeartBurst extends StatefulWidget {
|
||||
const PlayerDoubleTapHeartBurst({
|
||||
super.key,
|
||||
required this.burstId,
|
||||
required this.onCompleted,
|
||||
this.origin = Offset.zero,
|
||||
});
|
||||
|
||||
final int burstId;
|
||||
final VoidCallback onCompleted;
|
||||
final Offset origin;
|
||||
|
||||
@@ -66,7 +68,7 @@ class _PlayerDoubleTapHeartBurstState extends State<PlayerDoubleTapHeartBurst>
|
||||
if (kDebugMode) {
|
||||
debugPrint(
|
||||
'[player] phase=heart-burst-start '
|
||||
'id=${identityHashCode(this)} count=${_hearts.length} '
|
||||
'id=${widget.burstId} count=${_hearts.length} '
|
||||
'configuredMs=$total at=${widget.origin.dx.toStringAsFixed(1)},'
|
||||
'${widget.origin.dy.toStringAsFixed(1)}',
|
||||
);
|
||||
@@ -84,7 +86,7 @@ class _PlayerDoubleTapHeartBurstState extends State<PlayerDoubleTapHeartBurst>
|
||||
if (kDebugMode) {
|
||||
debugPrint(
|
||||
'[player] phase=heart-burst-complete '
|
||||
'id=${identityHashCode(this)} '
|
||||
'id=${widget.burstId} '
|
||||
'configuredMs=${_controller.duration?.inMilliseconds ?? 0}',
|
||||
);
|
||||
}
|
||||
@@ -99,7 +101,7 @@ class _PlayerDoubleTapHeartBurstState extends State<PlayerDoubleTapHeartBurst>
|
||||
: _lifetime.elapsedMilliseconds;
|
||||
debugPrint(
|
||||
'[player] phase=heart-burst-dispose '
|
||||
'id=${identityHashCode(this)} elapsedMs=$elapsedMs '
|
||||
'id=${widget.burstId} elapsedMs=$elapsedMs '
|
||||
'completed=${_completed ? 1 : 0}',
|
||||
);
|
||||
if (!_completed) {
|
||||
@@ -107,7 +109,7 @@ class _PlayerDoubleTapHeartBurstState extends State<PlayerDoubleTapHeartBurst>
|
||||
maxFrames: 30,
|
||||
label:
|
||||
'[player] heart-burst-premature-dispose '
|
||||
'id=${identityHashCode(this)} mount=tap-gesture-region',
|
||||
'id=${widget.burstId} mount=root-overlay',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,6 +167,7 @@ class _PlayerTapGestureRegionState extends State<PlayerTapGestureRegion> {
|
||||
child: IgnorePointer(
|
||||
child: PlayerDoubleTapHeartBurst(
|
||||
key: ValueKey('heart-overlay-$id'),
|
||||
burstId: id,
|
||||
origin: origin,
|
||||
onCompleted: () => _removeHeartOverlay(id),
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user