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

View File

@@ -1042,6 +1042,11 @@ class AccountProfileScreen extends HookConsumerWidget {
data: data,
).padding(horizontal: 4),
),
SliverToBoxAdapter(
child: ActivityPresenceWidget(
uname: name,
).padding(horizontal: 8, top: 4, bottom: 4),
),
SliverToBoxAdapter(
child: _AccountPublisherList(
publishers: accountPublishers.value ?? [],
@@ -1071,11 +1076,6 @@ class AccountProfileScreen extends HookConsumerWidget {
),
).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
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(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 20,
spacing: showBackground ? 0 : 20,
children: [
if (!showBackground)
GestureDetector(
child: Badge(
isLabelVisible: data.type == 0,
@@ -87,6 +126,7 @@ class _PublisherBasisWidget extends StatelessWidget {
Text(data.nick).fontSize(20),
if (data.verification != null)
VerificationMark(mark: data.verification!),
if (isWideScreen(context))
Expanded(
child: Text(
'@${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)
Row(
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,
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(
data.nick,
style: TextStyle(
color:
appbarColor.value ??
Theme.of(
context,
).appBarTheme.foregroundColor,
Theme.of(context).appBarTheme.foregroundColor,
shadows: [appbarShadow],
),
),
background:
Container(), // Empty container since background is handled by Stack
),
],
),
)
: null,
body:
@@ -477,7 +513,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
subscribing: subscribing,
subscribe: subscribe,
unsubscribe: unsubscribe,
).padding(bottom: 8),
).padding(horizontal: 4, top: 20),
_PublisherBadgesWidget(
data: data,
badges: badges,
@@ -487,7 +523,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
_PublisherHeatmapWidget(
heatmap: heatmap,
forceDense: true,
),
).padding(vertical: 4),
],
),
),
@@ -545,7 +581,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
subscribing: subscribing,
subscribe: subscribe,
unsubscribe: unsubscribe,
).padding(bottom: 8),
).padding(horizontal: 4, top: 8),
),
SliverToBoxAdapter(
child: _PublisherBadgesWidget(
@@ -560,7 +596,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
child: _PublisherBioWidget(data: data),
),
SliverToBoxAdapter(
child: _PublisherHeatmapWidget(heatmap: heatmap),
child: _PublisherHeatmapWidget(heatmap: heatmap).padding(vertical: 4),
),
SliverPostList(pubName: name, pinned: true),
SliverToBoxAdapter(