Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-03-28 20:31:48 +08:00
parent 64c05a1b06
commit 2fc3f9864f
5 changed files with 159 additions and 115 deletions

View File

@@ -0,0 +1,31 @@
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
class ExtraHitTestWidget extends SingleChildRenderObjectWidget {
const ExtraHitTestWidget({
super.key,
required this.width,
required Widget super.child,
});
final double width;
@override
RenderObject createRenderObject(BuildContext context) {
return RenderExtraHitTestWidget(width: width);
}
}
class RenderExtraHitTestWidget extends RenderProxyBox {
RenderExtraHitTestWidget({
required double width,
}) : _width = width;
final double _width;
@override
bool hitTestChildren(BoxHitTestResult result, {required Offset position}) {
return super.hitTestChildren(result, position: position) ||
position.dx <= _width;
}
}

View File

@@ -53,7 +53,7 @@ class SuperChatItem {
'ts': 0, 'ts': 0,
'uinfo': { 'uinfo': {
'medal': { 'medal': {
"name": "MedalName", "name": "Medal",
"level": Utils.random.nextInt(40), "level": Utils.random.nextInt(40),
"id": 123, "id": 123,
"ruid": 456, "ruid": 456,

View File

@@ -3,6 +3,7 @@ import 'dart:math';
import 'package:PiliPlus/common/assets.dart'; import 'package:PiliPlus/common/assets.dart';
import 'package:PiliPlus/common/style.dart'; import 'package:PiliPlus/common/style.dart';
import 'package:PiliPlus/common/widgets/dialog/report.dart'; import 'package:PiliPlus/common/widgets/dialog/report.dart';
import 'package:PiliPlus/common/widgets/extra_hit_test_widget.dart';
import 'package:PiliPlus/common/widgets/pendant_avatar.dart'; import 'package:PiliPlus/common/widgets/pendant_avatar.dart';
import 'package:PiliPlus/http/constants.dart'; import 'package:PiliPlus/http/constants.dart';
import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/loading_state.dart';
@@ -98,37 +99,40 @@ class AuthorPanel extends StatelessWidget {
Get.toNamed('/member?mid=${moduleAuthor.mid}'); Get.toNamed('/member?mid=${moduleAuthor.mid}');
} }
: null, : null,
child: Row( child: ExtraHitTestWidget(
spacing: 10, width: 50,
children: [ child: Row(
PendantAvatar( spacing: 10,
size: 40, children: [
moduleAuthor.face, PendantAvatar(
pendantImage: moduleAuthor.pendant?.image, size: 40,
), moduleAuthor.face,
Expanded( pendantImage: moduleAuthor.pendant?.image,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
moduleAuthor.name!,
maxLines: 1,
overflow: .ellipsis,
style: TextStyle(
color:
moduleAuthor.vip != null &&
moduleAuthor.vip!.status > 0 &&
moduleAuthor.vip!.type == 2
? theme.colorScheme.vipColor
: theme.colorScheme.onSurface,
fontSize: theme.textTheme.titleSmall!.fontSize,
),
),
?pubTs,
],
), ),
), Expanded(
], child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
moduleAuthor.name!,
maxLines: 1,
overflow: .ellipsis,
style: TextStyle(
color:
moduleAuthor.vip != null &&
moduleAuthor.vip!.status > 0 &&
moduleAuthor.vip!.type == 2
? theme.colorScheme.vipColor
: theme.colorScheme.onSurface,
fontSize: theme.textTheme.titleSmall!.fontSize,
),
),
?pubTs,
],
),
),
],
),
), ),
); );
Widget? moreBtn = isSave Widget? moreBtn = isSave

View File

