mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-23 04:00:28 +08:00
@@ -23,7 +23,6 @@ import 'package:flutter/rendering.dart' show BoxHitTestResult, BoxParentData;
|
||||
const double kHeaderHeight = 135.0;
|
||||
|
||||
const double kAvatarSize = 80.0;
|
||||
const double kPendantAvatarSize = 70.0;
|
||||
const double _kAvatarLeftPadding = 20.0;
|
||||
const double _kAvatarTopPadding = 115.0;
|
||||
const double _kAvatarEffectiveHeight =
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:PiliPlus/common/assets.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/common/widgets/pendant_avatar.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_medal_wall/data.dart';
|
||||
@@ -6,8 +7,6 @@ import 'package:PiliPlus/utils/app_scheme.dart';
|
||||
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/theme_ext.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MedalWall extends StatelessWidget {
|
||||
@@ -71,42 +70,6 @@ class MedalWall extends StatelessWidget {
|
||||
final item = response.list![index];
|
||||
final uinfoMedal = item.uinfoMedal!;
|
||||
final isLiving = item.liveStatus == 1;
|
||||
Color? nameColor;
|
||||
Color? backgroundColor;
|
||||
try {
|
||||
nameColor = Utils.parseColor(uinfoMedal.v2MedalColorText!);
|
||||
backgroundColor = Utils.parseMedalColor(
|
||||
uinfoMedal.v2MedalColorStart!,
|
||||
);
|
||||
} catch (e, s) {
|
||||
if (kDebugMode) {
|
||||
Utils.reportError(e, s);
|
||||
}
|
||||
}
|
||||
final medal = MedalWidget(
|
||||
medalName: uinfoMedal.name!,
|
||||
level: uinfoMedal.level!,
|
||||
backgroundColor:
|
||||
backgroundColor ?? colorScheme.secondaryContainer,
|
||||
nameColor: nameColor ?? colorScheme.onSecondaryContainer,
|
||||
levelColor: nameColor ?? colorScheme.onSecondaryContainer,
|
||||
);
|
||||
Widget avatar = PendantAvatar(
|
||||
avatar: item.targetIcon,
|
||||
size: 38,
|
||||
officialType: switch (item.official) {
|
||||
1 => 0,
|
||||
2 => 1,
|
||||
_ => null,
|
||||
},
|
||||
);
|
||||
if (isLiving) {
|
||||
avatar = GestureDetector(
|
||||
onTap: () =>
|
||||
PageUtils.toDupNamed('/member?mid=${uinfoMedal.ruid}'),
|
||||
child: avatar,
|
||||
);
|
||||
}
|
||||
return ListTile(
|
||||
onTap: () {
|
||||
if (isLiving) {
|
||||
@@ -115,8 +78,21 @@ class MedalWall extends StatelessWidget {
|
||||
PageUtils.toDupNamed('/member?mid=${uinfoMedal.ruid}');
|
||||
}
|
||||
},
|
||||
visualDensity: VisualDensity.comfortable,
|
||||
leading: avatar,
|
||||
visualDensity: .comfortable,
|
||||
leading: PendantAvatar(
|
||||
item.targetIcon,
|
||||
size: 38,
|
||||
officialType: switch (item.official) {
|
||||
1 => 0,
|
||||
2 => 1,
|
||||
_ => null,
|
||||
},
|
||||
onTap: isLiving
|
||||
? () => PageUtils.toDupNamed(
|
||||
'/member?mid=${uinfoMedal.ruid}',
|
||||
)
|
||||
: null,
|
||||
),
|
||||
title: Row(
|
||||
children: [
|
||||
Flexible(
|
||||
@@ -131,7 +107,7 @@ class MedalWall extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const .only(left: 4),
|
||||
child: Image.asset(
|
||||
'assets/images/live.gif',
|
||||
Assets.livingChart,
|
||||
height: 16,
|
||||
cacheHeight: 16.cacheSize(context),
|
||||
color: colorScheme.primary,
|
||||
@@ -139,7 +115,7 @@ class MedalWall extends StatelessWidget {
|
||||
),
|
||||
Padding(
|
||||
padding: const .only(left: 8),
|
||||
child: medal,
|
||||
child: MedalWidget.fromMedalInfo(medal: uinfoMedal),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
import 'package:PiliPlus/common/constants.dart';
|
||||
import 'package:PiliPlus/common/style.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_medal_wall/uinfo_medal.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
const _kFontSize = 10.0;
|
||||
const _kStrutStyle = StrutStyle(height: 1, leading: 0, fontSize: _kFontSize);
|
||||
const _kPadding = EdgeInsets.symmetric(horizontal: 8, vertical: 3);
|
||||
|
||||
class MedalWidget extends StatelessWidget {
|
||||
const MedalWidget({
|
||||
super.key,
|
||||
@@ -8,36 +14,47 @@ class MedalWidget extends StatelessWidget {
|
||||
required this.level,
|
||||
required this.backgroundColor,
|
||||
required this.nameColor,
|
||||
required this.levelColor,
|
||||
this.fontSize = _kFontSize,
|
||||
this.strutStyle = _kStrutStyle,
|
||||
this.padding = _kPadding,
|
||||
});
|
||||
|
||||
MedalWidget.fromMedalInfo({
|
||||
super.key,
|
||||
required UinfoMedal medal,
|
||||
this.fontSize = _kFontSize,
|
||||
this.strutStyle = _kStrutStyle,
|
||||
this.padding = _kPadding,
|
||||
}) : medalName = medal.name!,
|
||||
level = medal.level!,
|
||||
backgroundColor = Utils.parseMedalColor(medal.v2MedalColorStart!),
|
||||
nameColor = Utils.parseColor(medal.v2MedalColorText!);
|
||||
|
||||
final String medalName;
|
||||
final int level;
|
||||
final Color backgroundColor;
|
||||
final Color nameColor;
|
||||
final Color levelColor;
|
||||
final double fontSize;
|
||||
final StrutStyle strutStyle;
|
||||
final EdgeInsets padding;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const .symmetric(horizontal: 8, vertical: 3),
|
||||
padding: padding,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: StyleString.mdRadius,
|
||||
borderRadius: Style.mdRadius,
|
||||
color: backgroundColor,
|
||||
),
|
||||
child: Text.rich(
|
||||
strutStyle: const StrutStyle(
|
||||
height: 1,
|
||||
leading: 0,
|
||||
fontSize: 10,
|
||||
),
|
||||
strutStyle: strutStyle,
|
||||
TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: medalName,
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
fontSize: 10,
|
||||
fontSize: fontSize,
|
||||
color: nameColor,
|
||||
),
|
||||
),
|
||||
@@ -45,9 +62,9 @@ class MedalWidget extends StatelessWidget {
|
||||
text: ' $level',
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
fontSize: 10,
|
||||
fontSize: fontSize,
|
||||
color: nameColor,
|
||||
fontWeight: .bold,
|
||||
color: levelColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:PiliPlus/common/constants.dart';
|
||||
import 'package:PiliPlus/common/assets.dart';
|
||||
import 'package:PiliPlus/common/style.dart';
|
||||
import 'package:PiliPlus/common/widgets/avatars.dart';
|
||||
import 'package:PiliPlus/common/widgets/image_viewer/hero.dart';
|
||||
import 'package:PiliPlus/common/widgets/pendant_avatar.dart';
|
||||
@@ -135,11 +136,9 @@ class UserInfoCard extends StatelessWidget {
|
||||
Widget? liveMedal;
|
||||
if (card.liveFansWearing?.detailV2 case final detailV2?) {
|
||||
Color? nameColor;
|
||||
Color? levelColor;
|
||||
Color? backgroundColor;
|
||||
try {
|
||||
nameColor = Utils.parseColor(detailV2.medalColorName!);
|
||||
levelColor = Utils.parseColor(detailV2.medalColorLevel!);
|
||||
backgroundColor = Utils.parseColor(detailV2.medalColor!);
|
||||
} catch (e, s) {
|
||||
if (kDebugMode) {
|
||||
@@ -154,7 +153,6 @@ class UserInfoCard extends StatelessWidget {
|
||||
level: detailV2.level!,
|
||||
backgroundColor: backgroundColor ?? colorScheme.secondaryContainer,
|
||||
nameColor: nameColor ?? colorScheme.onSecondaryContainer,
|
||||
levelColor: levelColor ?? colorScheme.onSecondaryContainer,
|
||||
),
|
||||
);
|
||||
} catch (e, s) {
|
||||
@@ -204,7 +202,7 @@ class UserInfoCard extends StatelessWidget {
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: StyleString.mdRadius,
|
||||
borderRadius: Style.mdRadius,
|
||||
color: colorScheme.vipColor,
|
||||
),
|
||||
child: Text(
|
||||
@@ -475,23 +473,36 @@ class UserInfoCard extends StatelessWidget {
|
||||
],
|
||||
);
|
||||
|
||||
Widget _buildAvatar(bool hasPendant) => fromHero(
|
||||
tag: '${card.face}$hashCode',
|
||||
child: PendantAvatar(
|
||||
avatar: card.face,
|
||||
size: hasPendant ? kPendantAvatarSize : kAvatarSize,
|
||||
isMemberAvatar: true,
|
||||
Widget _buildAvatar(ColorScheme scheme) {
|
||||
final pendant = card.pendant?.image;
|
||||
Widget child = PendantAvatar(
|
||||
card.face,
|
||||
size: kAvatarSize,
|
||||
pendentOffset: 12,
|
||||
badgeSize: 20,
|
||||
officialType: card.officialVerify?.type,
|
||||
isVip: (card.vip?.status ?? -1) > 0,
|
||||
garbPendantImage: card.pendant?.image,
|
||||
vipStatus: card.vip?.status,
|
||||
pendantImage: pendant,
|
||||
roomId: live?.liveStatus == 1 ? live!.roomid : null,
|
||||
onTap: () => PageUtils.imageView(
|
||||
tag: hashCode.toString(),
|
||||
imgList: [SourceModel(url: card.face.http2https)],
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
if (pendant == null || pendant.isEmpty) {
|
||||
child = DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
border: .all(width: 2, color: scheme.surface),
|
||||
shape: .circle,
|
||||
),
|
||||
child: Padding(padding: const .all(2), child: child),
|
||||
);
|
||||
}
|
||||
return fromHero(
|
||||
tag: '${card.face}$hashCode',
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
|
||||
Column _buildV(
|
||||
BuildContext context,
|
||||
@@ -499,7 +510,6 @@ class UserInfoCard extends StatelessWidget {
|
||||
bool isLight,
|
||||
double width,
|
||||
) {
|
||||
final hasPendant = card.pendant?.image?.isNotEmpty ?? false;
|
||||
final imgUrls = images.collectionTopSimple?.top?.imgUrls;
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -519,7 +529,7 @@ class UserInfoCard extends StatelessWidget {
|
||||
: images.nightImgurl)
|
||||
.http2https,
|
||||
),
|
||||
avatar: _buildAvatar(hasPendant),
|
||||
avatar: _buildAvatar(scheme),
|
||||
actions: _buildRight(scheme),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
@@ -591,26 +601,28 @@ class UserInfoCard extends StatelessWidget {
|
||||
Positioned(
|
||||
right: 0,
|
||||
bottom: 3.5,
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 125),
|
||||
child: DecoratedBox(
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: .centerLeft,
|
||||
end: .centerRight,
|
||||
colors: [
|
||||
Colors.transparent,
|
||||
Colors.black12,
|
||||
Colors.black38,
|
||||
Colors.black45,
|
||||
],
|
||||
child: IgnorePointer(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 125),
|
||||
child: DecoratedBox(
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: .centerLeft,
|
||||
end: .centerRight,
|
||||
colors: [
|
||||
Colors.transparent,
|
||||
Colors.black12,
|
||||
Colors.black38,
|
||||
Colors.black45,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const .only(left: 15, right: 5, bottom: 2),
|
||||
child: HeaderTitle(
|
||||
images: imgUrls,
|
||||
pageController: controller,
|
||||
child: Padding(
|
||||
padding: const .only(left: 15, right: 5, bottom: 2),
|
||||
child: HeaderTitle(
|
||||
images: imgUrls,
|
||||
pageController: controller,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -728,7 +740,7 @@ class UserInfoCard extends StatelessWidget {
|
||||
return child;
|
||||
}
|
||||
|
||||
Column _buildH(BuildContext context, ColorScheme colorScheme, bool isLight) =>
|
||||
Column _buildH(BuildContext context, ColorScheme scheme, bool isLight) =>
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -743,7 +755,7 @@ class UserInfoCard extends StatelessWidget {
|
||||
top: 10,
|
||||
bottom: card.prInfo?.content?.isNotEmpty == true ? 0 : 10,
|
||||
),
|
||||
child: _buildAvatar(card.pendant?.image?.isNotEmpty ?? false),
|
||||
child: _buildAvatar(scheme),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
@@ -753,20 +765,20 @@ class UserInfoCard extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
..._buildLeft(context, colorScheme, isLight),
|
||||
..._buildLeft(context, scheme, isLight),
|
||||
const SizedBox(height: 5),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: _buildRight(colorScheme),
|
||||
child: _buildRight(scheme),
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
],
|
||||
),
|
||||
if (card.prInfo?.content?.isNotEmpty == true)
|
||||
buildPrInfo(context, colorScheme, isLight, card.prInfo!),
|
||||
buildPrInfo(context, scheme, isLight, card.prInfo!),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -921,7 +933,7 @@ class _HeaderTitleState extends State<HeaderTitle> {
|
||||
title.subTitle!,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontFamily: 'digital_id_num',
|
||||
fontFamily: Assets.digitalNum,
|
||||
color: title.subTitleColorFormat?.colors?.isNotEmpty == true
|
||||
? Utils.parseMedalColor(
|
||||
title.subTitleColorFormat!.colors!.last,
|
||||
|
||||
Reference in New Issue
Block a user