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

View File

@@ -84,21 +84,29 @@ class AccountStatusCreationWidget extends HookConsumerWidget {
: Padding( : Padding(
padding: padding:
padding ?? padding ??
EdgeInsets.symmetric(horizontal: 27, vertical: 4), EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row( child: Column(
spacing: 4, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Icon(Symbols.keyboard_arrow_up), Row(
Expanded( children: [
child: Text('statusCreateHint', maxLines: 1).tr(), 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), ).opacity(0.85),
error: error:
(error, _) => Padding( (error, _) => Padding(
padding: padding:
padding ?? EdgeInsets.symmetric(horizontal: 26, vertical: 4), padding ?? EdgeInsets.symmetric(horizontal: 26, vertical: 12),
child: Row( child: Row(
spacing: 4, spacing: 4,
children: [Icon(Symbols.close), Text('Error: $error')], children: [Icon(Symbols.close), Text('Error: $error')],
@@ -107,7 +115,7 @@ class AccountStatusCreationWidget extends HookConsumerWidget {
loading: loading:
() => Padding( () => Padding(
padding: padding:
padding ?? EdgeInsets.symmetric(horizontal: 26, vertical: 4), padding ?? EdgeInsets.symmetric(horizontal: 26, vertical: 12),
child: Row( child: Row(
spacing: 4, spacing: 4,
children: [Icon(Symbols.more_vert), Text('loading').tr()], children: [Icon(Symbols.more_vert), Text('loading').tr()],