💄 Optimize publisher page

This commit is contained in:
2025-11-02 01:30:47 +08:00
parent 85005ff9c3
commit fec28f6223
3 changed files with 183 additions and 147 deletions

View File

@@ -344,7 +344,7 @@
"accountSettingsHelpContent": "此页面允许您管理您的帐户安全性、隐私和其他设置。如果您需要帮助,请联系管理员。", "accountSettingsHelpContent": "此页面允许您管理您的帐户安全性、隐私和其他设置。如果您需要帮助,请联系管理员。",
"unauthorized": "未授权", "unauthorized": "未授权",
"unauthorizedHint": "您未登录或会话已过期,请重新登录。", "unauthorizedHint": "您未登录或会话已过期,请重新登录。",
"publisherBelongsTo": "属于", "publisherBelongsTo": "属于 {}",
"postContent": "内容", "postContent": "内容",
"postSettings": "设置", "postSettings": "设置",
"postPublisherUnselected": "未指定发布者", "postPublisherUnselected": "未指定发布者",

View File

@@ -1042,6 +1042,11 @@ class AccountProfileScreen extends HookConsumerWidget {
data: data, data: data,
).padding(horizontal: 4), ).padding(horizontal: 4),
), ),
SliverToBoxAdapter(
child: ActivityPresenceWidget(
uname: name,
).padding(horizontal: 8, top: 4, bottom: 4),
),
SliverToBoxAdapter( SliverToBoxAdapter(
child: _AccountPublisherList( child: _AccountPublisherList(
publishers: accountPublishers.value ?? [], publishers: accountPublishers.value ?? [],
@@ -1071,11 +1076,6 @@ class AccountProfileScreen extends HookConsumerWidget {
), ),
).padding(horizontal: 4), ).padding(horizontal: 4),
), ),
SliverToBoxAdapter(
child: ActivityPresenceWidget(
uname: name,
).padding(horizontal: 8, top: 4, bottom: 8),
),
], ],
), ),
); );

View File

@@ -46,10 +46,49 @@ class _PublisherBasisWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Card(
child: Builder(
builder: (context) {
final hasBackground = data.background?.id != null;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (isWideScreen(context) && hasBackground)
Stack(
clipBehavior: Clip.none,
children: [
ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
),
child: AspectRatio(
aspectRatio: 16 / 7,
child: CloudImageWidget(
file: data.background,
fit: BoxFit.cover,
),
),
),
Positioned(
bottom: -24,
left: 16,
child: ProfilePictureWidget(
file: data.picture,
radius: 32,
borderRadius: data.type == 0 ? null : 12,
),
),
],
),
Builder(
builder: (context) {
final showBackground = isWideScreen(context) && hasBackground;
return Row( return Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
spacing: 20, spacing: showBackground ? 0 : 20,
children: [ children: [
if (!showBackground)
GestureDetector( GestureDetector(
child: Badge( child: Badge(
isLabelVisible: data.type == 0, isLabelVisible: data.type == 0,
@@ -87,6 +126,7 @@ class _PublisherBasisWidget extends StatelessWidget {
Text(data.nick).fontSize(20), Text(data.nick).fontSize(20),
if (data.verification != null) if (data.verification != null)
VerificationMark(mark: data.verification!), VerificationMark(mark: data.verification!),
if (isWideScreen(context))
Expanded( Expanded(
child: Text( child: Text(
'@${data.name}', '@${data.name}',
@@ -96,6 +136,12 @@ class _PublisherBasisWidget extends StatelessWidget {
), ),
], ],
), ),
if (!isWideScreen(context))
Text(
'@${data.name}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
).fontSize(14).opacity(0.85).padding(top: 4),
if (data.type == 0 && data.account != null) if (data.type == 0 && data.account != null)
Row( Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
@@ -155,12 +201,23 @@ class _PublisherBasisWidget extends StatelessWidget {
), ),
), ),
) )
.padding(top: 8), .padding(vertical: 8),
], ],
), ),
), ),
], ],
).padding(horizontal: 24, top: 24); ).padding(
left: 16,
right: 16,
top: 16 + (showBackground ? 16 : 0),
);
},
),
],
);
},
),
);
} }
} }
@@ -400,36 +457,15 @@ class PublisherProfileScreen extends HookConsumerWidget {
color: appbarColor.value, color: appbarColor.value,
shadows: [appbarShadow], shadows: [appbarShadow],
), ),
flexibleSpace: Stack(
children: [
Positioned.fill(
child:
data.background?.id != null
? CloudImageWidget(file: data.background)
: Container(
color:
Theme.of(
context,
).appBarTheme.backgroundColor,
),
),
FlexibleSpaceBar(
title: Text( title: Text(
data.nick, data.nick,
style: TextStyle( style: TextStyle(
color: color:
appbarColor.value ?? appbarColor.value ??
Theme.of( Theme.of(context).appBarTheme.foregroundColor,
context,
).appBarTheme.foregroundColor,
shadows: [appbarShadow], shadows: [appbarShadow],
), ),
), ),
background:
Container(), // Empty container since background is handled by Stack
),
],
),
) )
: null, : null,
body: body:
@@ -477,7 +513,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
subscribing: subscribing, subscribing: subscribing,
subscribe: subscribe, subscribe: subscribe,
unsubscribe: unsubscribe, unsubscribe: unsubscribe,
).padding(bottom: 8), ).padding(horizontal: 4, top: 20),
_PublisherBadgesWidget( _PublisherBadgesWidget(
data: data, data: data,
badges: badges, badges: badges,
@@ -487,7 +523,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
_PublisherHeatmapWidget( _PublisherHeatmapWidget(
heatmap: heatmap, heatmap: heatmap,
forceDense: true, forceDense: true,
), ).padding(vertical: 4),
], ],
), ),
), ),
@@ -545,7 +581,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
subscribing: subscribing, subscribing: subscribing,
subscribe: subscribe, subscribe: subscribe,
unsubscribe: unsubscribe, unsubscribe: unsubscribe,
).padding(bottom: 8), ).padding(horizontal: 4, top: 8),
), ),
SliverToBoxAdapter( SliverToBoxAdapter(
child: _PublisherBadgesWidget( child: _PublisherBadgesWidget(
@@ -560,7 +596,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
child: _PublisherBioWidget(data: data), child: _PublisherBioWidget(data: data),
), ),
SliverToBoxAdapter( SliverToBoxAdapter(
child: _PublisherHeatmapWidget(heatmap: heatmap), child: _PublisherHeatmapWidget(heatmap: heatmap).padding(vertical: 4),
), ),
SliverPostList(pubName: name, pinned: true), SliverPostList(pubName: name, pinned: true),
SliverToBoxAdapter( SliverToBoxAdapter(