mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: danmaku fontsize
Closes #13 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -12,11 +12,13 @@ import 'package:PiliPalaX/utils/storage.dart';
|
||||
class PlDanmaku extends StatefulWidget {
|
||||
final int cid;
|
||||
final PlPlayerController playerController;
|
||||
final bool? isPipMode;
|
||||
|
||||
const PlDanmaku({
|
||||
super.key,
|
||||
required this.cid,
|
||||
required this.playerController,
|
||||
this.isPipMode,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -39,6 +41,7 @@ class _PlDanmakuState extends State<PlDanmaku> with WidgetsBindingObserver {
|
||||
late int fontWeight;
|
||||
int latestAddedPosition = -1;
|
||||
bool showDanmaku = true;
|
||||
bool? _isFullScreen;
|
||||
|
||||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
@@ -60,6 +63,7 @@ class _PlDanmakuState extends State<PlDanmaku> with WidgetsBindingObserver {
|
||||
widget.cid,
|
||||
widget.playerController.danmakuWeight,
|
||||
widget.playerController.danmakuFilterRule);
|
||||
|
||||
if (mounted) {
|
||||
playerController = widget.playerController;
|
||||
if (enableShowDanmaku || playerController.isOpenDanmu.value) {
|
||||
@@ -78,6 +82,20 @@ class _PlDanmakuState extends State<PlDanmaku> with WidgetsBindingObserver {
|
||||
playerController.position.value.inMilliseconds);
|
||||
}
|
||||
});
|
||||
playerController.isFullScreen.listen((isFullScreen) {
|
||||
if (isFullScreen != _isFullScreen) {
|
||||
_isFullScreen = isFullScreen;
|
||||
if (_controller != null) {
|
||||
_controller!.updateOption(
|
||||
_controller!.option.copyWith(
|
||||
fontSize: isFullScreen == false || widget.isPipMode == true
|
||||
? 15 * fontSizeVal
|
||||
: 15 * fontSizeVal * 1.2,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
blockTypes = playerController.blockTypes;
|
||||
showArea = playerController.showArea;
|
||||
opacityVal = playerController.opacityVal;
|
||||
@@ -152,7 +170,10 @@ class _PlDanmakuState extends State<PlDanmaku> with WidgetsBindingObserver {
|
||||
playerController.danmakuController = _controller = e;
|
||||
},
|
||||
option: DanmakuOption(
|
||||
fontSize: 15 * fontSizeVal,
|
||||
fontSize: playerController.isFullScreen.value == false ||
|
||||
widget.isPipMode == true
|
||||
? 15 * fontSizeVal
|
||||
: 15 * fontSizeVal * 1.2,
|
||||
fontWeight: fontWeight,
|
||||
area: showArea,
|
||||
opacity: opacityVal,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:PiliPalaX/utils/extension.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
|
||||
@@ -2,7 +2,6 @@ import 'dart:async';
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
import 'package:PiliPalaX/common/constants.dart';
|
||||
import 'package:PiliPalaX/common/widgets/article_content.dart';
|
||||
import 'package:PiliPalaX/common/widgets/icon_button.dart';
|
||||
import 'package:PiliPalaX/common/widgets/loading_widget.dart';
|
||||
import 'package:PiliPalaX/common/widgets/pair.dart';
|
||||
|
||||
@@ -907,6 +907,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
() => PlDanmaku(
|
||||
key: Key(videoDetailController.danmakuCid.value
|
||||
.toString()),
|
||||
isPipMode: true,
|
||||
cid: videoDetailController.danmakuCid.value,
|
||||
playerController: plPlayerController!,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user