opt handle res

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-29 17:17:35 +08:00
parent b643cb1bd0
commit 924d51d41b
198 changed files with 3715 additions and 2001 deletions

View File

@@ -83,7 +83,7 @@ class _MemberReportPanelState extends State<MemberReportPanel> {
SmartDialog.showToast('至少选择一项作为举报内容');
} else {
Get.back();
dynamic result = await MemberHttp.reportMember(
var result = await MemberHttp.reportMember(
widget.mid,
reason: _reason.join(','),
reasonV2: _reasonV2 != null ? _reasonV2! + 1 : null,

View File

@@ -45,8 +45,8 @@ class VideoCardH extends StatelessWidget {
final int aid = videoItem.aid!;
final String bvid = videoItem.bvid!;
String type = 'video';
if (videoItem is SearchVideoItemModel) {
var typeOrNull = (videoItem as SearchVideoItemModel).type;
if (videoItem case SearchVideoItemModel item) {
var typeOrNull = item.type;
if (typeOrNull?.isNotEmpty == true) {
type = typeOrNull!;
}
@@ -79,8 +79,8 @@ class VideoCardH extends StatelessWidget {
SmartDialog.showToast('课堂视频暂不支持播放');
return;
} else if (type == 'live_room') {
if (videoItem is SearchVideoItemModel) {
int? roomId = (videoItem as SearchVideoItemModel).id;
if (videoItem case SearchVideoItemModel item) {
int? roomId = item.id;
if (roomId != null) {
Get.toNamed('/liveRoom?roomid=$roomId');
}
@@ -90,11 +90,9 @@ class VideoCardH extends StatelessWidget {
}
return;
}
if ((videoItem is HotVideoItemModel) &&
(videoItem as HotVideoItemModel).redirectUrl?.isNotEmpty ==
true) {
if (PageUtils.viewPgcFromUri(
(videoItem as HotVideoItemModel).redirectUrl!)) {
if (videoItem case HotVideoItemModel item) {
if (item.redirectUrl?.isNotEmpty == true &&
PageUtils.viewPgcFromUri(item.redirectUrl!)) {
return;
}
}
@@ -132,9 +130,8 @@ class VideoCardH extends StatelessWidget {
final double maxWidth = boxConstraints.maxWidth;
final double maxHeight = boxConstraints.maxHeight;
num? progress;
if (videoItem is HotVideoItemModel) {
progress =
(videoItem as HotVideoItemModel).progress;
if (videoItem case HotVideoItemModel item) {
progress = item.progress;
}
return Stack(
@@ -145,10 +142,9 @@ class VideoCardH extends StatelessWidget {
width: maxWidth,
height: maxHeight,
),
if (videoItem is HotVideoItemModel)
if (videoItem case HotVideoItemModel item)
PBadge(
text:
(videoItem as HotVideoItemModel).pgcLabel,
text: item.pgcLabel,
top: 6.0,
right: 6.0,
),
@@ -222,32 +218,31 @@ class VideoCardH extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if ((videoItem is SearchVideoItemModel) &&
(videoItem as SearchVideoItemModel).titleList?.isNotEmpty == true)
Expanded(
child: Text.rich(
overflow: TextOverflow.ellipsis,
maxLines: 2,
TextSpan(
children: [
for (var i
in (videoItem as SearchVideoItemModel).titleList!)
TextSpan(
text: i['text'],
style: TextStyle(
fontSize: theme.textTheme.bodyMedium!.fontSize,
height: 1.42,
letterSpacing: 0.3,
color: i['type'] == 'em'
? theme.colorScheme.primary
: theme.colorScheme.onSurface,
if (videoItem case SearchVideoItemModel item) ...[
if (item.titleList?.isNotEmpty == true)
Expanded(
child: Text.rich(
overflow: TextOverflow.ellipsis,
maxLines: 2,
TextSpan(
children: [
for (var i in item.titleList!)
TextSpan(
text: i['text'],
style: TextStyle(
fontSize: theme.textTheme.bodyMedium!.fontSize,
height: 1.42,
letterSpacing: 0.3,
color: i['type'] == 'em'
? theme.colorScheme.primary
: theme.colorScheme.onSurface,
),
),
),
],
],
),
),
),
)
else
)
] else
Expanded(
child: Text(
videoItem.title,

View File

@@ -72,9 +72,8 @@ class VideoCustomActions {
SmartDialog.showToast("请退出账号后重新登录");
return;
}
if (videoItem is RecVideoItemAppModel) {
RecVideoItemAppModel v = videoItem as RecVideoItemAppModel;
ThreePoint? tp = v.threePoint;
if (videoItem case RecVideoItemAppModel item) {
ThreePoint? tp = item.threePoint;
if (tp == null) {
SmartDialog.showToast("未能获取threePoint");
return;
@@ -92,8 +91,8 @@ class VideoCustomActions {
var res = await VideoHttp.feedDislike(
reasonId: r?.id,
feedbackId: f?.id,
id: v.param!,
goto: v.goto!,
id: item.param!,
goto: item.goto!,
);
SmartDialog.dismiss();
SmartDialog.showToast(
@@ -143,8 +142,8 @@ class VideoCustomActions {
onPressed: () async {
SmartDialog.showLoading(msg: '正在提交');
var res = await VideoHttp.feedDislikeCancel(
id: v.param!,
goto: v.goto!,
id: item.param!,
goto: item.goto!,
);
SmartDialog.dismiss();
SmartDialog.showToast(
@@ -183,8 +182,7 @@ class VideoCustomActions {
Get.back();
SmartDialog.showLoading(msg: '正在提交');
var res = await VideoHttp.dislikeVideo(
bvid: videoItem.bvid as String,
type: true);
bvid: videoItem.bvid!, type: true);
SmartDialog.dismiss();
SmartDialog.showToast(
res['status'] ? "点踩成功" : res['msg'],
@@ -203,8 +201,7 @@ class VideoCustomActions {
Get.back();
SmartDialog.showLoading(msg: '正在提交');
var res = await VideoHttp.dislikeVideo(
bvid: videoItem.bvid as String,
type: false);
bvid: videoItem.bvid!, type: false);
SmartDialog.dismiss();
SmartDialog.showToast(
res['status'] ? "取消踩" : res['msg']);