mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: save dm config
Closes #673 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -952,6 +952,7 @@ class VideoDetailController extends GetxController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
({int mode, int fontsize, Color color})? dmConfig;
|
||||||
String? savedDanmaku;
|
String? savedDanmaku;
|
||||||
|
|
||||||
/// 发送弹幕
|
/// 发送弹幕
|
||||||
@@ -975,6 +976,8 @@ class VideoDetailController extends GetxController
|
|||||||
plPlayerController.danmakuController?.addDanmaku(danmakuModel);
|
plPlayerController.danmakuController?.addDanmaku(danmakuModel);
|
||||||
},
|
},
|
||||||
darkVideoPage: plPlayerController.darkVideoPage,
|
darkVideoPage: plPlayerController.darkVideoPage,
|
||||||
|
dmConfig: dmConfig,
|
||||||
|
onSaveDmConfig: (dmConfig) => this.dmConfig = dmConfig,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
transitionDuration: const Duration(milliseconds: 500),
|
transitionDuration: const Duration(milliseconds: 500),
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ class SendDanmakuPanel extends CommonPublishPage {
|
|||||||
final ValueChanged<DanmakuContentItem> callback;
|
final ValueChanged<DanmakuContentItem> callback;
|
||||||
final bool darkVideoPage;
|
final bool darkVideoPage;
|
||||||
|
|
||||||
|
// config
|
||||||
|
final ({int? mode, int? fontsize, Color? color})? dmConfig;
|
||||||
|
final ValueChanged<({int mode, int fontsize, Color color})>? onSaveDmConfig;
|
||||||
|
|
||||||
const SendDanmakuPanel({
|
const SendDanmakuPanel({
|
||||||
super.key,
|
super.key,
|
||||||
super.initialValue,
|
super.initialValue,
|
||||||
@@ -35,6 +39,8 @@ class SendDanmakuPanel extends CommonPublishPage {
|
|||||||
this.roomId,
|
this.roomId,
|
||||||
required this.callback,
|
required this.callback,
|
||||||
required this.darkVideoPage,
|
required this.darkVideoPage,
|
||||||
|
this.dmConfig,
|
||||||
|
this.onSaveDmConfig,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -42,9 +48,9 @@ class SendDanmakuPanel extends CommonPublishPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _SendDanmakuPanelState extends CommonPublishPageState<SendDanmakuPanel> {
|
class _SendDanmakuPanelState extends CommonPublishPageState<SendDanmakuPanel> {
|
||||||
final RxInt _mode = 1.obs;
|
late final RxInt _mode;
|
||||||
final RxInt _fontsize = 25.obs;
|
late final RxInt _fontsize;
|
||||||
final Rx<Color> _color = Colors.white.obs;
|
late final Rx<Color> _color;
|
||||||
|
|
||||||
final List<Color> _colorList = [
|
final List<Color> _colorList = [
|
||||||
Colors.white,
|
Colors.white,
|
||||||
@@ -63,6 +69,21 @@ class _SendDanmakuPanelState extends CommonPublishPageState<SendDanmakuPanel> {
|
|||||||
Color(0xFF9B9B9B),
|
Color(0xFF9B9B9B),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_mode = (widget.dmConfig?.mode ?? 1).obs;
|
||||||
|
_fontsize = (widget.dmConfig?.fontsize ?? 25).obs;
|
||||||
|
_color = (widget.dmConfig?.color ?? Colors.white).obs;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
widget.onSaveDmConfig?.call(
|
||||||
|
(mode: _mode.value, fontsize: _fontsize.value, color: _color.value));
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
get _buildColorPanel => Expanded(
|
get _buildColorPanel => Expanded(
|
||||||
child: Obx(
|
child: Obx(
|
||||||
() => LayoutBuilder(
|
() => LayoutBuilder(
|
||||||
|
|||||||
Reference in New Issue
Block a user