Merge branch 'design'

This commit is contained in:
guozhigq
2024-11-16 14:58:06 +08:00
5 changed files with 48 additions and 11 deletions

View File

@ -127,7 +127,7 @@ class AtItem extends StatelessWidget {
return InkWell( return InkWell(
onTap: () async { onTap: () async {
MessageUtils.onClickMessage(context, uri, nativeUri, type); MessageUtils.onClickMessage(context, uri, nativeUri, type, null);
}, },
child: Padding( child: Padding(
padding: const EdgeInsets.all(14), padding: const EdgeInsets.all(14),

View File

@ -125,7 +125,7 @@ class LikeItem extends StatelessWidget {
final String type = item.item!.type!; final String type = item.item!.type!;
return InkWell( return InkWell(
onTap: () async { onTap: () async {
MessageUtils.onClickMessage(context, uri, nativeUri, type); MessageUtils.onClickMessage(context, uri, nativeUri, type, null);
}, },
child: Stack( child: Stack(
children: [ children: [

View File

@ -117,7 +117,7 @@ class ReplyItem extends StatelessWidget {
final String type = item.item!.type!; final String type = item.item!.type!;
return InkWell( return InkWell(
onTap: () async { onTap: () async {
MessageUtils.onClickMessage(context, uri, nativeUri, type); MessageUtils.onClickMessage(context, uri, nativeUri, type, item.item!);
}, },
child: Padding( child: Padding(
padding: const EdgeInsets.all(14), padding: const EdgeInsets.all(14),
@ -155,6 +155,9 @@ class ReplyItem extends StatelessWidget {
text: '回复了我的评论', text: '回复了我的评论',
style: TextStyle(color: outline), style: TextStyle(color: outline),
), ),
if (item.item!.type! == 'dynamic')
TextSpan(
text: '对我的动态发表了评论', style: TextStyle(color: outline)),
])), ])),
const SizedBox(height: 6), const SizedBox(height: 6),
Text.rich( Text.rich(
@ -197,11 +200,32 @@ class ReplyItem extends StatelessWidget {
), ),
), ),
if (item.item!.type! == 'video') if (item.item!.type! == 'video')
NetworkImgLayer( // NetworkImgLayer(
// width: 60,
// height: 60,
// src: item.item!.image,
// radius: 6,
// ),
Container(
width: 60, width: 60,
height: 60, height: 60,
src: item.item!.image, clipBehavior: Clip.hardEdge,
radius: 6, decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6)),
),
child: Image.network(item.item!.image!, fit: BoxFit.cover),
),
if (item.item!.type! == 'dynamic')
Container(
width: 60,
height: 80,
padding: const EdgeInsets.all(4),
child: Text(
item.item!.title!,
maxLines: 4,
style: const TextStyle(fontSize: 12, letterSpacing: 0.3),
overflow: TextOverflow.ellipsis,
),
), ),
], ],
), ),

View File

@ -3,6 +3,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:pilipala/http/search.dart'; import 'package:pilipala/http/search.dart';
import 'package:pilipala/models/common/reply_type.dart'; import 'package:pilipala/models/common/reply_type.dart';
import 'package:pilipala/models/msg/reply.dart';
import 'package:pilipala/pages/video/detail/reply_reply/index.dart'; import 'package:pilipala/pages/video/detail/reply_reply/index.dart';
import 'package:pilipala/utils/app_scheme.dart'; import 'package:pilipala/utils/app_scheme.dart';
import 'package:pilipala/utils/utils.dart'; import 'package:pilipala/utils/utils.dart';
@ -10,7 +11,12 @@ import 'package:pilipala/utils/utils.dart';
class MessageUtils { class MessageUtils {
// 回复我的、收到的赞点击 // 回复我的、收到的赞点击
static void onClickMessage( static void onClickMessage(
BuildContext context, Uri uri, Uri nativeUri, String type) async { BuildContext context,
Uri uri,
Uri nativeUri,
String type,
ReplyContentItem? item,
) async {
final String path = uri.path; final String path = uri.path;
final String bvid = path.split('/').last; final String bvid = path.split('/').last;
String? sourceType; String? sourceType;
@ -24,8 +30,8 @@ class MessageUtils {
if (nativePath.contains('detail')) { if (nativePath.contains('detail')) {
// 动态详情 // 动态详情
sourceType = 'opus'; sourceType = 'opus';
oid = nativePath.split('/')[3]; oid = item?.subjectId!.toString() ?? nativePath.split('/')[3];
commentRootId = nativePath.split('/')[4]; commentRootId = item?.sourceId!.toString() ?? nativePath.split('/')[4];
} }
switch (type) { switch (type) {
case 'video': case 'video':
@ -47,6 +53,7 @@ class MessageUtils {
} }
break; break;
case 'reply': case 'reply':
case 'dynamic':
debugPrint('commentRootId: $oid, $commentRootId'); debugPrint('commentRootId: $oid, $commentRootId');
navigateToComment( navigateToComment(
context, context,

View File

@ -282,8 +282,14 @@ class PiliSchame {
} }
break; break;
default: default:
SmartDialog.showToast('未匹配地址,请联系开发者'); final Map<String, String> queryParameters = value.queryParameters;
Clipboard.setData(ClipboardData(text: value.toString())); final String? enterUri = queryParameters['enterUri'];
if (enterUri != null && enterUri.startsWith('bilibili://')) {
biliScheme(Uri.parse(enterUri));
} else {
SmartDialog.showToast('未匹配地址,请联系开发者');
Clipboard.setData(ClipboardData(text: value.toString()));
}
break; break;
} }
} }