refa: avatar (not radical) (#731)

* refa: avatar (not radical)

* update

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>

---------

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
My-Responsitories
2025-04-22 14:36:01 +08:00
committed by GitHub
parent 4c0443ec28
commit 3d4bcbc082
7 changed files with 319 additions and 419 deletions

View File

@@ -1,5 +1,6 @@
import 'dart:async';
import 'package:PiliPlus/common/widgets/avatar.dart';
import 'package:PiliPlus/common/widgets/self_sized_horizontal_list.dart';
import 'package:PiliPlus/pages/search/widgets/search_text.dart';
import 'package:PiliPlus/utils/app_scheme.dart';
@@ -296,54 +297,22 @@ class _VideoInfoState extends State<VideoInfo> {
child: Row(
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
? const Color(0xFFFFCC00)
: Colors.lightBlueAccent,
size: 14,
),
),
),
],
),
),
Obx(() => Avatar(
avatar: videoIntroController.userStat
.value['card']?['face'] ??
'',
size: 35,
badgeSize: 14,
isVip: (videoIntroController.userStat
.value['card']?['vip']
?['status'] ??
-1) >
0,
officialType: videoIntroController
.userStat.value['card']
?['official_verify']?['type'],
// garbPendantImage: videoIntroController.userStat.value['card']?['pendant']?['image'],
)),
const SizedBox(width: 10),
Column(
crossAxisAlignment:

View File

@@ -1,6 +1,7 @@
import 'dart:math';
import 'package:PiliPlus/common/constants.dart';
import 'package:PiliPlus/common/widgets/avatar.dart';
import 'package:PiliPlus/common/widgets/badge.dart';
import 'package:PiliPlus/common/widgets/image_view.dart';
import 'package:PiliPlus/common/widgets/report.dart';
@@ -156,93 +157,16 @@ class ReplyItemGrpc extends StatelessWidget {
);
}
Widget lfAvtar(BuildContext context) {
return Stack(
clipBehavior: Clip.none,
children: [
if (ModuleAuthorModel.showDynDecorate &&
replyItem.member.hasGarbPendantImage()) ...[
Padding(
padding: const EdgeInsets.all(2),
child: NetworkImgLayer(
src: replyItem.member.face,
width: 30,
height: 30,
type: 'avatar',
),
),
Positioned(
left: -9,
top: -9,
child: IgnorePointer(
child: CachedNetworkImage(
width: 52,
height: 52,
imageUrl:
Utils.thumbnailImgUrl(replyItem.member.garbPendantImage),
),
),
),
] else
NetworkImgLayer(
src: replyItem.member.face,
width: 34,
height: 34,
type: 'avatar',
),
if (replyItem.member.vipStatus > 0)
Positioned(
right: 0,
bottom: 0,
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).colorScheme.surface,
),
child: Image.asset(
'assets/images/big-vip.png',
height: 14,
semanticLabel: "大会员",
),
),
),
if (replyItem.member.officialVerifyType == 0)
Positioned(
left: 0,
bottom: 0,
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).colorScheme.surface,
),
child: const Icon(
Icons.offline_bolt,
color: Color(0xFFFFCC00),
size: 14,
semanticLabel: "认证个人",
),
),
)
else if (replyItem.member.officialVerifyType == 1)
Positioned(
left: 0,
bottom: 0,
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).colorScheme.surface,
),
child: const Icon(
Icons.offline_bolt,
color: Colors.lightBlueAccent,
size: 14,
semanticLabel: "认证机构",
),
),
),
],
);
}
Widget lfAvtar() => Avatar(
avatar: replyItem.member.face,
size: 34,
badgeSize: 14,
isVip: replyItem.member.vipStatus > 0,
officialType: replyItem.member.officialVerifyType.toInt(),
garbPendantImage: replyItem.member.hasGarbPendantImage()
? replyItem.member.garbPendantImage
: null,
);
Widget content(BuildContext context) {
return Column(
@@ -259,7 +183,7 @@ class ReplyItemGrpc extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
lfAvtar(context),
lfAvtar(),
const SizedBox(width: 12),
Column(
crossAxisAlignment: CrossAxisAlignment.start,