mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 11:08:03 +08:00
@@ -1,6 +1,7 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:PiliPlus/common/constants.dart';
|
||||
import 'package:PiliPlus/common/assets.dart';
|
||||
import 'package:PiliPlus/common/style.dart';
|
||||
import 'package:PiliPlus/common/widgets/dialog/report.dart';
|
||||
import 'package:PiliPlus/common/widgets/pendant_avatar.dart';
|
||||
import 'package:PiliPlus/http/constants.dart';
|
||||
@@ -52,21 +53,6 @@ class AuthorPanel extends StatelessWidget {
|
||||
this.onSetReplySubject,
|
||||
});
|
||||
|
||||
Widget _buildAvatar(ModuleAuthorModel moduleAuthor) {
|
||||
final pendant = moduleAuthor.pendant?.image;
|
||||
final hasPendant = pendant != null && pendant.isNotEmpty;
|
||||
Widget avatar = PendantAvatar(
|
||||
avatar: moduleAuthor.face,
|
||||
size: hasPendant ? 34 : 40,
|
||||
officialType: null, // 已被注释
|
||||
garbPendantImage: pendant,
|
||||
);
|
||||
if (hasPendant) {
|
||||
avatar = Padding(padding: const EdgeInsets.all(3), child: avatar);
|
||||
}
|
||||
return avatar;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
@@ -105,147 +91,145 @@ class AuthorPanel extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
final moduleTagText = !isDetail ? item.modules.moduleTag?.text : null;
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: moduleAuthor.type == 'AUTHOR_TYPE_NORMAL'
|
||||
? () {
|
||||
feedBack();
|
||||
Get.toNamed('/member?mid=${moduleAuthor.mid}');
|
||||
}
|
||||
: null,
|
||||
child: Row(
|
||||
spacing: 10,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
Widget header = GestureDetector(
|
||||
onTap: moduleAuthor.type == 'AUTHOR_TYPE_NORMAL'
|
||||
? () {
|
||||
feedBack();
|
||||
Get.toNamed('/member?mid=${moduleAuthor.mid}');
|
||||
}
|
||||
: null,
|
||||
child: Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
PendantAvatar(
|
||||
size: 40,
|
||||
moduleAuthor.face,
|
||||
pendantImage: moduleAuthor.pendant?.image,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildAvatar(moduleAuthor),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
moduleAuthor.name ?? '',
|
||||
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,
|
||||
],
|
||||
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,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: moduleTagText != null
|
||||
? Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 4,
|
||||
vertical: 2,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(4),
|
||||
),
|
||||
border: Border.all(
|
||||
width: 1.25,
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
moduleTagText,
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
fontSize: 12,
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
strutStyle: const StrutStyle(
|
||||
height: 1,
|
||||
leading: 0,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
_moreWidget(context),
|
||||
],
|
||||
)
|
||||
: moduleAuthor.decorate != null
|
||||
? Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Stack(
|
||||
clipBehavior: Clip.none,
|
||||
alignment: Alignment.centerRight,
|
||||
children: [
|
||||
CachedNetworkImage(
|
||||
height: 32,
|
||||
memCacheHeight: 32.cacheSize(context),
|
||||
imageUrl: ImageUtils.safeThumbnailUrl(
|
||||
moduleAuthor.decorate!.cardUrl,
|
||||
),
|
||||
placeholder: (_, _) => const SizedBox.shrink(),
|
||||
),
|
||||
if (moduleAuthor.decorate!.fan?.numStr?.isNotEmpty ==
|
||||
true)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 32),
|
||||
child: Text(
|
||||
'${moduleAuthor.decorate!.fan!.numStr}',
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
fontSize: 11,
|
||||
fontFamily: 'digital_id_num',
|
||||
color:
|
||||
moduleAuthor.decorate!.fan?.color
|
||||
?.startsWith('#') ==
|
||||
true
|
||||
? Utils.parseColor(
|
||||
moduleAuthor.decorate!.fan!.color!,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
_moreWidget(context),
|
||||
],
|
||||
)
|
||||
: _moreWidget(context),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _moreWidget(BuildContext context) => isSave
|
||||
? const SizedBox.shrink()
|
||||
: SizedBox(
|
||||
width: 32,
|
||||
height: 32,
|
||||
child: IconButton(
|
||||
tooltip: '更多',
|
||||
style: const ButtonStyle(
|
||||
padding: WidgetStatePropertyAll(EdgeInsets.zero),
|
||||
Widget? moreBtn = isSave
|
||||
? null
|
||||
: SizedBox(
|
||||
width: 32,
|
||||
height: 32,
|
||||
child: IconButton(
|
||||
tooltip: '更多',
|
||||
style: const ButtonStyle(
|
||||
padding: WidgetStatePropertyAll(EdgeInsets.zero),
|
||||
),
|
||||
onPressed: () => morePanel(context),
|
||||
icon: const Icon(Icons.more_vert_outlined, size: 18),
|
||||
),
|
||||
);
|
||||
final moduleTagText = !isDetail ? item.modules.moduleTag?.text : null;
|
||||
if (moduleTagText != null) {
|
||||
header = Row(
|
||||
children: [
|
||||
Expanded(child: header),
|
||||
Container(
|
||||
padding: const .symmetric(horizontal: 4, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const .all(.circular(4)),
|
||||
border: .all(width: 1.25, color: theme.colorScheme.primary),
|
||||
),
|
||||
child: Text(
|
||||
moduleTagText,
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
fontSize: 12,
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
strutStyle: const StrutStyle(height: 1, leading: 0, fontSize: 12),
|
||||
),
|
||||
onPressed: () => morePanel(context),
|
||||
icon: const Icon(Icons.more_vert_outlined, size: 18),
|
||||
),
|
||||
?moreBtn,
|
||||
],
|
||||
);
|
||||
} else if (moduleAuthor.decorate != null) {
|
||||
const height = 32.0;
|
||||
header = Stack(
|
||||
clipBehavior: .none,
|
||||
children: [
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: 0,
|
||||
height: height,
|
||||
child: CachedNetworkImage(
|
||||
height: height,
|
||||
memCacheHeight: height.cacheSize(context),
|
||||
imageUrl: ImageUtils.safeThumbnailUrl(
|
||||
moduleAuthor.decorate!.cardUrl,
|
||||
),
|
||||
placeholder: (_, _) => const SizedBox.shrink(),
|
||||
),
|
||||
),
|
||||
if (moduleAuthor.decorate!.fan?.numStr?.isNotEmpty == true)
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: height,
|
||||
height: height,
|
||||
child: Center(
|
||||
child: Text(
|
||||
moduleAuthor.decorate!.fan!.numStr!.toString(),
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
fontSize: 11,
|
||||
fontFamily: Assets.digitalNum,
|
||||
color: Utils.parseColor(
|
||||
moduleAuthor.decorate!.fan!.color!,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const .only(right: 80),
|
||||
child: header,
|
||||
),
|
||||
],
|
||||
);
|
||||
if (moreBtn != null) {
|
||||
header = Row(
|
||||
children: [
|
||||
Expanded(child: header),
|
||||
moreBtn,
|
||||
],
|
||||
);
|
||||
}
|
||||
} else if (moreBtn != null) {
|
||||
header = Row(
|
||||
children: [
|
||||
Expanded(child: header),
|
||||
moreBtn,
|
||||
],
|
||||
);
|
||||
}
|
||||
return header;
|
||||
}
|
||||
|
||||
void morePanel(BuildContext context) {
|
||||
String? bvid;
|
||||
@@ -283,7 +267,7 @@ class AuthorPanel extends StatelessWidget {
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: Get.back,
|
||||
borderRadius: StyleString.bottomSheetRadius,
|
||||
borderRadius: Style.bottomSheetRadius,
|
||||
child: SizedBox(
|
||||
height: 35,
|
||||
child: Center(
|
||||
|
||||
Reference in New Issue
Block a user