mod: marquee use velocity

This commit is contained in:
My-Responsitories
2025-08-30 02:58:53 +08:00
committed by bggRGjQaUbCoE
parent 8d94c0405f
commit 498ab2818e
4 changed files with 162 additions and 142 deletions

View File

@@ -19,18 +19,12 @@ class MusicRecommandPage extends StatefulWidget {
}
class _MusicRecommandPageState extends State<MusicRecommandPage>
with GridMixin, SingleTickerProviderStateMixin {
with GridMixin {
late final _controller = Get.put(
MusicRecommendController(),
tag: Utils.generateRandomString(8),
);
late final _animation = AnimationController(
vsync: this,
duration: const Duration(seconds: 5),
reverseDuration: const Duration(seconds: 5),
)..repeat(reverse: true);
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
@@ -68,10 +62,8 @@ class _MusicRecommandPageState extends State<MusicRecommandPage>
response?.isNotEmpty == true
? SliverGrid.builder(
gridDelegate: gridDelegate,
itemBuilder: (context, index) => MusicVideoCardH(
videoItem: response[index],
animation: _animation,
),
itemBuilder: (context, index) =>
MusicVideoCardH(videoItem: response[index]),
itemCount: response!.length,
)
: HttpError(onReload: _controller.onReload),
@@ -120,10 +112,4 @@ class _MusicRecommandPageState extends State<MusicRecommandPage>
),
);
}
@override
void dispose() {
_animation.dispose();
super.dispose();
}
}

View File

@@ -14,12 +14,10 @@ import 'package:flutter/material.dart';
class MusicVideoCardH extends StatelessWidget {
final BgmRecommend videoItem;
final Animation<double> animation;
const MusicVideoCardH({
super.key,
required this.videoItem,
required this.animation,
});
@override
@@ -117,7 +115,7 @@ class MusicVideoCardH extends StatelessWidget {
),
const SizedBox(height: 3),
BounceMarquee(
animation: animation,
velocity: 25,
child: Row(
spacing: 8,
children: [

View File

@@ -1933,8 +1933,6 @@ class HeaderControlState extends TripleState<HeaderControl> {
return MarqueeText(
title,
maxWidth: constraints.maxWidth,
count: 3,
bounce: false,
spacing: 30,
style: const TextStyle(
color: Colors.white,