chore: code clean up

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-11-10 09:49:06 +08:00
parent 03d405e197
commit 59910e275e
133 changed files with 597 additions and 816 deletions

View File

@@ -10,9 +10,9 @@ class AiDetail extends StatelessWidget {
final ModelResult? modelResult;
const AiDetail({
Key? key,
super.key,
this.modelResult,
}) : super(key: key);
});
@override
Widget build(BuildContext context) {

View File

@@ -6,12 +6,12 @@ class ScrollAppBar extends StatelessWidget {
final Function callback;
final PlayerStatus playerStatus;
const ScrollAppBar(
this.scrollVal,
this.callback,
this.playerStatus,
Key? key,
) : super(key: key);
const ScrollAppBar({
super.key,
required this.scrollVal,
required this.callback,
required this.playerStatus,
});
@override
Widget build(BuildContext context) {
@@ -29,7 +29,7 @@ class ScrollAppBar extends StatelessWidget {
opacity: scrollDistance / (videoHeight - kToolbarHeight),
child: Container(
height: statusBarHeight + kToolbarHeight,
color: Theme.of(context).colorScheme.background,
color: Theme.of(context).colorScheme.surface,
padding: EdgeInsets.only(top: statusBarHeight),
child: AppBar(
primary: false,

View File

@@ -167,9 +167,9 @@ class _HeaderControlState extends State<HeaderControl> {
// scale: 0.75,
// child: Switch(
// thumbIcon: WidgetStateProperty.resolveWith<Icon?>(
// (Set<MaterialState> states) {
// (Set<WidgetState> states) {
// if (states.isNotEmpty &&
// states.first == MaterialState.selected) {
// states.first == WidgetState.selected) {
// return const Icon(Icons.done);
// }
// return null; // All other states will use the default thumbIcon.
@@ -1328,7 +1328,7 @@ class _HeaderControlState extends State<HeaderControl> {
@override
Widget build(BuildContext context) {
final _ = widget.controller!;
final plPlayerController = widget.controller!;
// final bool isLandscape =
// MediaQuery.of(context).orientation == Orientation.landscape;
@@ -1475,20 +1475,22 @@ class _HeaderControlState extends State<HeaderControl> {
height: 34,
child: Obx(
() => IconButton(
tooltip: "${_.isOpenDanmu.value ? '关闭' : '开启'}弹幕",
tooltip:
"${plPlayerController.isOpenDanmu.value ? '关闭' : '开启'}弹幕",
style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero),
),
onPressed: () {
_.isOpenDanmu.value = !_.isOpenDanmu.value;
setting.put(
SettingBoxKey.enableShowDanmaku, _.isOpenDanmu.value);
plPlayerController.isOpenDanmu.value =
!plPlayerController.isOpenDanmu.value;
setting.put(SettingBoxKey.enableShowDanmaku,
plPlayerController.isOpenDanmu.value);
SmartDialog.showToast(
"${_.isOpenDanmu.value ? '开启' : '关闭'}弹幕",
"${plPlayerController.isOpenDanmu.value ? '开启' : '关闭'}弹幕",
displayTime: const Duration(seconds: 1));
},
icon: Icon(
_.isOpenDanmu.value
plPlayerController.isOpenDanmu.value
? Icons.subtitles_outlined
: Icons.subtitles_off_outlined,
size: 19,
@@ -1514,7 +1516,7 @@ class _HeaderControlState extends State<HeaderControl> {
bool enableBackgroundPlay = setting.get(
SettingBoxKey.enableBackgroundPlay,
defaultValue: false);
if (!enableBackgroundPlay) {
if (!enableBackgroundPlay && context.mounted) {
// SmartDialog.showToast('建议开启【后台播放】功能\n避免画中画没有暂停按钮');
// await Future.delayed(const Duration(seconds: 2), () {
// });
@@ -1551,7 +1553,8 @@ class _HeaderControlState extends State<HeaderControl> {
}),
),
onPressed: () async {
_.setBackgroundPlay(true);
plPlayerController
.setBackgroundPlay(true);
SmartDialog.showToast("请重新载入本页面刷新");
// Get.back();
},