* opt: linter

* tweaks

* opt: TopImage

* update

* remove repaintBoundary [skip ci]

---------

Co-authored-by: dom <githubaccount56556@proton.me>
This commit is contained in:
My-Responsitories
2026-03-12 15:45:18 +08:00
committed by GitHub
parent 99128b2641
commit 6cda3a1880
25 changed files with 237 additions and 323 deletions

View File

@@ -72,5 +72,11 @@ linter:
- use_truncating_division - use_truncating_division
- use_string_buffers - use_string_buffers
- unnecessary_statements - unnecessary_statements
- unnecessary_nullable_for_final_variable_declarations
- tighten_type_of_initializing_formals
- prefer_void_to_null
- prefer_spread_collections
- unnecessary_to_list_in_spreads
- prefer_for_elements_to_map_fromIterable
# Additional information about this file can be found at # Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options # https://dart.dev/guides/language/analysis-options

View File

@@ -20,20 +20,16 @@ class DisabledIcon extends SingleChildRenderObjectWidget {
final StrokeCap strokeCap; final StrokeCap strokeCap;
final double lineLengthScale; final double lineLengthScale;
Icon? get _icon => child is Icon ? child as Icon : null;
@override @override
RenderObject createRenderObject(BuildContext context) { RenderObject createRenderObject(BuildContext context) {
late final iconTheme = IconTheme.of(context); late final iconTheme = IconTheme.of(context);
final icon = _icon;
return RenderMaskedIcon( return RenderMaskedIcon(
disable: disable, disable: disable,
iconSize: iconSize: iconSize ?? icon?.size ?? iconTheme.size ?? 24.0,
iconSize ?? color: color ?? icon?.color ?? iconTheme.color!,
(child is Icon ? (child as Icon).size : null) ??
iconTheme.size ??
24.0,
color:
color ??
(child is Icon ? (child as Icon).color : null) ??
iconTheme.color!,
strokeCap: strokeCap, strokeCap: strokeCap,
lineLengthScale: lineLengthScale, lineLengthScale: lineLengthScale,
); );
@@ -42,17 +38,11 @@ class DisabledIcon extends SingleChildRenderObjectWidget {
@override @override
void updateRenderObject(BuildContext context, RenderMaskedIcon renderObject) { void updateRenderObject(BuildContext context, RenderMaskedIcon renderObject) {
late final iconTheme = IconTheme.of(context); late final iconTheme = IconTheme.of(context);
final icon = _icon;
renderObject renderObject
..disable = disable ..disable = disable
..iconSize = ..iconSize = iconSize ?? icon?.size ?? iconTheme.size ?? 24.0
iconSize ?? ..color = color ?? icon?.color ?? iconTheme.color!
(child is Icon ? (child as Icon).size : null) ??
iconTheme.size ??
24.0
..color =
color ??
(child is Icon ? (child as Icon).color : null) ??
iconTheme.color!
..strokeCap = strokeCap ..strokeCap = strokeCap
..lineLengthScale = lineLengthScale; ..lineLengthScale = lineLengthScale;
} }

View File

@@ -43,42 +43,3 @@ class NoRenderLayoutBox extends RenderProxyBox {
@override @override
void paint(PaintingContext context, Offset offset) {} void paint(PaintingContext context, Offset offset) {}
} }
class LayoutSizeWidget extends SingleChildRenderObjectWidget {
const LayoutSizeWidget({
super.key,
super.child,
required this.onPerformLayout,
});
final LayoutCallback onPerformLayout;
@override
RenderObject createRenderObject(BuildContext context) =>
RenderLayoutBox(onPerformLayout: onPerformLayout);
@override
void updateRenderObject(
BuildContext context,
RenderLayoutBox renderObject,
) {
super.updateRenderObject(context, renderObject);
renderObject.onPerformLayout = onPerformLayout;
}
}
class RenderLayoutBox extends RenderProxyBox {
RenderLayoutBox({required this.onPerformLayout});
LayoutCallback onPerformLayout;
Size? _size;
@override
void performLayout() {
super.performLayout();
if (_size != size) {
onPerformLayout(_size = size);
}
}
}

View File

@@ -96,7 +96,6 @@ class RenderSliverFixedWrap extends RenderSliverMultiBoxAdaptor {
set runSpacing(double value) { set runSpacing(double value) {
if (_runSpacing == value) return; if (_runSpacing == value) return;
_runSpacing = value; _runSpacing = value;
markRowsDirty();
markNeedsLayout(); markNeedsLayout();
} }
@@ -168,20 +167,20 @@ class RenderSliverFixedWrap extends RenderSliverMultiBoxAdaptor {
} }
} }
bool _buildNextRow(int start, BoxConstraints childConstraints) { bool _buildNextRow(int start, BoxConstraints constraints) {
final int childCount = childManager.childCount; final int childCount = childManager.childCount;
if (start >= childCount) { if (start >= childCount) {
return false; return false;
} }
final crossAxisExtent = constraints.crossAxisExtent; final crossAxisExtent = this.constraints.crossAxisExtent;
final List<double> widths = []; final List<double> widths = [];
int idx = start; int idx = start;
RenderBox? child; RenderBox? child;
for (var totalWidth = -_spacing; idx < childCount; idx++) { for (var totalWidth = -_spacing; idx < childCount; idx++) {
child = _getOrCreateChildAtIndex(idx, childConstraints, child); child = _getOrCreateChildAtIndex(idx, constraints, child);
final childWidth = _childCrossExtent(child); final childWidth = _childCrossExtent(child);
totalWidth += childWidth + _spacing; totalWidth += childWidth + _spacing;
@@ -215,24 +214,20 @@ class RenderSliverFixedWrap extends RenderSliverMultiBoxAdaptor {
final firstNeededRow = math.max(0, firstCacheOffset ~/ rowHeight); final firstNeededRow = math.max(0, firstCacheOffset ~/ rowHeight);
final lastNeededRow = math.max(0, lastCacheOffset ~/ rowHeight); final lastNeededRow = math.max(0, lastCacheOffset ~/ rowHeight);
final childConstraints = constraints.toFixedConstraints(_mainAxisExtent);
if (firstChild == null) { if (firstChild == null) {
if (!addInitialChild()) { if (!addInitialChild()) {
geometry = SliverGeometry.zero; geometry = SliverGeometry.zero;
childManager.didFinishLayout(); childManager.didFinishLayout();
return; return;
} }
firstChild!.layout( firstChild!.layout(childConstraints, parentUsesSize: true);
constraints.toFixedConstraints(_mainAxisExtent),
parentUsesSize: true,
);
} }
while (_rows.length <= lastNeededRow) { while (_rows.length <= lastNeededRow) {
final int startIndex = _rows.isEmpty ? 0 : _rows.last.endIndex + 1; final int startIndex = _rows.isEmpty ? 0 : _rows.last.endIndex + 1;
if (!_buildNextRow( if (!_buildNextRow(startIndex, childConstraints)) {
startIndex,
constraints.toFixedConstraints(_mainAxisExtent),
)) {
break; break;
} }
} }
@@ -256,11 +251,7 @@ class RenderSliverFixedWrap extends RenderSliverMultiBoxAdaptor {
final rowStartOffset = r * rowHeight; final rowStartOffset = r * rowHeight;
double crossOffset = 0.0; double crossOffset = 0.0;
for (var i = row.startIndex; i <= row.endIndex; i++) { for (var i = row.startIndex; i <= row.endIndex; i++) {
child = _getOrCreateChildAtIndex( child = _getOrCreateChildAtIndex(i, childConstraints, child);
i,
constraints.toFixedConstraints(_mainAxisExtent),
child,
);
(child.parentData as SliverWrapParentData) (child.parentData as SliverWrapParentData)
..layoutOffset = rowStartOffset ..layoutOffset = rowStartOffset
..crossAxisOffset = crossOffset; ..crossAxisOffset = crossOffset;

View File

@@ -60,7 +60,7 @@ abstract final class DanmakuHttp {
} }
} }
static Future<LoadingState<Null>> danmakuLike({ static Future<LoadingState<void>> danmakuLike({
required bool isLike, required bool isLike,
required int cid, required int cid,
required int id, required int id,
@@ -89,7 +89,7 @@ abstract final class DanmakuHttp {
} }
} }
static Future<LoadingState<Null>> danmakuReport({ static Future<LoadingState<void>> danmakuReport({
required int reason, required int reason,
required int cid, required int cid,
required int id, required int id,

View File

@@ -15,7 +15,7 @@ abstract final class DanmakuFilterHttp {
} }
} }
static Future<LoadingState<Null>> danmakuFilterDel({required int ids}) async { static Future<LoadingState<void>> danmakuFilterDel({required int ids}) async {
final res = await Request().post( final res = await Request().post(
Api.danmakuFilterDel, Api.danmakuFilterDel,
data: { data: {

View File

@@ -127,7 +127,7 @@ abstract final class DynamicsHttp {
// } // }
// 动态点赞 // 动态点赞
static Future<LoadingState<Null>> thumbDynamic({ static Future<LoadingState<void>> thumbDynamic({
required String? dynamicId, required String? dynamicId,
required int? up, required int? up,
}) async { }) async {
@@ -275,7 +275,7 @@ abstract final class DynamicsHttp {
} }
} }
static Future<LoadingState<Null>> setTop({ static Future<LoadingState<void>> setTop({
required Object dynamicId, required Object dynamicId,
}) async { }) async {
final res = await Request().post( final res = await Request().post(
@@ -294,7 +294,7 @@ abstract final class DynamicsHttp {
} }
} }
static Future<LoadingState<Null>> rmTop({ static Future<LoadingState<void>> rmTop({
required Object dynamicId, required Object dynamicId,
}) async { }) async {
final res = await Request().post( final res = await Request().post(
@@ -672,7 +672,7 @@ abstract final class DynamicsHttp {
} }
} }
static Future<LoadingState<Null>> dynPrivatePubSetting({ static Future<LoadingState<void>> dynPrivatePubSetting({
required Object dynId, required Object dynId,
int? dynType, int? dynType,
required String action, required String action,
@@ -699,7 +699,7 @@ abstract final class DynamicsHttp {
} }
} }
static Future<LoadingState<Null>> editDyn({ static Future<LoadingState<void>> editDyn({
required Object dynId, required Object dynId,
Object? repostDynId, Object? repostDynId,
dynamic rawText, dynamic rawText,

View File

@@ -18,7 +18,7 @@ import 'package:PiliPlus/utils/app_sign.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
abstract final class FavHttp { abstract final class FavHttp {
static Future<LoadingState<Null>> favFavFolder(Object mediaId) async { static Future<LoadingState<void>> favFavFolder(Object mediaId) async {
final res = await Request().post( final res = await Request().post(
Api.favFavFolder, Api.favFavFolder,
data: { data: {
@@ -34,7 +34,7 @@ abstract final class FavHttp {
} }
} }
static Future<LoadingState<Null>> unfavFavFolder(Object mediaId) async { static Future<LoadingState<void>> unfavFavFolder(Object mediaId) async {
final res = await Request().post( final res = await Request().post(
Api.unfavFavFolder, Api.unfavFavFolder,
data: { data: {
@@ -79,7 +79,7 @@ abstract final class FavHttp {
} }
// 取消订阅 // 取消订阅
static Future<LoadingState<Null>> cancelSub({ static Future<LoadingState<void>> cancelSub({
required int id, required int id,
required int type, required int type,
}) async { }) async {
@@ -148,7 +148,7 @@ abstract final class FavHttp {
} }
} }
static Future<LoadingState<Null>> addFavPugv(Object seasonId) async { static Future<LoadingState<void>> addFavPugv(Object seasonId) async {
final res = await Request().post( final res = await Request().post(
Api.addFavPugv, Api.addFavPugv,
data: { data: {
@@ -164,7 +164,7 @@ abstract final class FavHttp {
} }
} }
static Future<LoadingState<Null>> delFavPugv(Object seasonId) async { static Future<LoadingState<void>> delFavPugv(Object seasonId) async {
final res = await Request().post( final res = await Request().post(
Api.delFavPugv, Api.delFavPugv,
data: { data: {
@@ -198,7 +198,7 @@ abstract final class FavHttp {
} }
} }
static Future<LoadingState<Null>> addFavTopic(Object topicId) async { static Future<LoadingState<void>> addFavTopic(Object topicId) async {
final res = await Request().post( final res = await Request().post(
Api.addFavTopic, Api.addFavTopic,
data: { data: {
@@ -214,7 +214,7 @@ abstract final class FavHttp {
} }
} }
static Future<LoadingState<Null>> delFavTopic(Object topicId) async { static Future<LoadingState<void>> delFavTopic(Object topicId) async {
final res = await Request().post( final res = await Request().post(
Api.delFavTopic, Api.delFavTopic,
data: { data: {
@@ -230,7 +230,7 @@ abstract final class FavHttp {
} }
} }
static Future<LoadingState<Null>> likeTopic( static Future<LoadingState<void>> likeTopic(
Object topicId, Object topicId,
bool isLike, bool isLike,
) async { ) async {
@@ -269,7 +269,7 @@ abstract final class FavHttp {
} }
} }
static Future<LoadingState<Null>> addFavArticle({ static Future<LoadingState<void>> addFavArticle({
required Object id, required Object id,
}) async { }) async {
final res = await Request().post( final res = await Request().post(
@@ -289,7 +289,7 @@ abstract final class FavHttp {
} }
} }
static Future<LoadingState<Null>> delFavArticle({ static Future<LoadingState<void>> delFavArticle({
required Object id, required Object id,
}) async { }) async {
final res = await Request().post( final res = await Request().post(
@@ -351,7 +351,7 @@ abstract final class FavHttp {
} }
} }
static Future<LoadingState<Null>> delNote({ static Future<LoadingState<void>> delNote({
required bool isPublish, required bool isPublish,
required String noteIds, required String noteIds,
}) async { }) async {
@@ -415,7 +415,7 @@ abstract final class FavHttp {
} }
} }
static Future<LoadingState<Null>> sortFavFolder({ static Future<LoadingState<void>> sortFavFolder({
required String sort, required String sort,
}) async { }) async {
Map<String, dynamic> data = { Map<String, dynamic> data = {
@@ -437,7 +437,7 @@ abstract final class FavHttp {
} }
} }
static Future<LoadingState<Null>> sortFav({ static Future<LoadingState<void>> sortFav({
required Object mediaId, required Object mediaId,
required String sort, required String sort,
}) async { }) async {
@@ -461,7 +461,7 @@ abstract final class FavHttp {
} }
} }
static Future<LoadingState<Null>> cleanFav({ static Future<LoadingState<void>> cleanFav({
required Object mediaId, required Object mediaId,
}) async { }) async {
final res = await Request().post( final res = await Request().post(
@@ -482,7 +482,7 @@ abstract final class FavHttp {
} }
} }
static Future<LoadingState<Null>> deleteFolder({ static Future<LoadingState<void>> deleteFolder({
required String mediaIds, required String mediaIds,
}) async { }) async {
final res = await Request().post( final res = await Request().post(
@@ -548,7 +548,7 @@ abstract final class FavHttp {
} }
} }
static Future<LoadingState<Null>> seasonFav({ static Future<LoadingState<void>> seasonFav({
required bool isFav, required bool isFav,
required dynamic seasonId, required dynamic seasonId,
}) async { }) async {
@@ -605,7 +605,7 @@ abstract final class FavHttp {
} }
} }
static Future<LoadingState<Null>> communityAction({ static Future<LoadingState<void>> communityAction({
required Object opusId, required Object opusId,
required Object action, required Object action,
}) async { }) async {
@@ -630,7 +630,7 @@ abstract final class FavHttp {
} }
// (取消)收藏 // (取消)收藏
static Future<LoadingState<Null>> favVideo({ static Future<LoadingState<void>> favVideo({
required String resources, required String resources,
String? addIds, String? addIds,
String? delIds, String? delIds,
@@ -653,7 +653,7 @@ abstract final class FavHttp {
} }
// (取消)收藏 // (取消)收藏
static Future<LoadingState<Null>> unfavAll({ static Future<LoadingState<void>> unfavAll({
required Object rid, required Object rid,
required Object type, required Object type,
}) async { }) async {
@@ -673,7 +673,7 @@ abstract final class FavHttp {
} }
} }
static Future<LoadingState<Null>> copyOrMoveFav({ static Future<LoadingState<void>> copyOrMoveFav({
required bool isCopy, required bool isCopy,
required bool isFav, required bool isFav,
required dynamic srcMediaId, required dynamic srcMediaId,

View File

@@ -33,7 +33,7 @@ import 'package:dio/dio.dart';
abstract final class LiveHttp { abstract final class LiveHttp {
static Account get recommend => Accounts.get(AccountType.recommend); static Account get recommend => Accounts.get(AccountType.recommend);
static Future<LoadingState<Null>> sendLiveMsg({ static Future<LoadingState<void>> sendLiveMsg({
required Object roomId, required Object roomId,
required Object msg, required Object msg,
Object? dmType, Object? dmType,
@@ -385,7 +385,7 @@ abstract final class LiveHttp {
} }
} }
static Future<LoadingState<Null>> setLiveFavTag({ static Future<LoadingState<void>> setLiveFavTag({
required String ids, required String ids,
}) async { }) async {
final data = { final data = {
@@ -505,7 +505,7 @@ abstract final class LiveHttp {
} }
} }
static Future<LoadingState<Null>> liveSetSilent({ static Future<LoadingState<void>> liveSetSilent({
required String type, required String type,
required int level, required int level,
}) async { }) async {
@@ -527,7 +527,7 @@ abstract final class LiveHttp {
} }
} }
static Future<LoadingState<Null>> addShieldKeyword({ static Future<LoadingState<void>> addShieldKeyword({
required String keyword, required String keyword,
}) async { }) async {
final csrf = Accounts.main.csrf; final csrf = Accounts.main.csrf;
@@ -547,7 +547,7 @@ abstract final class LiveHttp {
} }
} }
static Future<LoadingState<Null>> delShieldKeyword({ static Future<LoadingState<void>> delShieldKeyword({
required String keyword, required String keyword,
}) async { }) async {
final csrf = Accounts.main.csrf; final csrf = Accounts.main.csrf;
@@ -591,7 +591,7 @@ abstract final class LiveHttp {
} }
} }
static Future<LoadingState<Null>> liveLikeReport({ static Future<LoadingState<void>> liveLikeReport({
required int clickTime, required int clickTime,
required Object roomId, required Object roomId,
required Object uid, required Object uid,
@@ -637,7 +637,7 @@ abstract final class LiveHttp {
} }
} }
static Future<LoadingState<Null>> liveDmReport({ static Future<LoadingState<void>> liveDmReport({
required int roomId, required int roomId,
required Object mid, required Object mid,
required String msg, required String msg,
@@ -707,7 +707,7 @@ abstract final class LiveHttp {
} }
} }
static Future<LoadingState<Null>> superChatReport({ static Future<LoadingState<void>> superChatReport({
required int id, required int id,
required Object roomId, required Object roomId,
required Object uid, required Object uid,

View File

@@ -482,7 +482,7 @@ abstract final class MemberHttp {
} }
} }
static Future<LoadingState<Null>> specialAction({ static Future<LoadingState<void>> specialAction({
int? fid, int? fid,
bool isAdd = true, bool isAdd = true,
}) async { }) async {
@@ -502,7 +502,7 @@ abstract final class MemberHttp {
} }
// 设置分组 // 设置分组
static Future<LoadingState<Null>> addUsers(String fids, String tagids) async { static Future<LoadingState<void>> addUsers(String fids, String tagids) async {
final res = await Request().post( final res = await Request().post(
Api.addUsers, Api.addUsers,
queryParameters: { queryParameters: {
@@ -555,7 +555,7 @@ abstract final class MemberHttp {
} }
} }
static Future<LoadingState<Null>> createFollowTag(Object tagName) async { static Future<LoadingState<void>> createFollowTag(Object tagName) async {
final res = await Request().post( final res = await Request().post(
Api.createFollowTag, Api.createFollowTag,
queryParameters: { queryParameters: {
@@ -575,7 +575,7 @@ abstract final class MemberHttp {
} }
} }
static Future<LoadingState<Null>> updateFollowTag( static Future<LoadingState<void>> updateFollowTag(
Object tagid, Object tagid,
Object name, Object name,
) async { ) async {
@@ -599,7 +599,7 @@ abstract final class MemberHttp {
} }
} }
static Future<LoadingState<Null>> delFollowTag(Object tagid) async { static Future<LoadingState<void>> delFollowTag(Object tagid) async {
final res = await Request().post( final res = await Request().post(
Api.delFollowTag, Api.delFollowTag,
queryParameters: { queryParameters: {

View File

@@ -18,7 +18,6 @@ import 'package:PiliPlus/models_new/upload_bfs/data.dart';
import 'package:PiliPlus/utils/accounts.dart'; import 'package:PiliPlus/utils/accounts.dart';
import 'package:PiliPlus/utils/wbi_sign.dart'; import 'package:PiliPlus/utils/wbi_sign.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:uuid/v4.dart';
abstract final class MsgHttp { abstract final class MsgHttp {
static Future<LoadingState<MsgReplyData>> msgFeedReplyMe({ static Future<LoadingState<MsgReplyData>> msgFeedReplyMe({
@@ -136,7 +135,7 @@ abstract final class MsgHttp {
} }
} }
static Future<LoadingState<Null>> msgSysUpdateCursor(int cursor) async { static Future<LoadingState<void>> msgSysUpdateCursor(int cursor) async {
String csrf = Accounts.main.csrf; String csrf = Accounts.main.csrf;
final res = await Request().get( final res = await Request().get(
Api.msgSysUpdateCursor, Api.msgSysUpdateCursor,
@@ -196,7 +195,7 @@ abstract final class MsgHttp {
} }
} }
static Future<LoadingState<Null>> createTextDynamic( static Future<LoadingState<void>> createTextDynamic(
Object content, Object content,
) async { ) async {
String csrf = Accounts.main.csrf; String csrf = Accounts.main.csrf;
@@ -220,7 +219,7 @@ abstract final class MsgHttp {
} }
} }
static Future<LoadingState<Null>> removeDynamic({ static Future<LoadingState<void>> removeDynamic({
required Object dynIdStr, required Object dynIdStr,
Object? dynType, Object? dynType,
Object? ridStr, Object? ridStr,
@@ -244,7 +243,7 @@ abstract final class MsgHttp {
} }
} }
static Future<LoadingState<Null>> removeMsg( static Future<LoadingState<void>> removeMsg(
Object talkerId, Object talkerId,
) async { ) async {
String csrf = Accounts.main.csrf; String csrf = Accounts.main.csrf;
@@ -268,7 +267,7 @@ abstract final class MsgHttp {
} }
} }
static Future<LoadingState<Null>> delMsgfeed( static Future<LoadingState<void>> delMsgfeed(
int tp, int tp,
dynamic id, dynamic id,
) async { ) async {
@@ -292,7 +291,7 @@ abstract final class MsgHttp {
} }
} }
static Future<LoadingState<Null>> delSysMsg( static Future<LoadingState<void>> delSysMsg(
Object id, Object id,
) async { ) async {
String csrf = Accounts.main.csrf; String csrf = Accounts.main.csrf;
@@ -317,7 +316,7 @@ abstract final class MsgHttp {
} }
} }
static Future<LoadingState<Null>> setTop({ static Future<LoadingState<void>> setTop({
required Object talkerId, required Object talkerId,
required int opType, required int opType,
}) async { }) async {
@@ -344,7 +343,7 @@ abstract final class MsgHttp {
} }
// 消息标记已读 // 消息标记已读
static Future<LoadingState<Null>> ackSessionMsg({ static Future<LoadingState<void>> ackSessionMsg({
required int talkerId, required int talkerId,
required int ackSeqno, required int ackSeqno,
}) async { }) async {
@@ -370,60 +369,60 @@ abstract final class MsgHttp {
} }
} }
// 发送私信 // // 发送私信
static Future<LoadingState<Null>> sendMsg({ // static Future<LoadingState<void>> sendMsg({
int? senderUid, // required int senderUid,
int? receiverId, // required int receiverId,
int? msgType, // int? msgType,
dynamic content, // dynamic content,
}) async { // }) async {
String csrf = Accounts.main.csrf; // String csrf = Accounts.main.csrf;
final devId = getDevId(); // final devId = getDevId();
final data = { // final data = {
'msg': { // 'msg': {
'sender_uid': senderUid, // 'sender_uid': senderUid,
'receiver_id': receiverId, // 'receiver_id': receiverId,
'receiver_type': 1, // 'receiver_type': 1,
'msg_type': msgType ?? 1, // 'msg_type': msgType ?? 1,
'msg_status': 0, // 'msg_status': 0,
'dev_id': devId, // 'dev_id': devId,
'timestamp': DateTime.now().millisecondsSinceEpoch ~/ 1000, // 'timestamp': DateTime.now().millisecondsSinceEpoch ~/ 1000,
'new_face_version': 1, // 'new_face_version': 1,
'content': content, // 'content': content,
}, // },
'from_firework': 0, // 'from_firework': 0,
'build': 0, // 'build': 0,
'mobi_app': 'web', // 'mobi_app': 'web',
'csrf_token': csrf, // 'csrf_token': csrf,
'csrf': csrf, // 'csrf': csrf,
}; // };
Map<String, dynamic> params = await WbiSign.makSign(data); // Map<String, dynamic> params = await WbiSign.makSign(data);
final res = await Request().post( // final res = await Request().post(
Api.sendMsg, // Api.sendMsg,
queryParameters: <String, dynamic>{ // queryParameters: <String, dynamic>{
'w_sender_uid': senderUid, // 'w_sender_uid': senderUid,
'w_receiver_id': receiverId, // 'w_receiver_id': receiverId,
'w_dev_id': devId, // 'w_dev_id': devId,
'w_rid': params['w_rid'], // 'w_rid': params['w_rid'],
'wts': params['wts'], // 'wts': params['wts'],
}, // },
data: data, // data: data,
options: Options( // options: Options(
contentType: Headers.formUrlEncodedContentType, // contentType: Headers.formUrlEncodedContentType,
), // ),
); // );
if (res.data['code'] == 0) { // if (res.data['code'] == 0) {
return const Success(null); // return const Success(null);
} else { // } else {
return Error(res.data['message']); // return Error(res.data['message']);
} // }
} // }
static String getDevId() { // static String getDevId() {
return const UuidV4().generate(); // return const UuidV4().generate();
} // }
static Future<LoadingState<Null>> msgSetNotice({ static Future<LoadingState<void>> msgSetNotice({
required Object id, required Object id,
required int noticeState, required int noticeState,
}) async { }) async {
@@ -451,7 +450,7 @@ abstract final class MsgHttp {
} }
} }
static Future<LoadingState<Null>> setMsgDnd({ static Future<LoadingState<void>> setMsgDnd({
required Object uid, required Object uid,
required int setting, required int setting,
required dndUid, required dndUid,
@@ -477,7 +476,7 @@ abstract final class MsgHttp {
} }
} }
static Future<LoadingState<Null>> setPushSs({ static Future<LoadingState<void>> setPushSs({
required int setting, required int setting,
required talkerUid, required talkerUid,
}) async { }) async {
@@ -606,7 +605,7 @@ abstract final class MsgHttp {
} }
} }
static Future<LoadingState<Null>> imMsgReport({ static Future<LoadingState<void>> imMsgReport({
required int accusedUid, required int accusedUid,
required int reasonType, required int reasonType,
required String reasonDesc, required String reasonDesc,

View File

@@ -23,7 +23,7 @@ abstract final class MusicHttp {
} }
} }
static Future<LoadingState<Null>> wishUpdate( static Future<LoadingState<void>> wishUpdate(
String musicId, String musicId,
bool hasLike, bool hasLike,
) async { ) async {

View File

@@ -133,7 +133,7 @@ abstract final class PgcHttp {
} }
} }
static Future<LoadingState<Null>> pgcReviewLike({ static Future<LoadingState<void>> pgcReviewLike({
required Object mediaId, required Object mediaId,
required Object reviewId, required Object reviewId,
}) async { }) async {
@@ -154,7 +154,7 @@ abstract final class PgcHttp {
} }
} }
static Future<LoadingState<Null>> pgcReviewDislike({ static Future<LoadingState<void>> pgcReviewDislike({
required Object mediaId, required Object mediaId,
required Object reviewId, required Object reviewId,
}) async { }) async {
@@ -175,7 +175,7 @@ abstract final class PgcHttp {
} }
} }
static Future<LoadingState<Null>> pgcReviewPost({ static Future<LoadingState<void>> pgcReviewPost({
required Object mediaId, required Object mediaId,
required int score, required int score,
required String content, required String content,
@@ -199,7 +199,7 @@ abstract final class PgcHttp {
} }
} }
static Future<LoadingState<Null>> pgcReviewMod({ static Future<LoadingState<void>> pgcReviewMod({
required Object mediaId, required Object mediaId,
required int score, required int score,
required String content, required String content,
@@ -223,7 +223,7 @@ abstract final class PgcHttp {
} }
} }
static Future<LoadingState<Null>> pgcReviewDel({ static Future<LoadingState<void>> pgcReviewDel({
required Object mediaId, required Object mediaId,
required Object reviewId, required Object reviewId,
}) async { }) async {

View File

@@ -88,7 +88,7 @@ abstract final class ReplyHttp {
} }
} }
static Future<LoadingState<Null>> hateReply({ static Future<LoadingState<void>> hateReply({
required int type, required int type,
required int action, required int action,
required int oid, required int oid,
@@ -113,7 +113,7 @@ abstract final class ReplyHttp {
} }
// 评论点赞 // 评论点赞
static Future<LoadingState<Null>> likeReply({ static Future<LoadingState<void>> likeReply({
required int type, required int type,
required int oid, required int oid,
required int rpid, required int rpid,
@@ -154,7 +154,7 @@ abstract final class ReplyHttp {
} }
} }
static Future<LoadingState<Null>> replyTop({ static Future<LoadingState<void>> replyTop({
required Object oid, required Object oid,
required Object type, required Object type,
required Object rpid, required Object rpid,
@@ -178,7 +178,7 @@ abstract final class ReplyHttp {
} }
} }
static Future<LoadingState<Null>> report({ static Future<LoadingState<void>> report({
required Object rpid, required Object rpid,
required Object oid, required Object oid,
required int reasonType, required int reasonType,
@@ -232,7 +232,7 @@ abstract final class ReplyHttp {
} }
} }
static Future<LoadingState<Null>> replySubjectModify({ static Future<LoadingState<void>> replySubjectModify({
required int oid, required int oid,
required int type, required int type,
required int action, required int action,

View File

@@ -74,7 +74,7 @@ abstract final class SponsorBlock {
return getErrMsg(res); return getErrMsg(res);
} }
static Future<LoadingState<Null>> voteOnSponsorTime({ static Future<LoadingState<void>> voteOnSponsorTime({
required String uuid, required String uuid,
int? type, int? type,
SegmentType? category, SegmentType? category,
@@ -93,7 +93,7 @@ abstract final class SponsorBlock {
return res.statusCode == 200 ? const Success(null) : getErrMsg(res); return res.statusCode == 200 ? const Success(null) : getErrMsg(res);
} }
static Future<LoadingState<Null>> viewedVideoSponsorTime(String uuid) async { static Future<LoadingState<void>> viewedVideoSponsorTime(String uuid) async {
final res = await Request().post( final res = await Request().post(
_api(SponsorBlockApi.viewedVideoSponsorTime), _api(SponsorBlockApi.viewedVideoSponsorTime),
data: {'UUID': uuid}, data: {'UUID': uuid},
@@ -102,7 +102,7 @@ abstract final class SponsorBlock {
return res.statusCode == 200 ? const Success(null) : getErrMsg(res); return res.statusCode == 200 ? const Success(null) : getErrMsg(res);
} }
static Future<LoadingState<Null>> uptimeStatus() async { static Future<LoadingState<void>> uptimeStatus() async {
final res = await Request().get( final res = await Request().get(
_api(SponsorBlockApi.uptimeStatus), _api(SponsorBlockApi.uptimeStatus),
options: options, options: options,

View File

@@ -105,7 +105,7 @@ abstract final class UserHttp {
} }
// 暂停观看历史 // 暂停观看历史
static Future<LoadingState<Null>> pauseHistory( static Future<LoadingState<void>> pauseHistory(
bool switchStatus, { bool switchStatus, {
Account? account, Account? account,
}) async { }) async {
@@ -144,7 +144,7 @@ abstract final class UserHttp {
} }
// 清空历史记录 // 清空历史记录
static Future<LoadingState<Null>> clearHistory({Account? account}) async { static Future<LoadingState<void>> clearHistory({Account? account}) async {
account ??= Accounts.history; account ??= Accounts.history;
final res = await Request().post( final res = await Request().post(
Api.clearHistory, Api.clearHistory,
@@ -165,7 +165,7 @@ abstract final class UserHttp {
} }
// 稍后再看 // 稍后再看
static Future<LoadingState<Null>> toViewLater({ static Future<LoadingState<void>> toViewLater({
String? bvid, String? bvid,
Object? aid, Object? aid,
}) async { }) async {
@@ -189,7 +189,7 @@ abstract final class UserHttp {
} }
// 移除已观看 // 移除已观看
static Future<LoadingState<Null>> toViewDel({required String aids}) async { static Future<LoadingState<void>> toViewDel({required String aids}) async {
final Map<String, dynamic> params = { final Map<String, dynamic> params = {
'csrf': Accounts.main.csrf, 'csrf': Accounts.main.csrf,
'resources': aids, 'resources': aids,
@@ -228,7 +228,7 @@ abstract final class UserHttp {
// } // }
// 清空稍后再看 // clean_type: null->all, 1->invalid, 2->viewed // 清空稍后再看 // clean_type: null->all, 1->invalid, 2->viewed
static Future<LoadingState<Null>> toViewClear([int? cleanType]) async { static Future<LoadingState<void>> toViewClear([int? cleanType]) async {
final res = await Request().post( final res = await Request().post(
Api.toViewClear, Api.toViewClear,
data: { data: {
@@ -245,7 +245,7 @@ abstract final class UserHttp {
} }
// 删除历史记录 // 删除历史记录
static Future<LoadingState<Null>> delHistory( static Future<LoadingState<void>> delHistory(
String kid, { String kid, {
Account? account, Account? account,
}) async { }) async {
@@ -390,7 +390,7 @@ abstract final class UserHttp {
} }
} }
static Future<LoadingState<Null>> dynamicReport({ static Future<LoadingState<void>> dynamicReport({
required Object mid, required Object mid,
required Object dynId, required Object dynId,
required int reasonType, required int reasonType,
@@ -430,7 +430,7 @@ abstract final class UserHttp {
} }
} }
static Future<LoadingState<Null>> spaceSettingMod(Map data) async { static Future<LoadingState<void>> spaceSettingMod(Map data) async {
final res = await Request().post( final res = await Request().post(
Api.spaceSettingMod, Api.spaceSettingMod,
queryParameters: { queryParameters: {
@@ -446,7 +446,7 @@ abstract final class UserHttp {
} }
} }
static Future<LoadingState<Null>> vipExpAdd() async { static Future<LoadingState<void>> vipExpAdd() async {
final res = await Request().post( final res = await Request().post(
Api.vipExpAdd, Api.vipExpAdd,
queryParameters: { queryParameters: {

View File

@@ -345,7 +345,7 @@ abstract final class VideoHttp {
} }
// 投币 // 投币
static Future<LoadingState<Null>> coinVideo({ static Future<LoadingState<void>> coinVideo({
required String bvid, required String bvid,
required int multiply, required int multiply,
int selectLike = 0, int selectLike = 0,
@@ -443,7 +443,7 @@ abstract final class VideoHttp {
} }
// (取消)点踩 // (取消)点踩
static Future<LoadingState<Null>> dislikeVideo({ static Future<LoadingState<void>> dislikeVideo({
required String bvid, required String bvid,
required bool type, required bool type,
}) async { }) async {
@@ -466,7 +466,7 @@ abstract final class VideoHttp {
} }
// 推送不感兴趣反馈 // 推送不感兴趣反馈
static Future<LoadingState<Null>> feedDislike({ static Future<LoadingState<void>> feedDislike({
required String goto, required String goto,
required int id, required int id,
int? reasonId, int? reasonId,
@@ -495,7 +495,7 @@ abstract final class VideoHttp {
} }
// 推送不感兴趣取消 // 推送不感兴趣取消
static Future<LoadingState<Null>> feedDislikeCancel({ static Future<LoadingState<void>> feedDislikeCancel({
required String goto, required String goto,
required int id, required int id,
int? reasonId, int? reasonId,
@@ -578,7 +578,7 @@ abstract final class VideoHttp {
} }
} }
static Future<LoadingState<Null>> replyDel({ static Future<LoadingState<void>> replyDel({
required int type, //replyType required int type, //replyType
required int oid, required int oid,
required int rpid, required int rpid,
@@ -602,7 +602,7 @@ abstract final class VideoHttp {
} }
// 操作用户关系 // 操作用户关系
static Future<LoadingState<Null>> relationMod({ static Future<LoadingState<void>> relationMod({
required int mid, required int mid,
required int act, required int act,
required int reSrc, required int reSrc,

View File

@@ -163,19 +163,15 @@ class Dash {
video = (json['video'] as List?) video = (json['video'] as List?)
?.map<VideoItem>((e) => VideoItem.fromJson(e)) ?.map<VideoItem>((e) => VideoItem.fromJson(e))
.toList(); .toList();
audio = (json['audio'] as List?) final audio = [
?.map<AudioItem>((e) => AudioItem.fromJson(e)) if (json['flac']?['audio'] case Map<String, dynamic> flac)
.toList(); AudioItem.fromJson(flac),
if (json['dolby']?['audio'] case List list) { if (json['dolby']?['audio'] case List list)
(audio ??= <AudioItem>[]).insertAll( ...list.map((e) => AudioItem.fromJson(e)),
0, if (json['audio'] case List list)
list.map((e) => AudioItem.fromJson(e)), ...list.map((e) => AudioItem.fromJson(e)),
); ];
} this.audio = audio.isEmpty ? null : audio;
final flacAudio = json['flac']?['audio'];
if (flacAudio != null) {
(audio ??= <AudioItem>[]).insert(0, AudioItem.fromJson(flacAudio));
}
} }
} }

View File

@@ -5,36 +5,46 @@ class Top {
Top({this.imgUrls}); Top({this.imgUrls});
@pragma('vm:notify-debugger-on-exception')
Top.fromJson(Map<String, dynamic> json) { Top.fromJson(Map<String, dynamic> json) {
try { try {
final list = json['result'] as List<dynamic>?; imgUrls = (json['result'] as List?)
if (list != null && list.isNotEmpty) { ?.map((e) => TopImage.fromJson(e))
imgUrls = list.map((e) => TopImage.fromJson(e)).toList(); .toList();
}
} catch (_) {} } catch (_) {}
} }
} }
class TopImage { class TopImage {
late final String cover; String? _defaultImage;
late final String fullCover;
String get header => _defaultImage ?? fullCover;
late final double dy; late final double dy;
@pragma('vm:notify-debugger-on-exception')
TopImage.fromJson(Map<String, dynamic> json) { TopImage.fromJson(Map<String, dynamic> json) {
cover = _defaultImage = noneNullOrEmptyString(
noneNullOrEmptyString(json['item']?['image']?['default_image']) ?? json['item']['image']?['default_image'],
json['cover']; );
fullCover = json['cover'];
double dy = 0;
try { try {
final Map image = json['item']['image'] ?? json['item']['animation']; final Map image = json['item']['image'] ?? json['item']['animation'];
final num halfHeight = (image['height'] as num) / 2; if (image['location'] case String locStr when (locStr.isNotEmpty)) {
final List<num> location = (image['location'] as String) final location = locStr
.split('-') .split('-')
.map(num.parse) .skip(1)
.toList(); .take(2)
final start = location[1]; .map(num.parse)
final end = location[2]; .toList();
dy = (start + (end - start) / 2 - halfHeight) / halfHeight; if (location.length == 2) {
} catch (_) { final num height = image['height'];
dy = 0.0; final start = location[0];
} final end = location[1];
dy = (start + end) / height - 1;
}
}
} catch (_) {}
this.dy = dy;
} }
} }

View File

@@ -6,7 +6,6 @@ import 'package:PiliPlus/grpc/dm.dart';
import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/plugin/pl_player/controller.dart'; import 'package:PiliPlus/plugin/pl_player/controller.dart';
import 'package:PiliPlus/plugin/pl_player/models/data_source.dart'; import 'package:PiliPlus/plugin/pl_player/models/data_source.dart';
import 'package:PiliPlus/plugin/pl_player/utils/danmaku_options.dart';
import 'package:PiliPlus/utils/accounts.dart'; import 'package:PiliPlus/utils/accounts.dart';
import 'package:PiliPlus/utils/path_utils.dart'; import 'package:PiliPlus/utils/path_utils.dart';
import 'package:PiliPlus/utils/utils.dart'; import 'package:PiliPlus/utils/utils.dart';
@@ -68,8 +67,8 @@ class PlDanmakuController {
if (elems.isEmpty) return; if (elems.isEmpty) return;
final uniques = HashMap<String, DanmakuElem>(); final uniques = HashMap<String, DanmakuElem>();
final shouldFilter = _plPlayerController.filters.count != 0; final filters = _plPlayerController.filters;
final danmakuWeight = DanmakuOptions.danmakuWeight; final shouldFilter = filters.count != 0;
for (final element in elems) { for (final element in elems) {
if (_isLogin) { if (_isLogin) {
element.isSelf = element.midHash == _plPlayerController.midHash; element.isSelf = element.midHash == _plPlayerController.midHash;
@@ -86,8 +85,7 @@ class PlDanmakuController {
} }
} }
if (element.weight < danmakuWeight || if (shouldFilter && filters.remove(element)) {
(shouldFilter && _plPlayerController.filters.remove(element))) {
continue; continue;
} }
} }

View File

@@ -40,7 +40,8 @@ class _MemberPageState extends State<MemberPage> {
late final String _heroTag; late final String _heroTag;
late final MemberController _userController; late final MemberController _userController;
PageController? _headerController; PageController? _headerController;
PageController get headerController => _headerController ??= PageController(); PageController getHeaderController() =>
_headerController ??= PageController();
@override @override
void initState() { void initState() {
@@ -367,7 +368,7 @@ class _MemberPageState extends State<MemberPage> {
onFollow: () => _userController.onFollow(context), onFollow: () => _userController.onFollow(context),
live: _userController.live, live: _userController.live,
silence: _userController.silence, silence: _userController.silence,
headerControllerBuilder: () => headerController, headerControllerBuilder: getHeaderController,
), ),
), ),
); );

View File

@@ -458,7 +458,7 @@ class UserInfoCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
HeaderLayoutWidget( HeaderLayoutWidget(
header: imgUrls != null header: imgUrls != null && imgUrls.isNotEmpty
? _buildCollectionHeader(context, scheme, isLight, imgUrls, width) ? _buildCollectionHeader(context, scheme, isLight, imgUrls, width)
: _buildHeader( : _buildHeader(
context, context,
@@ -491,12 +491,15 @@ class UserInfoCard extends StatelessWidget {
double width, double width,
) { ) {
if (imgUrls.length == 1) { if (imgUrls.length == 1) {
final img = imgUrls.first;
return _buildHeader( return _buildHeader(
context, context,
isLight, isLight,
width, width,
imgUrls.single.cover, img.header,
filter: false, filter: false,
fullCover: img.fullCover,
alignment: Alignment(0.0, img.dy),
); );
} }
final controller = headerControllerBuilder(); final controller = headerControllerBuilder();
@@ -505,7 +508,7 @@ class UserInfoCard extends StatelessWidget {
behavior: .opaque, behavior: .opaque,
onTap: () => PageUtils.imageView( onTap: () => PageUtils.imageView(
initialPage: controller.page?.round() ?? 0, initialPage: controller.page?.round() ?? 0,
imgList: imgUrls.map((e) => SourceModel(url: e.cover)).toList(), imgList: imgUrls.map((e) => SourceModel(url: e.fullCover)).toList(),
onPageChanged: controller.jumpToPage, onPageChanged: controller.jumpToPage,
), ),
child: Stack( child: Stack(
@@ -520,14 +523,14 @@ class UserInfoCard extends StatelessWidget {
itemBuilder: (context, index) { itemBuilder: (context, index) {
final img = imgUrls[index]; final img = imgUrls[index];
return fromHero( return fromHero(
tag: img.cover, tag: img.fullCover,
child: CachedNetworkImage( child: CachedNetworkImage(
fit: .cover, fit: .cover,
alignment: Alignment(0.0, img.dy), alignment: Alignment(0.0, img.dy),
height: kHeaderHeight, height: kHeaderHeight,
width: width, width: width,
memCacheWidth: memCacheWidth, memCacheWidth: memCacheWidth,
imageUrl: ImageUtils.thumbnailUrl(img.cover), imageUrl: ImageUtils.thumbnailUrl(img.header),
fadeInDuration: const Duration(milliseconds: 120), fadeInDuration: const Duration(milliseconds: 120),
fadeOutDuration: const Duration(milliseconds: 120), fadeOutDuration: const Duration(milliseconds: 120),
placeholder: (_, _) => placeholder: (_, _) =>
@@ -557,14 +560,18 @@ class UserInfoCard extends StatelessWidget {
double width, double width,
String imgUrl, { String imgUrl, {
bool filter = true, bool filter = true,
String? fullCover,
Alignment alignment = .center,
}) { }) {
final img = fullCover ?? imgUrl;
return GestureDetector( return GestureDetector(
behavior: .opaque, behavior: .opaque,
onTap: () => PageUtils.imageView(imgList: [SourceModel(url: imgUrl)]), onTap: () => PageUtils.imageView(imgList: [SourceModel(url: img)]),
child: fromHero( child: fromHero(
tag: imgUrl, tag: img,
child: CachedNetworkImage( child: CachedNetworkImage(
fit: .cover, fit: .cover,
alignment: alignment,
height: kHeaderHeight, height: kHeaderHeight,
width: width, width: width,
memCacheWidth: width.cacheSize(context), memCacheWidth: width.cacheSize(context),
@@ -760,7 +767,8 @@ class _HeaderIndicatorState extends State<HeaderIndicator> {
} }
void _updateProgress() { void _updateProgress() {
_progress = ((widget.pageController.page ?? 0) + 1) / widget.length; _progress = (widget.pageController.page ?? 0) / (widget.length - 1);
assert(_progress.isFinite && 0 <= _progress && _progress <= 1);
} }
@override @override

View File

@@ -1,6 +1,3 @@
import 'dart:typed_data';
import 'dart:ui';
import 'package:PiliPlus/common/constants.dart'; import 'package:PiliPlus/common/constants.dart';
import 'package:PiliPlus/common/widgets/button/icon_button.dart'; import 'package:PiliPlus/common/widgets/button/icon_button.dart';
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart'; import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
@@ -292,14 +289,15 @@ class _SavePanelState extends State<SavePanel> {
} }
SmartDialog.showLoading(); SmartDialog.showLoading();
try { try {
RenderRepaintBoundary boundary = final boundary =
boundaryKey.currentContext!.findRenderObject() boundaryKey.currentContext!.findRenderObject()
as RenderRepaintBoundary; as RenderRepaintBoundary;
final image = await boundary.toImage(pixelRatio: 3); final image = await boundary.toImage(pixelRatio: 3);
ByteData? byteData = await image.toByteData(format: ImageByteFormat.png); final byteData = await image.toByteData(format: .png);
Uint8List pngBytes = byteData!.buffer.asUint8List(); image.dispose();
String picName = final pngBytes = byteData!.buffer.asUint8List();
"${Constants.appName}_${DateFormat('yyyyMMddHHmmss').format(DateTime.now())}"; final picName =
"${Constants.appName}_${itemType}_${DateFormat('yyyyMMddHHmmss').format(DateTime.now())}";
if (isShare) { if (isShare) {
Get.back(); Get.back();
SmartDialog.dismiss(); SmartDialog.dismiss();
@@ -350,8 +348,7 @@ class _SavePanelState extends State<SavePanel> {
top: 12 + padding.top, top: 12 + padding.top,
bottom: 80 + padding.bottom, bottom: 80 + padding.bottom,
), ),
child: GestureDetector( child: Listener(
onTap: () {},
child: Container( child: Container(
width: maxWidth, width: maxWidth,
padding: const EdgeInsets.symmetric(horizontal: 12), padding: const EdgeInsets.symmetric(horizontal: 12),
@@ -361,7 +358,7 @@ class _SavePanelState extends State<SavePanel> {
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
decoration: BoxDecoration( decoration: BoxDecoration(
color: theme.colorScheme.surface, color: theme.colorScheme.surface,
borderRadius: const BorderRadius.all(Radius.circular(12)), borderRadius: const .all(.circular(12)),
), ),
child: AnimatedSize( child: AnimatedSize(
curve: Curves.easeInOut, curve: Curves.easeInOut,
@@ -393,40 +390,33 @@ class _SavePanelState extends State<SavePanel> {
Container( Container(
height: 81, height: 81,
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
margin: const EdgeInsets.symmetric( margin: const .symmetric(horizontal: 12),
horizontal: 12, padding: const .all(8),
),
padding: const EdgeInsets.all(8),
decoration: BoxDecoration( decoration: BoxDecoration(
color: theme.colorScheme.onInverseSurface, color: theme.colorScheme.onInverseSurface,
borderRadius: const BorderRadius.all( borderRadius: const .all(.circular(8)),
Radius.circular(8),
),
), ),
child: Row( child: Row(
children: [ children: [
NetworkImgLayer( NetworkImgLayer(
src: cover!, src: cover!,
height: coverSize, height: coverSize,
width: coverType == _CoverType.def16_9 width: coverType == .def16_9
? coverSize * ? coverSize *
StyleString.aspectRatio16x9 StyleString.aspectRatio16x9
: coverSize, : coverSize,
quality: 100, quality: 100,
borderRadius: const BorderRadius.all( borderRadius: const .all(.circular(6)),
Radius.circular(6),
),
), ),
const SizedBox(width: 10), const SizedBox(width: 10),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: .start,
CrossAxisAlignment.start,
children: [ children: [
Text( Text(
'$title\n', '$title\n',
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: .ellipsis,
), ),
if (pubdate != null) ...[ if (pubdate != null) ...[
const Spacer(), const Spacer(),
@@ -466,8 +456,7 @@ class _SavePanelState extends State<SavePanel> {
Text( Text(
'@$uname', '@$uname',
maxLines: 1, maxLines: 1,
overflow: overflow: .ellipsis,
TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
color: theme color: theme
.colorScheme .colorScheme
@@ -485,9 +474,7 @@ class _SavePanelState extends State<SavePanel> {
), ),
Text( Text(
DateFormatUtils.longFormatDs DateFormatUtils.longFormatDs
.format( .format(.now()),
DateTime.now(),
),
textAlign: TextAlign.end, textAlign: TextAlign.end,
style: TextStyle( style: TextStyle(
fontSize: 13, fontSize: 13,
@@ -504,12 +491,8 @@ class _SavePanelState extends State<SavePanel> {
child: Container( child: Container(
width: 88, width: 88,
height: 88, height: 88,
margin: const EdgeInsets.all( margin: const .all(12),
12, padding: const .all(3),
),
padding: const EdgeInsets.all(
3,
),
color: theme.brightness.isDark color: theme.brightness.isDark
? Colors.white ? Colors.white
: theme.colorScheme.surface, : theme.colorScheme.surface,

View File

@@ -202,9 +202,9 @@ mixin HeaderMixin<T extends StatefulWidget> on State<T> {
data: sliderTheme, data: sliderTheme,
child: Slider( child: Slider(
min: 0, min: 0,
max: 10, max: 11,
value: DanmakuOptions.danmakuWeight.toDouble(), value: DanmakuOptions.danmakuWeight.toDouble(),
divisions: 10, divisions: 11,
label: DanmakuOptions.danmakuWeight.toString(), label: DanmakuOptions.danmakuWeight.toString(),
onChanged: updateDanmakuWeight, onChanged: updateDanmakuWeight,
), ),

View File

@@ -7,7 +7,6 @@ import 'dart:ui' as ui;
import 'package:PiliPlus/common/constants.dart'; import 'package:PiliPlus/common/constants.dart';
import 'package:PiliPlus/http/browser_ua.dart'; import 'package:PiliPlus/http/browser_ua.dart';
import 'package:PiliPlus/http/constants.dart'; import 'package:PiliPlus/http/constants.dart';
import 'package:PiliPlus/http/init.dart';
import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/http/video.dart'; import 'package:PiliPlus/http/video.dart';
import 'package:PiliPlus/models/common/account_type.dart'; import 'package:PiliPlus/models/common/account_type.dart';
@@ -47,7 +46,6 @@ import 'package:PiliPlus/utils/storage_pref.dart';
import 'package:PiliPlus/utils/utils.dart'; import 'package:PiliPlus/utils/utils.dart';
import 'package:archive/archive.dart' show getCrc32; import 'package:archive/archive.dart' show getCrc32;
import 'package:canvas_danmaku/canvas_danmaku.dart'; import 'package:canvas_danmaku/canvas_danmaku.dart';
import 'package:dio/dio.dart' show Options;
import 'package:easy_debounce/easy_throttle.dart'; import 'package:easy_debounce/easy_throttle.dart';
import 'package:floating/floating.dart'; import 'package:floating/floating.dart';
import 'package:flutter/foundation.dart' show kDebugMode; import 'package:flutter/foundation.dart' show kDebugMode;
@@ -1659,34 +1657,7 @@ class PlPlayerController with BlockConfigMixin {
} }
Future<void> getVideoShot() async { Future<void> getVideoShot() async {
try { videoShot = await VideoHttp.videoshot(bvid: bvid, cid: cid!);
final res = await Request().get(
'/x/player/videoshot',
queryParameters: {
// 'aid': IdUtils.bv2av(_bvid),
'bvid': _bvid,
'cid': cid,
'index': 1,
},
options: Options(
headers: {
'user-agent': BrowserUa.pc,
'referer': 'https://www.bilibili.com/video/$bvid',
},
),
);
if (res.data['code'] == 0) {
final data = VideoShotData.fromJson(res.data['data']);
if (data.index.isNotEmpty) {
videoShot = Success(data);
return;
}
}
videoShot = const Error(null);
} catch (e) {
videoShot = const Error(null);
if (kDebugMode) debugPrint('getVideoShot: $e');
}
} }
void takeScreenshot() { void takeScreenshot() {