mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: seek anim
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -3,11 +3,11 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class BackwardSeekIndicator extends StatefulWidget {
|
||||
final void Function(Duration) onChanged;
|
||||
// final void Function(Duration) onChanged;
|
||||
final void Function(Duration) onSubmitted;
|
||||
const BackwardSeekIndicator({
|
||||
super.key,
|
||||
required this.onChanged,
|
||||
// required this.onChanged,
|
||||
required this.onSubmitted,
|
||||
});
|
||||
|
||||
@@ -28,18 +28,24 @@ class BackwardSeekIndicatorState extends State<BackwardSeekIndicator> {
|
||||
});
|
||||
}
|
||||
|
||||
void increment() {
|
||||
@override
|
||||
void dispose() {
|
||||
timer?.cancel();
|
||||
timer = Timer(const Duration(milliseconds: 400), () {
|
||||
widget.onSubmitted.call(value);
|
||||
});
|
||||
widget.onChanged.call(value);
|
||||
// 重复点击 快退秒数累加10
|
||||
setState(() {
|
||||
value += const Duration(seconds: 10);
|
||||
});
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// void increment() {
|
||||
// timer?.cancel();
|
||||
// timer = Timer(const Duration(milliseconds: 400), () {
|
||||
// widget.onSubmitted.call(value);
|
||||
// });
|
||||
// widget.onChanged.call(value);
|
||||
// // 重复点击 快退秒数累加10
|
||||
// setState(() {
|
||||
// value += const Duration(seconds: 10);
|
||||
// });
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
@@ -53,32 +59,31 @@ class BackwardSeekIndicatorState extends State<BackwardSeekIndicator> {
|
||||
end: Alignment.centerRight,
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
splashColor: const Color(0x44767676),
|
||||
onTap: increment,
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.fast_rewind,
|
||||
size: 24.0,
|
||||
color: Colors.white,
|
||||
),
|
||||
const SizedBox(height: 8.0),
|
||||
Text(
|
||||
'快退${value.inSeconds}秒',
|
||||
style: const TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
// child: InkWell(
|
||||
// splashColor: const Color(0x44767676),
|
||||
// onTap: increment,
|
||||
alignment: Alignment.center,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.fast_rewind,
|
||||
size: 24.0,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8.0),
|
||||
Text(
|
||||
'快退${value.inSeconds}秒',
|
||||
style: const TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ForwardSeekIndicator extends StatefulWidget {
|
||||
final void Function(Duration) onChanged;
|
||||
// final void Function(Duration) onChanged;
|
||||
final void Function(Duration) onSubmitted;
|
||||
const ForwardSeekIndicator({
|
||||
super.key,
|
||||
required this.onChanged,
|
||||
// required this.onChanged,
|
||||
required this.onSubmitted,
|
||||
});
|
||||
|
||||
@@ -28,18 +28,24 @@ class ForwardSeekIndicatorState extends State<ForwardSeekIndicator> {
|
||||
});
|
||||
}
|
||||
|
||||
void increment() {
|
||||
@override
|
||||
void dispose() {
|
||||
timer?.cancel();
|
||||
timer = Timer(const Duration(milliseconds: 400), () {
|
||||
widget.onSubmitted.call(value);
|
||||
});
|
||||
widget.onChanged.call(value);
|
||||
// 重复点击 快进秒数累加10
|
||||
setState(() {
|
||||
value += const Duration(seconds: 10);
|
||||
});
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// void increment() {
|
||||
// timer?.cancel();
|
||||
// timer = Timer(const Duration(milliseconds: 400), () {
|
||||
// widget.onSubmitted.call(value);
|
||||
// });
|
||||
// widget.onChanged.call(value);
|
||||
// // 重复点击 快进秒数累加10
|
||||
// setState(() {
|
||||
// value += const Duration(seconds: 10);
|
||||
// });
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
@@ -53,32 +59,31 @@ class ForwardSeekIndicatorState extends State<ForwardSeekIndicator> {
|
||||
end: Alignment.centerRight,
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
splashColor: const Color(0x44767676),
|
||||
onTap: increment,
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.fast_forward,
|
||||
size: 24.0,
|
||||
color: Colors.white,
|
||||
),
|
||||
const SizedBox(height: 8.0),
|
||||
Text(
|
||||
'快进${value.inSeconds}秒',
|
||||
style: const TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
// child: InkWell(
|
||||
// splashColor: const Color(0x44767676),
|
||||
// onTap: increment,
|
||||
alignment: Alignment.center,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.fast_forward,
|
||||
size: 24.0,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8.0),
|
||||
Text(
|
||||
'快进${value.inSeconds}秒',
|
||||
style: const TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user