mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-30 23:58:13 +08:00
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:
committed by
GitHub
parent
4c0443ec28
commit
3d4bcbc082
169
lib/common/widgets/avatar.dart
Normal file
169
lib/common/widgets/avatar.dart
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
import 'package:PiliPlus/utils/extension.dart';
|
||||||
|
import 'package:PiliPlus/utils/storage.dart';
|
||||||
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import 'network_img_layer.dart';
|
||||||
|
|
||||||
|
class Avatar extends StatelessWidget {
|
||||||
|
final _BadgeType _badgeType;
|
||||||
|
final String avatar;
|
||||||
|
final double size;
|
||||||
|
final double badgeSize;
|
||||||
|
final String? garbPendantImage;
|
||||||
|
final dynamic roomId;
|
||||||
|
final VoidCallback? onTap;
|
||||||
|
|
||||||
|
const Avatar({
|
||||||
|
super.key,
|
||||||
|
required this.avatar,
|
||||||
|
this.size = 80,
|
||||||
|
double? badgeSize,
|
||||||
|
bool? isVip,
|
||||||
|
int? officialType,
|
||||||
|
this.garbPendantImage,
|
||||||
|
this.roomId,
|
||||||
|
this.onTap,
|
||||||
|
}) : _badgeType = officialType == null || officialType < 0
|
||||||
|
? isVip == true
|
||||||
|
? _BadgeType.vip
|
||||||
|
: _BadgeType.none
|
||||||
|
: officialType == 0
|
||||||
|
? _BadgeType.person
|
||||||
|
: officialType == 1
|
||||||
|
? _BadgeType.institution
|
||||||
|
: _BadgeType.none,
|
||||||
|
badgeSize = badgeSize ?? size / 3;
|
||||||
|
|
||||||
|
static final showDynDecorate = GStorage.showDynDecorate;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final colorScheme = Theme.of(context).colorScheme;
|
||||||
|
return Stack(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
clipBehavior: Clip.none,
|
||||||
|
children: [
|
||||||
|
onTap == null
|
||||||
|
? _buildAvatar(colorScheme)
|
||||||
|
: GestureDetector(
|
||||||
|
behavior: HitTestBehavior.opaque,
|
||||||
|
onTap: onTap,
|
||||||
|
child: _buildAvatar(colorScheme),
|
||||||
|
),
|
||||||
|
if (showDynDecorate && !garbPendantImage.isNullOrEmpty)
|
||||||
|
Positioned(
|
||||||
|
top: -0.375 *
|
||||||
|
(size == 80 ? size - 4 : size), // -(size * 1.75 - size) / 2
|
||||||
|
child: IgnorePointer(
|
||||||
|
child: CachedNetworkImage(
|
||||||
|
width: size * 1.75,
|
||||||
|
height: size * 1.75,
|
||||||
|
imageUrl: Utils.thumbnailImgUrl(garbPendantImage),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (roomId != null)
|
||||||
|
Positioned(
|
||||||
|
bottom: 0,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Get.toNamed('/liveRoom?roomid=$roomId');
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 5, vertical: 1),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: colorScheme.secondaryContainer,
|
||||||
|
borderRadius: BorderRadius.circular(36),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.equalizer_rounded,
|
||||||
|
size: MediaQuery.textScalerOf(context).scale(16),
|
||||||
|
color: colorScheme.onSecondaryContainer,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'直播中',
|
||||||
|
style: TextStyle(
|
||||||
|
height: 1,
|
||||||
|
fontSize: 13,
|
||||||
|
color: colorScheme.onSecondaryContainer,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else if (_badgeType != _BadgeType.none)
|
||||||
|
_buildBadge(colorScheme),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildAvatar(ColorScheme colorScheme) => size == 80
|
||||||
|
? Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(
|
||||||
|
width: 2,
|
||||||
|
color: colorScheme.surface,
|
||||||
|
),
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
),
|
||||||
|
child: NetworkImgLayer(
|
||||||
|
src: avatar,
|
||||||
|
width: size,
|
||||||
|
height: size,
|
||||||
|
type: 'avatar',
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: NetworkImgLayer(
|
||||||
|
src: avatar,
|
||||||
|
width: size,
|
||||||
|
height: size,
|
||||||
|
type: 'avatar',
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget _buildBadge(ColorScheme colorScheme) {
|
||||||
|
final child = switch (_badgeType) {
|
||||||
|
_BadgeType.vip => Image.asset(
|
||||||
|
'assets/images/big-vip.png',
|
||||||
|
height: badgeSize,
|
||||||
|
semanticLabel: _badgeType.desc,
|
||||||
|
),
|
||||||
|
_ => Icon(
|
||||||
|
Icons.offline_bolt,
|
||||||
|
color: _badgeType.color,
|
||||||
|
size: badgeSize,
|
||||||
|
semanticLabel: _badgeType.desc,
|
||||||
|
),
|
||||||
|
};
|
||||||
|
return Positioned(
|
||||||
|
right: 0,
|
||||||
|
bottom: 0,
|
||||||
|
child: IgnorePointer(
|
||||||
|
child: DecoratedBox(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: colorScheme.surface,
|
||||||
|
),
|
||||||
|
child: child),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum _BadgeType { none, vip, person, institution }
|
||||||
|
|
||||||
|
extension _BadgeTypeExt on _BadgeType {
|
||||||
|
String get desc => const ['', '大会员', '认证个人', '认证机构'][index];
|
||||||
|
Color get color => const [
|
||||||
|
Colors.transparent,
|
||||||
|
Color(0xFFFF6699),
|
||||||
|
Color(0xFFFFCC00),
|
||||||
|
Colors.lightBlueAccent
|
||||||
|
][index];
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
|
import 'package:PiliPlus/common/widgets/avatar.dart';
|
||||||
import 'package:PiliPlus/common/widgets/report.dart';
|
import 'package:PiliPlus/common/widgets/report.dart';
|
||||||
import 'package:PiliPlus/common/widgets/save_panel.dart';
|
import 'package:PiliPlus/common/widgets/save_panel.dart';
|
||||||
import 'package:PiliPlus/http/index.dart';
|
import 'package:PiliPlus/http/index.dart';
|
||||||
@@ -12,7 +13,6 @@ import 'package:dio/dio.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
|
|
||||||
import 'package:PiliPlus/http/user.dart';
|
import 'package:PiliPlus/http/user.dart';
|
||||||
import 'package:PiliPlus/utils/feed_back.dart';
|
import 'package:PiliPlus/utils/feed_back.dart';
|
||||||
import 'package:PiliPlus/utils/utils.dart';
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
@@ -38,15 +38,24 @@ class AuthorPanel extends StatelessWidget {
|
|||||||
this.onSetTop,
|
this.onSetTop,
|
||||||
});
|
});
|
||||||
|
|
||||||
Widget _buildAvatar(double size) => NetworkImgLayer(
|
Widget _buildAvatar() {
|
||||||
width: size,
|
String? pendant = item.modules.moduleAuthor?.pendant?['image'];
|
||||||
height: size,
|
Widget avatar = Avatar(
|
||||||
type: 'avatar',
|
avatar: item.modules.moduleAuthor.face,
|
||||||
src: item.modules.moduleAuthor.face,
|
size: pendant.isNullOrEmpty ? 40 : 34,
|
||||||
);
|
isVip: null, // item.modules.moduleAuthor!.vip['status'] > 0
|
||||||
|
officialType: null, // 已被注释
|
||||||
|
garbPendantImage: pendant,
|
||||||
|
);
|
||||||
|
if (!pendant.isNullOrEmpty) {
|
||||||
|
avatar = Padding(padding: const EdgeInsets.all(3), child: avatar);
|
||||||
|
}
|
||||||
|
return avatar;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final theme = Theme.of(context);
|
||||||
String? pubTime = item.modules.moduleAuthor.pubTs != null
|
String? pubTime = item.modules.moduleAuthor.pubTs != null
|
||||||
? isSave
|
? isSave
|
||||||
? DateTime.fromMillisecondsSinceEpoch(
|
? DateTime.fromMillisecondsSinceEpoch(
|
||||||
@@ -63,31 +72,22 @@ class AuthorPanel extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
(item.modules.moduleAuthor.type == 'AUTHOR_TYPE_PGC' ||
|
||||||
onTap: () {
|
|
||||||
// 番剧
|
|
||||||
if (item.modules.moduleAuthor.type == 'AUTHOR_TYPE_PGC' ||
|
|
||||||
item.modules.moduleAuthor.type ==
|
item.modules.moduleAuthor.type ==
|
||||||
'AUTHOR_TYPE_UGC_SEASON') {
|
'AUTHOR_TYPE_UGC_SEASON')
|
||||||
return;
|
? _buildAvatar() // 番剧
|
||||||
}
|
: GestureDetector(
|
||||||
feedBack();
|
onTap: () {
|
||||||
Get.toNamed(
|
feedBack();
|
||||||
'/member?mid=${item.modules.moduleAuthor.mid}',
|
Get.toNamed(
|
||||||
arguments: {
|
'/member?mid=${item.modules.moduleAuthor.mid}',
|
||||||
'face': item.modules.moduleAuthor.face,
|
arguments: {
|
||||||
},
|
'face': item.modules.moduleAuthor.face,
|
||||||
);
|
},
|
||||||
},
|
);
|
||||||
child: (item.modules.moduleAuthor?.pendant?['image'] as String?)
|
},
|
||||||
?.isNotEmpty ==
|
child: _buildAvatar(),
|
||||||
true
|
),
|
||||||
? Padding(
|
|
||||||
padding: const EdgeInsets.all(3),
|
|
||||||
child: _buildAvatar(34),
|
|
||||||
)
|
|
||||||
: _buildAvatar(40),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@@ -99,18 +99,16 @@ class AuthorPanel extends StatelessWidget {
|
|||||||
item.modules.moduleAuthor!.vip['status'] > 0 &&
|
item.modules.moduleAuthor!.vip['status'] > 0 &&
|
||||||
item.modules.moduleAuthor!.vip['type'] == 2
|
item.modules.moduleAuthor!.vip['type'] == 2
|
||||||
? context.vipColor
|
? context.vipColor
|
||||||
: Theme.of(context).colorScheme.onSurface,
|
: theme.colorScheme.onSurface,
|
||||||
fontSize:
|
fontSize: theme.textTheme.titleSmall!.fontSize,
|
||||||
Theme.of(context).textTheme.titleSmall!.fontSize,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (pubTime != null)
|
if (pubTime != null)
|
||||||
Text(
|
Text(
|
||||||
'$pubTime${item.modules.moduleAuthor.pubAction != null ? ' ${item.modules.moduleAuthor.pubAction}' : ''}',
|
'$pubTime${item.modules.moduleAuthor.pubAction != null ? ' ${item.modules.moduleAuthor.pubAction}' : ''}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).colorScheme.outline,
|
color: theme.colorScheme.outline,
|
||||||
fontSize:
|
fontSize: theme.textTheme.labelSmall!.fontSize,
|
||||||
Theme.of(context).textTheme.labelSmall!.fontSize,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -132,7 +130,7 @@ class AuthorPanel extends StatelessWidget {
|
|||||||
const BorderRadius.all(Radius.circular(4)),
|
const BorderRadius.all(Radius.circular(4)),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
width: 1.25,
|
width: 1.25,
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: theme.colorScheme.primary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -140,7 +138,7 @@ class AuthorPanel extends StatelessWidget {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
height: 1,
|
height: 1,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: theme.colorScheme.primary,
|
||||||
),
|
),
|
||||||
strutStyle: const StrutStyle(
|
strutStyle: const StrutStyle(
|
||||||
leading: 0,
|
leading: 0,
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import 'package:PiliPlus/common/widgets/image_save.dart';
|
import 'package:PiliPlus/common/widgets/image_save.dart';
|
||||||
import 'package:PiliPlus/utils/extension.dart';
|
import 'package:PiliPlus/utils/extension.dart';
|
||||||
import 'package:PiliPlus/utils/page_utils.dart';
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
import 'package:PiliPlus/utils/utils.dart';
|
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'action_panel.dart';
|
import 'action_panel.dart';
|
||||||
@@ -93,54 +91,31 @@ class DynamicPanel extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: (item.modules.moduleAuthor?.pendant?['image'] as String?)
|
child: Column(
|
||||||
?.isNotEmpty ==
|
mainAxisSize: MainAxisSize.min,
|
||||||
true
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
? Stack(
|
children: [
|
||||||
clipBehavior: Clip.none,
|
Padding(
|
||||||
children: [
|
padding: const EdgeInsets.fromLTRB(12, 12, 12, 6),
|
||||||
_buildContent(context, item, source, callback),
|
child: AuthorPanel(
|
||||||
Positioned(
|
item: item,
|
||||||
left: 2,
|
source: source,
|
||||||
top: 2,
|
onRemove: onRemove,
|
||||||
child: IgnorePointer(
|
isSave: isSave,
|
||||||
child: CachedNetworkImage(
|
onSetTop: onSetTop,
|
||||||
width: 60,
|
),
|
||||||
height: 60,
|
),
|
||||||
imageUrl: Utils.thumbnailImgUrl(
|
if (item!.modules!.moduleDynamic!.desc != null ||
|
||||||
item.modules.moduleAuthor.pendant['image']),
|
item!.modules!.moduleDynamic!.major != null)
|
||||||
),
|
content(isSave, context, item, source, callback),
|
||||||
),
|
forWard(isSave, item, context, source, callback),
|
||||||
),
|
const SizedBox(height: 2),
|
||||||
],
|
if (source == null) ActionPanel(item: item),
|
||||||
)
|
if (source == 'detail' && !isSave) const SizedBox(height: 12),
|
||||||
: _buildContent(context, item, source, callback),
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildContent(context, item, source, callback) => Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(12, 12, 12, 6),
|
|
||||||
child: AuthorPanel(
|
|
||||||
item: item,
|
|
||||||
source: source,
|
|
||||||
onRemove: onRemove,
|
|
||||||
isSave: isSave,
|
|
||||||
onSetTop: onSetTop,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (item!.modules!.moduleDynamic!.desc != null ||
|
|
||||||
item!.modules!.moduleDynamic!.major != null)
|
|
||||||
content(isSave, context, item, source, callback),
|
|
||||||
forWard(isSave, item, context, source, callback),
|
|
||||||
const SizedBox(height: 2),
|
|
||||||
if (source == null) ActionPanel(item: item),
|
|
||||||
if (source == 'detail' && !isSave) const SizedBox(height: 12),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
|
import 'package:PiliPlus/common/widgets/avatar.dart';
|
||||||
import 'package:PiliPlus/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart'
|
import 'package:PiliPlus/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart'
|
||||||
show SourceModel;
|
show SourceModel;
|
||||||
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
|
|
||||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
|
||||||
import 'package:PiliPlus/models/space/card.dart' as space;
|
import 'package:PiliPlus/models/space/card.dart' as space;
|
||||||
import 'package:PiliPlus/models/space/images.dart' as space;
|
import 'package:PiliPlus/models/space/images.dart' as space;
|
||||||
import 'package:PiliPlus/utils/extension.dart';
|
import 'package:PiliPlus/utils/extension.dart';
|
||||||
@@ -72,24 +71,25 @@ class UserInfoCard extends StatelessWidget {
|
|||||||
|
|
||||||
_buildHeader(BuildContext context) {
|
_buildHeader(BuildContext context) {
|
||||||
bool darken = Theme.of(context).brightness == Brightness.dark;
|
bool darken = Theme.of(context).brightness == Brightness.dark;
|
||||||
String? imgUrl = darken
|
String imgUrl = (darken
|
||||||
? (images.nightImgurl?.isEmpty == true
|
? images.nightImgurl?.isEmpty == true
|
||||||
? images.imgUrl?.http2https
|
? images.imgUrl
|
||||||
: images.nightImgurl?.http2https)
|
: images.nightImgurl
|
||||||
: images.imgUrl?.http2https;
|
: images.imgUrl)
|
||||||
|
.http2https;
|
||||||
return Hero(
|
return Hero(
|
||||||
tag: imgUrl ?? '',
|
tag: imgUrl,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
context.imageView(
|
context.imageView(
|
||||||
imgList: [SourceModel(url: imgUrl ?? '')],
|
imgList: [SourceModel(url: imgUrl)],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: CachedNetworkImage(
|
child: CachedNetworkImage(
|
||||||
imageUrl: Utils.thumbnailImgUrl(imgUrl),
|
imageUrl: Utils.thumbnailImgUrl(imgUrl),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 135,
|
height: 135,
|
||||||
imageBuilder: (context, imageProvider) => Container(
|
imageBuilder: (context, imageProvider) => DecoratedBox(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
image: imageProvider,
|
image: imageProvider,
|
||||||
@@ -118,7 +118,7 @@ class UserInfoCard extends StatelessWidget {
|
|||||||
onTap: () => Utils.copyText(card.name!),
|
onTap: () => Utils.copyText(card.name!),
|
||||||
child: Text(
|
child: Text(
|
||||||
card.name!,
|
card.name!,
|
||||||
strutStyle: StrutStyle(
|
strutStyle: const StrutStyle(
|
||||||
height: 1,
|
height: 1,
|
||||||
leading: 0,
|
leading: 0,
|
||||||
fontSize: 17,
|
fontSize: 17,
|
||||||
@@ -141,16 +141,30 @@ class UserInfoCard extends StatelessWidget {
|
|||||||
semanticLabel: '等级${card.levelInfo?.currentLevel}',
|
semanticLabel: '等级${card.levelInfo?.currentLevel}',
|
||||||
),
|
),
|
||||||
if (card.vip?.vipStatus == 1)
|
if (card.vip?.vipStatus == 1)
|
||||||
CachedNetworkImage(
|
Container(
|
||||||
imageUrl: Utils.thumbnailImgUrl(card.vip!.label!.image!, 80),
|
padding:
|
||||||
height: 20,
|
const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
|
||||||
placeholder: (context, url) {
|
decoration: BoxDecoration(
|
||||||
return const SizedBox.shrink();
|
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
||||||
},
|
color: context.vipColor),
|
||||||
|
child: Text(
|
||||||
|
card.vip?.label?.text ?? '大会员',
|
||||||
|
strutStyle: const StrutStyle(
|
||||||
|
height: 1,
|
||||||
|
fontSize: 10,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
height: 1,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 10,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (card.nameplate?.image?.isNotEmpty == true)
|
if (card.nameplate?.imageSmall?.isNotEmpty == true)
|
||||||
CachedNetworkImage(
|
CachedNetworkImage(
|
||||||
imageUrl: Utils.thumbnailImgUrl(card.nameplate!.image!),
|
imageUrl: Utils.thumbnailImgUrl(card.nameplate!.imageSmall!),
|
||||||
height: 20,
|
height: 20,
|
||||||
placeholder: (context, url) {
|
placeholder: (context, url) {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
@@ -164,7 +178,7 @@ class UserInfoCard extends StatelessWidget {
|
|||||||
margin: const EdgeInsets.only(left: 20, top: 8, right: 20),
|
margin: const EdgeInsets.only(left: 20, top: 8, right: 20),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 2),
|
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 2),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||||
),
|
),
|
||||||
child: Text.rich(
|
child: Text.rich(
|
||||||
@@ -178,11 +192,12 @@ class UserInfoCard extends StatelessWidget {
|
|||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: Theme.of(context).colorScheme.surface,
|
color: Theme.of(context).colorScheme.surface,
|
||||||
),
|
),
|
||||||
child: CachedNetworkImage(
|
child: Icon(
|
||||||
width: 18,
|
Icons.offline_bolt,
|
||||||
height: 18,
|
color: card.officialVerify?.type == 0
|
||||||
imageUrl:
|
? const Color(0xFFFFCC00)
|
||||||
Utils.thumbnailImgUrl(card.officialVerify!.icon!),
|
: Colors.lightBlueAccent,
|
||||||
|
size: 18,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -210,9 +225,7 @@ class UserInfoCard extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.only(left: 20, top: 6, right: 20),
|
padding: const EdgeInsets.only(left: 20, top: 6, right: 20),
|
||||||
child: SelectableText(
|
child: SelectableText(
|
||||||
card.sign!.trim().replaceAll(RegExp(r'\n{2,}'), '\n'),
|
card.sign!.trim().replaceAll(RegExp(r'\n{2,}'), '\n'),
|
||||||
style: const TextStyle(
|
style: const TextStyle(fontSize: 14),
|
||||||
fontSize: 14,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
@@ -410,51 +423,19 @@ class UserInfoCard extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
_buildBadge(BuildContext context) => IgnorePointer(
|
|
||||||
child: DecoratedBox(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: Theme.of(context).colorScheme.surface,
|
|
||||||
),
|
|
||||||
child: card.officialVerify?.icon?.isNotEmpty == true
|
|
||||||
? CachedNetworkImage(
|
|
||||||
imageUrl: Utils.thumbnailImgUrl(card.officialVerify!.icon!),
|
|
||||||
width: 22,
|
|
||||||
height: 22,
|
|
||||||
)
|
|
||||||
: Image.asset(
|
|
||||||
'assets/images/big-vip.png',
|
|
||||||
width: 22,
|
|
||||||
height: 22,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
_buildAvatar(BuildContext context) => Hero(
|
_buildAvatar(BuildContext context) => Hero(
|
||||||
tag: card.face ?? '',
|
tag: card.face ?? '',
|
||||||
child: GestureDetector(
|
child: Avatar(
|
||||||
onTap: () {
|
avatar: card.face ?? '',
|
||||||
context.imageView(
|
size: 80,
|
||||||
imgList: [SourceModel(url: card.face ?? '')],
|
badgeSize: 22,
|
||||||
);
|
officialType: card.officialVerify?.type,
|
||||||
},
|
isVip: (card.vip?.vipStatus ?? -1) > 0,
|
||||||
child: Container(
|
garbPendantImage: card.pendant!.image!,
|
||||||
decoration: BoxDecoration(
|
roomId: live is Map && live['liveStatus'] == 1 ? live['roomid'] : null,
|
||||||
border: Border.all(
|
onTap: () => context
|
||||||
width: 2.5,
|
.imageView(imgList: [SourceModel(url: card.face.http2https)]),
|
||||||
color: Theme.of(context).colorScheme.surface,
|
));
|
||||||
),
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
),
|
|
||||||
child: NetworkImgLayer(
|
|
||||||
src: card.face,
|
|
||||||
type: 'avatar',
|
|
||||||
width: 80,
|
|
||||||
height: 80,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
_buildV(BuildContext context) => Column(
|
_buildV(BuildContext context) => Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
@@ -475,32 +456,6 @@ class UserInfoCard extends StatelessWidget {
|
|||||||
left: 20,
|
left: 20,
|
||||||
child: _buildAvatar(context),
|
child: _buildAvatar(context),
|
||||||
),
|
),
|
||||||
if (ModuleAuthorModel.showDynDecorate &&
|
|
||||||
card.pendant?.image?.isNotEmpty == true)
|
|
||||||
Positioned(
|
|
||||||
top: 82.5,
|
|
||||||
left: -7.5,
|
|
||||||
child: IgnorePointer(
|
|
||||||
child: CachedNetworkImage(
|
|
||||||
width: 140,
|
|
||||||
height: 140,
|
|
||||||
imageUrl: Utils.thumbnailImgUrl(card.pendant!.image!),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (card.officialVerify?.icon?.isNotEmpty == true ||
|
|
||||||
(card.vip?.vipStatus ?? -1) > 0)
|
|
||||||
Positioned(
|
|
||||||
top: 172,
|
|
||||||
left: 82,
|
|
||||||
child: _buildBadge(context),
|
|
||||||
),
|
|
||||||
if (live is Map && ((live['liveStatus'] as int?) ?? 0) == 1)
|
|
||||||
Positioned(
|
|
||||||
top: 180,
|
|
||||||
left: 20,
|
|
||||||
child: _buildLiveBadge(context),
|
|
||||||
),
|
|
||||||
Positioned(
|
Positioned(
|
||||||
left: 120,
|
left: 120,
|
||||||
top: 140,
|
top: 140,
|
||||||
@@ -579,39 +534,6 @@ class UserInfoCard extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
_buildLiveBadge(context) => GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
Get.toNamed('/liveRoom?roomid=${live['roomid']}');
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
width: 85,
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: Badge(
|
|
||||||
label: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
Icons.equalizer_rounded,
|
|
||||||
size: MediaQuery.textScalerOf(context).scale(16),
|
|
||||||
color: Theme.of(context).colorScheme.onSecondaryContainer,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'直播中',
|
|
||||||
style: TextStyle(height: 1),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 5,
|
|
||||||
vertical: 1,
|
|
||||||
),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
textColor: Theme.of(context).colorScheme.onSecondaryContainer,
|
|
||||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
_buildH(BuildContext context) => Column(
|
_buildH(BuildContext context) => Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
@@ -632,41 +554,7 @@ class UserInfoCard extends StatelessWidget {
|
|||||||
top: 10,
|
top: 10,
|
||||||
bottom: card.prInfo?.content?.isNotEmpty == true ? 0 : 10,
|
bottom: card.prInfo?.content?.isNotEmpty == true ? 0 : 10,
|
||||||
),
|
),
|
||||||
child: Stack(
|
child: _buildAvatar(context),
|
||||||
clipBehavior: Clip.none,
|
|
||||||
children: [
|
|
||||||
_buildAvatar(context),
|
|
||||||
if (ModuleAuthorModel.showDynDecorate &&
|
|
||||||
card.pendant?.image?.isNotEmpty == true)
|
|
||||||
Positioned(
|
|
||||||
top: -27.5,
|
|
||||||
left: -27.5,
|
|
||||||
child: IgnorePointer(
|
|
||||||
child: CachedNetworkImage(
|
|
||||||
width: 140,
|
|
||||||
height: 140,
|
|
||||||
imageUrl:
|
|
||||||
Utils.thumbnailImgUrl(card.pendant!.image!),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (card.officialVerify?.icon?.isNotEmpty == true ||
|
|
||||||
(card.vip?.vipStatus ?? -1) > 0)
|
|
||||||
Positioned(
|
|
||||||
right: 0,
|
|
||||||
bottom: 0,
|
|
||||||
child: _buildBadge(context),
|
|
||||||
),
|
|
||||||
if (live is Map &&
|
|
||||||
((live['liveStatus'] as int?) ?? 0) == 1)
|
|
||||||
Positioned(
|
|
||||||
left: 0,
|
|
||||||
bottom: -5,
|
|
||||||
right: 0,
|
|
||||||
child: _buildLiveBadge(context),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
|
import 'package:PiliPlus/common/widgets/avatar.dart';
|
||||||
import 'package:PiliPlus/models/search/result.dart';
|
import 'package:PiliPlus/models/search/result.dart';
|
||||||
import 'package:PiliPlus/utils/utils.dart';
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -25,35 +25,12 @@ class SearchUserItem extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(width: 15),
|
const SizedBox(width: 15),
|
||||||
Stack(
|
Avatar(
|
||||||
clipBehavior: Clip.none,
|
avatar: item.upic ?? '',
|
||||||
children: [
|
size: 42,
|
||||||
NetworkImgLayer(
|
isVip: false,
|
||||||
width: 42,
|
officialType: item.officialVerify?['type'],
|
||||||
height: 42,
|
roomId: item.isLive == 1 ? item.roomId : null,
|
||||||
src: item.upic,
|
|
||||||
type: 'avatar',
|
|
||||||
),
|
|
||||||
if (item.officialVerify?['type'] == 0 ||
|
|
||||||
item.officialVerify?['type'] == 1)
|
|
||||||
Positioned(
|
|
||||||
bottom: 0,
|
|
||||||
right: 0,
|
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: Theme.of(context).colorScheme.surface,
|
|
||||||
),
|
|
||||||
child: Icon(
|
|
||||||
Icons.offline_bolt,
|
|
||||||
color: item.officialVerify?['type'] == 0
|
|
||||||
? const Color(0xFFFFCC00)
|
|
||||||
: Colors.lightBlueAccent,
|
|
||||||
size: 14,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Column(
|
Column(
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:PiliPlus/common/widgets/avatar.dart';
|
||||||
import 'package:PiliPlus/common/widgets/self_sized_horizontal_list.dart';
|
import 'package:PiliPlus/common/widgets/self_sized_horizontal_list.dart';
|
||||||
import 'package:PiliPlus/pages/search/widgets/search_text.dart';
|
import 'package:PiliPlus/pages/search/widgets/search_text.dart';
|
||||||
import 'package:PiliPlus/utils/app_scheme.dart';
|
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||||
@@ -296,54 +297,22 @@ class _VideoInfoState extends State<VideoInfo> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Obx(
|
Obx(() => Avatar(
|
||||||
() => Stack(
|
avatar: videoIntroController.userStat
|
||||||
clipBehavior: Clip.none,
|
.value['card']?['face'] ??
|
||||||
children: [
|
'',
|
||||||
NetworkImgLayer(
|
size: 35,
|
||||||
type: 'avatar',
|
badgeSize: 14,
|
||||||
src: videoIntroController.userStat
|
isVip: (videoIntroController.userStat
|
||||||
.value['card']?['face'] ??
|
.value['card']?['vip']
|
||||||
'',
|
?['status'] ??
|
||||||
width: 35,
|
-1) >
|
||||||
height: 35,
|
0,
|
||||||
fadeInDuration: Duration.zero,
|
officialType: videoIntroController
|
||||||
fadeOutDuration: Duration.zero,
|
.userStat.value['card']
|
||||||
),
|
?['official_verify']?['type'],
|
||||||
if ((videoIntroController.userStat
|
// garbPendantImage: videoIntroController.userStat.value['card']?['pendant']?['image'],
|
||||||
.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,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:PiliPlus/common/constants.dart';
|
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/badge.dart';
|
||||||
import 'package:PiliPlus/common/widgets/image_view.dart';
|
import 'package:PiliPlus/common/widgets/image_view.dart';
|
||||||
import 'package:PiliPlus/common/widgets/report.dart';
|
import 'package:PiliPlus/common/widgets/report.dart';
|
||||||
@@ -156,93 +157,16 @@ class ReplyItemGrpc extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget lfAvtar(BuildContext context) {
|
Widget lfAvtar() => Avatar(
|
||||||
return Stack(
|
avatar: replyItem.member.face,
|
||||||
clipBehavior: Clip.none,
|
size: 34,
|
||||||
children: [
|
badgeSize: 14,
|
||||||
if (ModuleAuthorModel.showDynDecorate &&
|
isVip: replyItem.member.vipStatus > 0,
|
||||||
replyItem.member.hasGarbPendantImage()) ...[
|
officialType: replyItem.member.officialVerifyType.toInt(),
|
||||||
Padding(
|
garbPendantImage: replyItem.member.hasGarbPendantImage()
|
||||||
padding: const EdgeInsets.all(2),
|
? replyItem.member.garbPendantImage
|
||||||
child: NetworkImgLayer(
|
: null,
|
||||||
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 content(BuildContext context) {
|
Widget content(BuildContext context) {
|
||||||
return Column(
|
return Column(
|
||||||
@@ -259,7 +183,7 @@ class ReplyItemGrpc extends StatelessWidget {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
lfAvtar(context),
|
lfAvtar(),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|||||||
Reference in New Issue
Block a user