💄 Optimize the account page

This commit is contained in:
2025-11-02 00:51:16 +08:00
parent bc60ce5d42
commit 8d1d836b52
2 changed files with 111 additions and 64 deletions

View File

@@ -74,72 +74,111 @@ class AccountScreen extends HookConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (user.value?.profile.background?.id != null)
ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
),
child: AspectRatio(
aspectRatio: 16 / 7,
child: CloudImageWidget(
file: user.value?.profile.background,
fit: BoxFit.cover,
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: user.value?.profile.background,
fit: BoxFit.cover,
),
),
),
),
Positioned(
bottom: -24,
left: 16,
child: GestureDetector(
child: ProfilePictureWidget(
file: user.value?.profile.picture,
radius: 32,
),
onTap: () {
context.pushNamed(
'accountProfile',
pathParameters: {'name': user.value!.name},
);
},
),
),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
spacing: 16,
children: [
GestureDetector(
child: ProfilePictureWidget(
file: user.value?.profile.picture,
radius: 24,
),
onTap: () {
context.pushNamed(
'accountProfile',
pathParameters: {'name': user.value!.name},
);
},
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
spacing: 4,
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: TextBaseline.alphabetic,
Builder(
builder: (context) {
final hasBackground =
user.value?.profile.background?.id != null;
return Row(
crossAxisAlignment: CrossAxisAlignment.center,
spacing: hasBackground ? 0 : 16,
children: [
if (!hasBackground)
GestureDetector(
child: ProfilePictureWidget(
file: user.value?.profile.picture,
radius: 24,
),
onTap: () {
context.pushNamed(
'accountProfile',
pathParameters: {'name': user.value!.name},
);
},
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Flexible(
child: AccountName(
account: user.value!,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
Row(
spacing: 4,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Flexible(
child: AccountName(
account: user.value!,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
),
),
Flexible(
child: Text(
'@${user.value!.name}',
).fontSize(11).padding(bottom: 2.5),
),
],
),
Flexible(child: Text('@${user.value!.name}')),
Text(
(user.value!.profile.bio.isNotEmpty)
? user.value!.profile.bio
: 'descriptionNone'.tr(),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
const Gap(12),
],
),
Text(
(user.value!.profile.bio.isNotEmpty)
? user.value!.profile.bio
: 'descriptionNone'.tr(),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
),
],
).padding(horizontal: 16, top: 16),
AccountStatusCreationWidget(uname: user.value!.name),
),
],
).padding(
left: 16,
right: 16,
top: 16 + (hasBackground ? 16 : 0),
);
},
),
],
),
).padding(horizontal: 8),
Card(
margin: EdgeInsets.zero,
child: AccountStatusCreationWidget(uname: user.value!.name),
).padding(horizontal: 12, bottom: 4),
LevelingProgressCard(
isCompact: true,
level: user.value!.profile.level,

View File

@@ -84,21 +84,29 @@ class AccountStatusCreationWidget extends HookConsumerWidget {
: Padding(
padding:
padding ??
EdgeInsets.symmetric(horizontal: 27, vertical: 4),
child: Row(
spacing: 4,
EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(Symbols.keyboard_arrow_up),
Expanded(
child: Text('statusCreateHint', maxLines: 1).tr(),
Row(
children: [
Icon(Symbols.keyboard_arrow_up),
SizedBox(width: 4),
Text('Create Status').tr(),
],
),
SizedBox(height: 4),
Text(
'Tap to set your current activity and let others know what you\'re up to',
style: TextStyle(fontSize: 12),
).tr().opacity(0.75),
],
),
).opacity(0.85),
error:
(error, _) => Padding(
padding:
padding ?? EdgeInsets.symmetric(horizontal: 26, vertical: 4),
padding ?? EdgeInsets.symmetric(horizontal: 26, vertical: 12),
child: Row(
spacing: 4,
children: [Icon(Symbols.close), Text('Error: $error')],
@@ -107,7 +115,7 @@ class AccountStatusCreationWidget extends HookConsumerWidget {
loading:
() => Padding(
padding:
padding ?? EdgeInsets.symmetric(horizontal: 26, vertical: 4),
padding ?? EdgeInsets.symmetric(horizontal: 26, vertical: 12),
child: Row(
spacing: 4,
children: [Icon(Symbols.more_vert), Text('loading').tr()],