@@ -153,11 +153,11 @@ class _SuperChatCardState extends State<SuperChatCard> {
name = Row( name = Row(
spacing: 5, spacing: 5,
children: [ children: [
Flexible(child: name),
MedalWidget.fromMedalInfo( MedalWidget.fromMedalInfo(
medal: medal, medal: medal,
padding: MedalWidget.mediumPadding, padding: MedalWidget.mediumPadding,
), ),
Flexible(child: name),
], ],
); );
} catch (e, s) { } catch (e, s) {

View File

@@ -5,6 +5,7 @@ import 'package:PiliPlus/common/constants.dart';
import 'package:PiliPlus/common/style.dart'; import 'package:PiliPlus/common/style.dart';
import 'package:PiliPlus/common/widgets/badge.dart'; import 'package:PiliPlus/common/widgets/badge.dart';
import 'package:PiliPlus/common/widgets/dialog/report.dart'; import 'package:PiliPlus/common/widgets/dialog/report.dart';
import 'package:PiliPlus/common/widgets/extra_hit_test_widget.dart';
import 'package:PiliPlus/common/widgets/flutter/text/text.dart' as custom_text; import 'package:PiliPlus/common/widgets/flutter/text/text.dart' as custom_text;
import 'package:PiliPlus/common/widgets/gesture/tap_gesture_recognizer.dart'; import 'package:PiliPlus/common/widgets/gesture/tap_gesture_recognizer.dart';
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart'; import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
@@ -139,100 +140,108 @@ class ReplyItemGrpc extends StatelessWidget {
feedBack(); feedBack();
Get.toNamed('/member?mid=${replyItem.mid}'); Get.toNamed('/member?mid=${replyItem.mid}');
}, },
child: Row( child: ExtraHitTestWidget(
crossAxisAlignment: .center, width: 46,
spacing: 12, child: Row(
children: [ crossAxisAlignment: .center,
PendantAvatar( spacing: 12,
member.face, children: [
size: 34, PendantAvatar(
badgeSize: 14, member.face,
vipStatus: member.vipStatus.toInt(), size: 34,
officialType: member.officialVerifyType.toInt(), badgeSize: 14,
pendantImage: member.hasGarbPendantImage() vipStatus: member.vipStatus.toInt(),
? member.garbPendantImage officialType: member.officialVerifyType.toInt(),
: null, pendantImage: member.hasGarbPendantImage()
), ? member.garbPendantImage
Expanded( : null,
child: Column( ),
crossAxisAlignment: CrossAxisAlignment.start, Expanded(
mainAxisSize: MainAxisSize.min, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Row( mainAxisSize: MainAxisSize.min,
spacing: 6, children: [
children: [ Row(
Flexible( spacing: 6,
child: Text( children: [
member.name, Flexible(
maxLines: 1, child: Text(
overflow: .ellipsis, member.name,
style: TextStyle( maxLines: 1,
color: (member.vipStatus > 0 && member.vipType == 2) overflow: .ellipsis,
? theme.colorScheme.vipColor style: TextStyle(
: theme.colorScheme.outline, color: (member.vipStatus > 0 && member.vipType == 2)
fontSize: 13, ? theme.colorScheme.vipColor
: theme.colorScheme.outline,
fontSize: 13,
),
), ),
), ),
), Image.asset(
Image.asset( Utils.levelName(
Utils.levelName( member.level,
member.level, isSeniorMember: member.isSeniorMember == 1,
isSeniorMember: member.isSeniorMember == 1,
),
height: 11,
cacheHeight: 11.cacheSize(context),
),
if (replyItem.mid == upMid)
const PBadge(
text: 'UP',
size: PBadgeSize.small,
isStack: false,
fontSize: 9,
)
else if (GlobalData().showMedal &&
member.hasFansMedalLevel())
MedalWidget(
medalName: member.fansMedalName,
level: member.fansMedalLevel.toInt(),
backgroundColor: DmUtils.decimalToColor(
member.fansMedalColor.toInt(),
), ),
nameColor: DmUtils.decimalToColor( height: 11,
member.fansMedalColorName.toInt(), cacheHeight: 11.cacheSize(context),
),
if (replyItem.mid == upMid)
const PBadge(
text: 'UP',
size: PBadgeSize.small,
isStack: false,
fontSize: 9,
)
else if (GlobalData().showMedal &&
member.hasFansMedalLevel())
MedalWidget(
medalName: member.fansMedalName,
level: member.fansMedalLevel.toInt(),
backgroundColor: DmUtils.decimalToColor(
member.fansMedalColor.toInt(),
),
nameColor: DmUtils.decimalToColor(
member.fansMedalColorName.toInt(),
),
padding: const .symmetric(
horizontal: 6,
vertical: 1.5,
),
), ),
padding: const .symmetric(horizontal: 6, vertical: 1.5), ],
), ),
], Row(
), mainAxisSize: MainAxisSize.min,
Row( children: [
mainAxisSize: MainAxisSize.min,
children: [
Text(
replyLevel == 0
? DateFormatUtils.format(
replyItem.ctime.toInt(),
format: DateFormatUtils.longFormatDs,
)
: DateFormatUtils.dateFormat(replyItem.ctime.toInt()),
style: TextStyle(
fontSize: theme.textTheme.labelSmall!.fontSize,
color: theme.colorScheme.outline,
),
),
if (replyItem.replyControl.hasLocation())
Text( Text(
'${replyItem.replyControl.location}', replyLevel == 0
? DateFormatUtils.format(
replyItem.ctime.toInt(),
format: DateFormatUtils.longFormatDs,
)
: DateFormatUtils.dateFormat(
replyItem.ctime.toInt(),
),
style: TextStyle( style: TextStyle(
fontSize: theme.textTheme.labelSmall!.fontSize, fontSize: theme.textTheme.labelSmall!.fontSize,
color: theme.colorScheme.outline, color: theme.colorScheme.outline,
), ),
), ),
], if (replyItem.replyControl.hasLocation())
), Text(
], '${replyItem.replyControl.location}',
style: TextStyle(
fontSize: theme.textTheme.labelSmall!.fontSize,
color: theme.colorScheme.outline,
),
),
],
),
],
),
), ),
), ],
], ),
), ),
); );
if (PendantAvatar.showDecorate) { if (PendantAvatar.showDecorate) {