mod: send vip colorful dm

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-14 10:29:16 +08:00
parent f2080bfb7b
commit 56460c937d
2 changed files with 43 additions and 13 deletions

View File

@@ -60,7 +60,7 @@ class DanmakuHttp {
int? fontsize, // 弹幕字号默认25 int? fontsize, // 弹幕字号默认25
int? pool, // 弹幕池选择0普通池 1字幕池 2特殊池代码/BAS弹幕默认普通池0 int? pool, // 弹幕池选择0普通池 1字幕池 2特殊池代码/BAS弹幕默认普通池0
//int? rnd,// 当前时间戳*1000000若无此项则发送弹幕冷却时间限制为90s若有此项则发送弹幕冷却时间限制为5s //int? rnd,// 当前时间戳*1000000若无此项则发送弹幕冷却时间限制为90s若有此项则发送弹幕冷却时间限制为5s
int? colorful, //60001专属渐变彩色需要会员 bool? colorful, //60001专属渐变彩色需要会员
int? checkbox_type, //是否带 UP 身份标识0普通4带有标识 int? checkbox_type, //是否带 UP 身份标识0普通4带有标识
// String? csrf,//CSRF Token位于 Cookie Cookie 方式必要 // String? csrf,//CSRF Token位于 Cookie Cookie 方式必要
// String? access_key,// APP 登录 Token APP 方式必要 // String? access_key,// APP 登录 Token APP 方式必要
@@ -77,11 +77,11 @@ class DanmakuHttp {
//'aid': aid, //'aid': aid,
'bvid': bvid, 'bvid': bvid,
'progress': progress, 'progress': progress,
'color': color, 'color': colorful == true ? null : color,
'fontsize': fontsize, 'fontsize': fontsize,
'pool': pool, 'pool': pool,
'rnd': DateTime.now().microsecondsSinceEpoch, 'rnd': DateTime.now().microsecondsSinceEpoch,
'colorful': colorful, 'colorful': colorful == true ? 60001 : null,
'checkbox_type': checkbox_type, 'checkbox_type': checkbox_type,
'csrf': await Request.getCsrf(), 'csrf': await Request.getCsrf(),
// 'access_key': access_key, // 'access_key': access_key,

View File

@@ -6,6 +6,7 @@ import 'package:PiliPlus/main.dart';
import 'package:PiliPlus/pages/common/common_publish_page.dart'; import 'package:PiliPlus/pages/common/common_publish_page.dart';
import 'package:PiliPlus/pages/setting/slide_color_picker.dart'; import 'package:PiliPlus/pages/setting/slide_color_picker.dart';
import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/extension.dart';
import 'package:PiliPlus/utils/storage.dart';
import 'package:canvas_danmaku/models/danmaku_content_item.dart'; import 'package:canvas_danmaku/models/danmaku_content_item.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@@ -70,6 +71,12 @@ class _SendDanmakuPanelState extends CommonPublishPageState<SendDanmakuPanel> {
_mode = (widget.dmConfig?.mode ?? 1).obs; _mode = (widget.dmConfig?.mode ?? 1).obs;
_fontsize = (widget.dmConfig?.fontsize ?? 25).obs; _fontsize = (widget.dmConfig?.fontsize ?? 25).obs;
_color = (widget.dmConfig?.color ?? Colors.white).obs; _color = (widget.dmConfig?.color ?? Colors.white).obs;
try {
final userInfo = GStorage.userInfo.get('userInfoCache');
if (userInfo?.vipStatus == 1) {
_colorList.add(Colors.transparent);
}
} catch (_) {}
} }
@override @override
@@ -231,9 +238,7 @@ class _SendDanmakuPanelState extends CommonPublishPageState<SendDanmakuPanel> {
Widget _buildColorItem(Color color) { Widget _buildColorItem(Color color) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
if (_color.value != color) { _color.value = color;
_color.value = color;
}
}, },
child: Container( child: Container(
width: 40, width: 40,
@@ -253,6 +258,32 @@ class _SendDanmakuPanelState extends CommonPublishPageState<SendDanmakuPanel> {
color: color, color: color,
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
), ),
child: color == Colors.transparent
? Stack(
clipBehavior: Clip.none,
alignment: Alignment.center,
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
gradient: LinearGradient(
colors: [
Color(0xFFDD94DA),
Color(0xFF72B2EA),
],
),
),
),
Container(
margin: const EdgeInsets.all(5),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(4),
),
),
],
)
: null,
), ),
), ),
); );
@@ -263,9 +294,7 @@ class _SendDanmakuPanelState extends CommonPublishPageState<SendDanmakuPanel> {
() => Expanded( () => Expanded(
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
if (_mode.value != mode) { _mode.value = mode;
_mode.value = mode;
}
}, },
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
@@ -295,9 +324,7 @@ class _SendDanmakuPanelState extends CommonPublishPageState<SendDanmakuPanel> {
() => Expanded( () => Expanded(
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
if (_fontsize.value != fontsize) { _fontsize.value = fontsize;
_fontsize.value = fontsize;
}
}, },
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
@@ -464,6 +491,7 @@ class _SendDanmakuPanelState extends CommonPublishPageState<SendDanmakuPanel> {
@override @override
Future onCustomPublish({required String message, List? pictures}) async { Future onCustomPublish({required String message, List? pictures}) async {
SmartDialog.showLoading(msg: '发送中...'); SmartDialog.showLoading(msg: '发送中...');
bool isColorful = _color.value == Colors.transparent;
final res = await DanmakuHttp.shootDanmaku( final res = await DanmakuHttp.shootDanmaku(
oid: widget.cid, oid: widget.cid,
bvid: widget.bvid, bvid: widget.bvid,
@@ -471,7 +499,8 @@ class _SendDanmakuPanelState extends CommonPublishPageState<SendDanmakuPanel> {
msg: editController.text, msg: editController.text,
mode: _mode.value, mode: _mode.value,
fontsize: _fontsize.value, fontsize: _fontsize.value,
color: _color.value.value & 0xFFFFFF, color: isColorful ? null : _color.value.value & 0xFFFFFF,
colorful: isColorful,
); );
SmartDialog.dismiss(); SmartDialog.dismiss();
if (res['status']) { if (res['status']) {
@@ -487,6 +516,7 @@ class _SendDanmakuPanelState extends CommonPublishPageState<SendDanmakuPanel> {
_ => DanmakuItemType.scroll, _ => DanmakuItemType.scroll,
}, },
selfSend: true, selfSend: true,
isColorful: isColorful,
), ),
); );
} else { } else {