mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
committed by
GitHub
parent
bbc498f882
commit
ed60c274fc
@@ -1,5 +1,6 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:PiliPlus/common/widgets/avatar.dart';
|
||||
import 'package:PiliPlus/common/widgets/report.dart';
|
||||
import 'package:PiliPlus/common/widgets/save_panel.dart';
|
||||
import 'package:PiliPlus/http/index.dart';
|
||||
@@ -12,7 +13,6 @@ import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
|
||||
import 'package:PiliPlus/http/user.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
@@ -38,15 +38,29 @@ class AuthorPanel extends StatelessWidget {
|
||||
this.onSetTop,
|
||||
});
|
||||
|
||||
Widget _buildAvatar(double size) => NetworkImgLayer(
|
||||
width: size,
|
||||
height: size,
|
||||
type: 'avatar',
|
||||
src: item.modules.moduleAuthor.face,
|
||||
Widget _buildAvatar() => Avatar(
|
||||
avatar: item.modules.moduleAuthor.face,
|
||||
size: 34,
|
||||
isVip: (item.modules.moduleAuthor?.vip?['status'] ?? 0) > 0,
|
||||
officialType: null, // 已被注释
|
||||
garbPendantImage: item.modules.moduleAuthor?.pendant?['image'],
|
||||
onTap: (item.modules.moduleAuthor.type == 'AUTHOR_TYPE_PGC' ||
|
||||
item.modules.moduleAuthor.type == 'AUTHOR_TYPE_UGC_SEASON')
|
||||
? null // 番剧
|
||||
: () {
|
||||
feedBack();
|
||||
Get.toNamed(
|
||||
'/member?mid=${item.modules.moduleAuthor.mid}',
|
||||
arguments: {
|
||||
'face': item.modules.moduleAuthor.face,
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
String? pubTime = item.modules.moduleAuthor.pubTs != null
|
||||
? isSave
|
||||
? DateTime.fromMillisecondsSinceEpoch(
|
||||
@@ -63,31 +77,7 @@ class AuthorPanel extends StatelessWidget {
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
// 番剧
|
||||
if (item.modules.moduleAuthor.type == 'AUTHOR_TYPE_PGC' ||
|
||||
item.modules.moduleAuthor.type ==
|
||||
'AUTHOR_TYPE_UGC_SEASON') {
|
||||
return;
|
||||
}
|
||||
feedBack();
|
||||
Get.toNamed(
|
||||
'/member?mid=${item.modules.moduleAuthor.mid}',
|
||||
arguments: {
|
||||
'face': item.modules.moduleAuthor.face,
|
||||
},
|
||||
);
|
||||
},
|
||||
child: (item.modules.moduleAuthor?.pendant?['image'] as String?)
|
||||
?.isNotEmpty ==
|
||||
true
|
||||
? Padding(
|
||||
padding: const EdgeInsets.all(3),
|
||||
child: _buildAvatar(34),
|
||||
)
|
||||
: _buildAvatar(40),
|
||||
),
|
||||
_buildAvatar(),
|
||||
const SizedBox(width: 10),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -100,18 +90,16 @@ class AuthorPanel extends StatelessWidget {
|
||||
item.modules.moduleAuthor!.vip['status'] > 0 &&
|
||||
item.modules.moduleAuthor!.vip['type'] == 2
|
||||
? context.vipColor
|
||||
: Theme.of(context).colorScheme.onSurface,
|
||||
fontSize:
|
||||
Theme.of(context).textTheme.titleSmall!.fontSize,
|
||||
: theme.colorScheme.onSurface,
|
||||
fontSize: theme.textTheme.titleSmall!.fontSize,
|
||||
),
|
||||
),
|
||||
if (pubTime != null)
|
||||
Text(
|
||||
'$pubTime${item.modules.moduleAuthor.pubAction != null ? ' ${item.modules.moduleAuthor.pubAction}' : ''}',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
fontSize:
|
||||
Theme.of(context).textTheme.labelSmall!.fontSize,
|
||||
color: theme.colorScheme.outline,
|
||||
fontSize: theme.textTheme.labelSmall!.fontSize,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -133,7 +121,7 @@ class AuthorPanel extends StatelessWidget {
|
||||
const BorderRadius.all(Radius.circular(4)),
|
||||
border: Border.all(
|
||||
width: 1.25,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
@@ -141,7 +129,7 @@ class AuthorPanel extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
fontSize: 12,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
strutStyle: const StrutStyle(
|
||||
leading: 0,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'package:PiliPlus/common/widgets/image_save.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'action_panel.dart';
|
||||
@@ -99,53 +98,31 @@ class DynamicPanel extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
},
|
||||
child: (item.modules.moduleAuthor?.pendant?['image'] as String?)
|
||||
?.isNotEmpty ==
|
||||
true
|
||||
? Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
_buildContent(context, item, source, callback),
|
||||
Positioned(
|
||||
left: 2,
|
||||
top: 2,
|
||||
child: IgnorePointer(
|
||||
child: CachedNetworkImage(
|
||||
width: 60,
|
||||
height: 60,
|
||||
imageUrl: item.modules.moduleAuthor.pendant['image'],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: _buildContent(context, item, source, callback),
|
||||
child: 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),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
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),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user