opt: item

opt: util

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-16 23:48:25 +08:00
parent 12c711424b
commit d886569dc3
85 changed files with 1983 additions and 1964 deletions

View File

@@ -8,6 +8,8 @@ import 'package:PiliPlus/pages/dynamics/repost_dyn_panel.dart';
import 'package:PiliPlus/pages/video/detail/introduction/pay_coins_page.dart';
import 'package:PiliPlus/utils/extension.dart';
import 'package:PiliPlus/utils/global_data.dart';
import 'package:PiliPlus/utils/page_utils.dart';
import 'package:PiliPlus/utils/request_utils.dart';
import 'package:PiliPlus/utils/utils.dart';
import 'package:expandable/expandable.dart';
import 'package:flutter/material.dart';
@@ -471,7 +473,7 @@ class VideoIntroController extends GetxController
),
onTap: () {
Get.back();
Utils.launchURL(videoUrl);
PageUtils.launchURL(videoUrl);
},
),
ListTile(
@@ -570,7 +572,7 @@ class VideoIntroController extends GetxController
}
return;
} else {
Utils.actionRelationMod(
RequestUtils.actionRelationMod(
context: context,
mid: videoDetail.value.owner?.mid,
isFollow: attr != 0,
@@ -598,7 +600,7 @@ class VideoIntroController extends GetxController
if (videoDetailCtr.isPlayAll) {
if (videoDetailCtr.mediaList.indexWhere((item) => item.bvid == bvid) ==
-1) {
Utils.toViewPage(
PageUtils.toVideoPage(
'bvid=$bvid&cid=$cid',
arguments: {
if (cover != null) 'pic': cover,
@@ -866,7 +868,7 @@ class VideoIntroController extends GetxController
);
} else {
SearchHttp.ab2c(aid: videoItem.aid, bvid: videoItem.bvid).then(
(cid) => Utils.toViewPage(
(cid) => PageUtils.toVideoPage(
'bvid=${videoItem.bvid}&cid=${videoItem.cid}',
arguments: {
'videoItem': videoItem,
@@ -912,10 +914,10 @@ class VideoIntroController extends GetxController
if (type == 'tap') {
actionFavVideo(type: 'default');
} else {
Utils.showFavBottomSheet(context: context, ctr: this);
PageUtils.showFavBottomSheet(context: context, ctr: this);
}
} else if (type != 'longPress') {
Utils.showFavBottomSheet(context: context, ctr: this);
PageUtils.showFavBottomSheet(context: context, ctr: this);
}
}
}

View File

@@ -5,6 +5,8 @@ import 'package:PiliPlus/pages/search/widgets/search_text.dart';
import 'package:PiliPlus/utils/app_scheme.dart';
import 'package:PiliPlus/utils/extension.dart';
import 'package:PiliPlus/utils/id_utils.dart';
import 'package:PiliPlus/utils/page_utils.dart';
import 'package:PiliPlus/utils/request_utils.dart';
import 'package:expandable/expandable.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/rendering.dart';
@@ -296,112 +298,125 @@ class _VideoInfoState extends State<VideoInfo> {
children: [
Expanded(
child: videoItem['staff'] == null
? GestureDetector(
onTap: onPushMember,
behavior: HitTestBehavior.opaque,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Obx(
() => Stack(
clipBehavior: Clip.none,
children: [
NetworkImgLayer(
type: 'avatar',
src: videoIntroController.userStat
.value['card']?['face'] ??
'',
width: 35,
height: 35,
fadeInDuration: Duration.zero,
fadeOutDuration: Duration.zero,
),
if ((videoIntroController.userStat
.value['card']
?['official_verify']
?['type'] ??
-1) !=
-1)
Positioned(
right: -2,
bottom: -2,
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context)
.colorScheme
.surface,
? Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
GestureDetector(
onTap: onPushMember,
behavior: HitTestBehavior.opaque,
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Obx(
() => Stack(
clipBehavior: Clip.none,
children: [
NetworkImgLayer(
type: 'avatar',
src: videoIntroController
.userStat
.value['card']
?['face'] ??
'',
width: 35,
height: 35,
fadeInDuration: Duration.zero,
fadeOutDuration:
Duration.zero,
),
if ((videoIntroController
.userStat
.value['card']
?[
'official_verify']
?['type'] ??
-1) !=
-1)
Positioned(
right: -2,
bottom: -2,
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context)
.colorScheme
.surface,
),
child: Icon(
Icons.offline_bolt,
color: videoIntroController
.userStat
.value['card']
?[
'official_verify']
?['type'] ==
0
? Colors.yellow
: Colors
.lightBlueAccent,
size: 14,
),
),
),
child: Icon(
Icons.offline_bolt,
color: videoIntroController
],
),
),
const SizedBox(width: 10),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Obx(
() => Text(
videoIntroController.userStat
.value['card']
?['name'] ??
"",
maxLines: 1,
overflow:
TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13,
color: (videoIntroController
.userStat
.value['card']?['vip']
?[
'status'] ??
-1) >
0 &&
videoIntroController
.userStat
.value['card']
?[
'official_verify']
?['type'] ==
0
? Colors.yellow
: Colors
.lightBlueAccent,
size: 14,
'vip']?['type'] ==
2
? context.vipColor
: null,
),
),
),
],
),
),
const SizedBox(width: 10),
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Obx(
() => Text(
videoIntroController.userStat
.value['card']
?['name'] ??
"",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13,
color: (videoIntroController
.userStat
.value['card']?['vip']
?[
'status'] ??
-1) >
0 &&
videoIntroController
.userStat
.value['card']
?[
'vip']?['type'] ==
2
? context.vipColor
: null,
const SizedBox(height: 0),
Obx(
() => Text(
'${Utils.numFormat(videoIntroController.userStat.value['follower'])}粉丝 ${videoIntroController.userStat.value['archive_count'] != null ? '${Utils.numFormat(videoIntroController.userStat.value['archive_count'])}视频' : ''}',
style: TextStyle(
fontSize: 12,
color:
t.colorScheme.outline,
),
),
),
),
const SizedBox(height: 0),
Obx(
() => Text(
'${Utils.numFormat(videoIntroController.userStat.value['follower'])}粉丝 ${videoIntroController.userStat.value['archive_count'] != null ? '${Utils.numFormat(videoIntroController.userStat.value['archive_count'])}视频' : ''}',
style: TextStyle(
fontSize: 12,
color: t.colorScheme.outline,
),
),
),
],
),
],
),
],
),
followButton(context, t),
],
),
),
const Spacer(),
followButton(context, t),
],
)
: SelfSizedHorizontalList(
gapSize: 25,
@@ -489,7 +504,7 @@ class _VideoInfoState extends State<VideoInfo> {
customBorder:
const CircleBorder(),
onTap: () {
Utils
RequestUtils
.actionRelationMod(
context: context,
mid: videoItem[
@@ -1140,7 +1155,7 @@ class _VideoInfoState extends State<VideoInfo> {
recognizer: TapGestureRecognizer()
..onTap = () {
try {
Utils.handleWebview(matchStr);
PageUtils.handleWebview(matchStr);
} catch (err) {
SmartDialog.showToast(err.toString());
}

View File

@@ -43,7 +43,7 @@ class _CreateFavPageState extends State<CreateFavPage> {
if (data['status']) {
_titleController.text = data['data']['title'];
_introController.text = data['data']['intro'];
_isPublic = Utils.isPublic(data['data']['attr']);
_isPublic = Utils.isPublicFav(data['data']['attr']);
_cover = data['data']['cover'];
_attr = data['data']['attr'];
} else {
@@ -171,7 +171,7 @@ class _CreateFavPageState extends State<CreateFavPage> {
Widget get _buildBody => SingleChildScrollView(
child: Column(
children: [
if (_attr == null || !Utils.isDefault(_attr!)) ...[
if (_attr == null || !Utils.isDefaultFav(_attr!)) ...[
ListTile(
tileColor: Theme.of(context).colorScheme.onInverseSurface,
onTap: () {
@@ -285,11 +285,11 @@ class _CreateFavPageState extends State<CreateFavPage> {
),
title: TextField(
autofocus: true,
readOnly: _attr != null && Utils.isDefault(_attr!),
readOnly: _attr != null && Utils.isDefaultFav(_attr!),
controller: _titleController,
style: TextStyle(
fontSize: 14,
color: _attr != null && Utils.isDefault(_attr!)
color: _attr != null && Utils.isDefaultFav(_attr!)
? Theme.of(context).colorScheme.outline
: null,
),
@@ -312,7 +312,7 @@ class _CreateFavPageState extends State<CreateFavPage> {
),
),
const SizedBox(height: 16),
if (_attr == null || !Utils.isDefault(_attr!)) ...[
if (_attr == null || !Utils.isDefaultFav(_attr!)) ...[
ListTile(
tileColor: Theme.of(context).colorScheme.onInverseSurface,
title: Row(

View File

@@ -107,7 +107,7 @@ class _FavPanelState extends State<FavPanel> {
1,
index),
dense: true,
leading: Utils.isPublic(widget
leading: Utils.isPublicFav(widget
.ctr.favFolderData.value.list[index].attr)
? const Icon(Icons.folder_outlined)
: const Icon(Icons.lock_outline),
@@ -115,7 +115,7 @@ class _FavPanelState extends State<FavPanel> {
title: Text(widget
.ctr.favFolderData.value.list[index].title!),
subtitle: Text(
'${widget.ctr.favFolderData.value.list[index].mediaCount}个内容 . ${Utils.isPublicText(widget.ctr.favFolderData.value.list[index].attr)}',
'${widget.ctr.favFolderData.value.list[index].mediaCount}个内容 . ${Utils.isPublicFavText(widget.ctr.favFolderData.value.list[index].attr)}',
),
trailing: Transform.scale(
scale: 0.9,