Skip to content

偶现首帧闪全屏 #96

@polestar1992chan

Description

@polestar1992chan

` Widget build(BuildContext context, WidgetRef ref) {
return PlayAnimationBuilder(
tween: MovieTween()
..scene(begin: Duration.zero, end: const Duration(milliseconds: 666))
.tween('x', Tween(begin: 1.sw, end: 12.w),
curve: const Cubic(0.33, 0, 0.32, 1))
..scene(
begin: const Duration(milliseconds: 3666),
end: const Duration(milliseconds: 4333))
.tween('x', Tween(begin: 12.w, end: -351.w),
curve: const Cubic(0.69, 0, 0.67, 1)),
duration: const Duration(milliseconds: 4333),
onCompleted: () {
onDone.call(key);
},
builder: (context, value, child) {
return PositionedDirectional(
top: 24.w, start: value.get('x'), child: child!);
},
child: GestureDetector(
onTap: () {
final roomId = ref.read(roomManagerProvider.notifier).currentRoomID;
final toRoomId = renderData.roomId;
if (roomId == toRoomId) {
return;
}
jumpRoom(toRoomId);
},
onVerticalDragUpdate: (details) {

        if (details.delta.dy < 0) {
          Logger.info('向上滑动');
          onDone.call(key);
        }
      },
      child: GiftBarrageElement(
        renderData: renderData,
      ),
    ));

}
}

//全服礼物横幅
class GiftBarrageElement extends HookConsumerWidget {
final GiftBarrageRenderData renderData;

const GiftBarrageElement({super.key, required this.renderData});

@OverRide
Widget build(BuildContext context, WidgetRef ref) {
final textDirection = ref.watch(globalTextDecorationProvider);

return SizedBox(
  width: 351.w,
  height: 100.w,
  child: Stack(
    textDirection: textDirection,
    children: [
      PAGView.bytes(
        width: 351.w,
        height: 100.w,
        renderData.backgroundPAGData,
        repeatCount: PAGView.REPEAT_COUNT_LOOP,
        autoPlay: true,
        initProgress: 0.25,
        key:UniqueKey(),
      ),
    ],
  ),
);

}
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions