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,
|
||||
|
||||
Reference in New Issue
Block a user