💄 Optimized profile page background image

This commit is contained in:
LittleSheep 2025-06-11 00:20:21 +08:00
parent 36b9026e9e
commit 461f32545a
2 changed files with 52 additions and 35 deletions

View File

@ -65,24 +65,33 @@ class AccountProfileScreen extends HookConsumerWidget {
expandedHeight: 180, expandedHeight: 180,
pinned: true, pinned: true,
leading: PageBackButton(shadows: [iconShadow]), leading: PageBackButton(shadows: [iconShadow]),
flexibleSpace: FlexibleSpaceBar( flexibleSpace: Stack(
background: children: [
Positioned.fill(
child:
data.profile.background?.id != null data.profile.background?.id != null
? CloudImageWidget( ? CloudImageWidget(
fileId: data.profile.background!.id, file: data.profile.background,
) )
: Container( : Container(
color: color:
Theme.of(context).appBarTheme.backgroundColor, Theme.of(
context,
).appBarTheme.backgroundColor,
), ),
),
FlexibleSpaceBar(
title: Text( title: Text(
data.nick, data.nick,
style: TextStyle( style: TextStyle(
color: Theme.of(context).appBarTheme.foregroundColor, color:
Theme.of(context).appBarTheme.foregroundColor,
shadows: [iconShadow], shadows: [iconShadow],
), ),
), ),
), ),
],
),
), ),
SliverToBoxAdapter( SliverToBoxAdapter(
child: Padding( child: Padding(
@ -91,7 +100,7 @@ class AccountProfileScreen extends HookConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
ProfilePictureWidget( ProfilePictureWidget(
fileId: data.profile.picture?.id, file: data.profile.picture,
radius: 32, radius: 32,
), ),
const Gap(20), const Gap(20),

View File

@ -106,21 +106,32 @@ class PublisherProfileScreen extends HookConsumerWidget {
expandedHeight: 180, expandedHeight: 180,
pinned: true, pinned: true,
leading: PageBackButton(shadows: [iconShadow]), leading: PageBackButton(shadows: [iconShadow]),
flexibleSpace: FlexibleSpaceBar( flexibleSpace: Stack(
background: children: [
Positioned.fill(
child:
data.background?.id != null data.background?.id != null
? CloudImageWidget(fileId: data.background!.id) ? CloudImageWidget(file: data.background)
: Container( : Container(
color: color:
Theme.of(context).appBarTheme.backgroundColor, Theme.of(
context,
).appBarTheme.backgroundColor,
), ),
),
FlexibleSpaceBar(
title: Text( title: Text(
data.nick, data.nick,
style: TextStyle( style: TextStyle(
color: Theme.of(context).appBarTheme.foregroundColor, color:
Theme.of(context).appBarTheme.foregroundColor,
shadows: [iconShadow], shadows: [iconShadow],
), ),
), ),
background:
Container(), // Empty container since background is handled by Stack
),
],
), ),
actions: [ actions: [
subStatus.when( subStatus.when(
@ -163,10 +174,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
spacing: 20, spacing: 20,
children: [ children: [
ProfilePictureWidget( ProfilePictureWidget(file: data.picture, radius: 32),
fileId: data.picture!.id,
radius: 32,
),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,