💄 Optimize profile page

This commit is contained in:
2025-08-04 17:24:17 +08:00
parent c8e351514d
commit 92685d7410

View File

@@ -23,10 +23,12 @@ import 'package:island/widgets/account/status.dart';
import 'package:island/widgets/alert.dart'; import 'package:island/widgets/alert.dart';
import 'package:island/widgets/app_scaffold.dart'; import 'package:island/widgets/app_scaffold.dart';
import 'package:island/widgets/content/cloud_files.dart'; import 'package:island/widgets/content/cloud_files.dart';
import 'package:island/widgets/content/markdown.dart';
import 'package:island/widgets/safety/abuse_report_helper.dart'; import 'package:island/widgets/safety/abuse_report_helper.dart';
import 'package:material_symbols_icons/symbols.dart'; import 'package:material_symbols_icons/symbols.dart';
import 'package:palette_generator/palette_generator.dart'; import 'package:palette_generator/palette_generator.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:share_plus/share_plus.dart';
import 'package:styled_widget/styled_widget.dart'; import 'package:styled_widget/styled_widget.dart';
part 'profile.g.dart'; part 'profile.g.dart';
@@ -264,18 +266,51 @@ class AccountProfileScreen extends HookConsumerWidget {
children: [ children: [
AccountName(account: data, style: TextStyle(fontSize: 20)), AccountName(account: data, style: TextStyle(fontSize: 20)),
const Gap(6), const Gap(6),
Text('@${data.name}').fontSize(14).opacity(0.85), Flexible(
child: Text(
'@${data.name}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
).fontSize(14).opacity(0.85),
),
], ],
), ),
AccountStatusWidget(uname: name, padding: EdgeInsets.zero), AccountStatusWidget(uname: name, padding: EdgeInsets.zero),
], ],
), ),
), ),
IconButton(
onPressed: () {
SharePlus.instance.share(
ShareParams(
uri: Uri.parse('https://id.solian.app/@${data.name}'),
),
);
},
icon: const Icon(Symbols.share),
),
], ],
), ),
); );
Widget accountProfileDetail(SnAccount data) => Column( Widget accountProfileBio(SnAccount data) => Card(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('bio').tr().bold().fontSize(15).padding(bottom: 8),
if (data.profile.bio.isEmpty)
Text('descriptionNone').tr().italic()
else
MarkdownTextContent(
content: data.profile.bio,
linesMargin: EdgeInsets.zero,
),
],
).padding(horizontal: 24, vertical: 20),
);
Widget accountProfileDetail(SnAccount data) => Card(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
spacing: 24, spacing: 24,
children: [ children: [
@@ -285,17 +320,6 @@ class AccountProfileScreen extends HookConsumerWidget {
spacing: 2, spacing: 2,
children: buildSubcolumn(data), children: buildSubcolumn(data),
), ),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('bio').tr().bold(),
Text(
data.profile.bio.isEmpty
? 'descriptionNone'.tr()
: data.profile.bio,
),
],
),
if (data.profile.timeZone.isNotEmpty) if (data.profile.timeZone.isNotEmpty)
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@@ -323,7 +347,8 @@ class AccountProfileScreen extends HookConsumerWidget {
], ],
), ),
], ],
).padding(horizontal: 24); ).padding(horizontal: 24, vertical: 16),
);
Widget accountAction(SnAccount data) => Card( Widget accountAction(SnAccount data) => Card(
child: Column( child: Column(
@@ -390,7 +415,7 @@ class AccountProfileScreen extends HookConsumerWidget {
), ),
), ),
], ],
).padding(horizontal: 16), ),
Row( Row(
spacing: 8, spacing: 8,
children: [ children: [
@@ -498,11 +523,19 @@ class AccountProfileScreen extends HookConsumerWidget {
progress: data.profile.levelingProgress, progress: data.profile.levelingProgress,
), ),
if (data.profile.verification != null) if (data.profile.verification != null)
VerificationStatusCard( Card(
child: VerificationStatusCard(
mark: data.profile.verification!, mark: data.profile.verification!,
), ),
),
], ],
).padding(horizontal: 20), ).padding(horizontal: 4, top: 8),
),
SliverToBoxAdapter(
child: accountProfileBio(data).padding(top: 4),
),
SliverToBoxAdapter(
child: accountProfileDetail(data),
), ),
], ],
), ),
@@ -510,10 +543,7 @@ class AccountProfileScreen extends HookConsumerWidget {
Flexible( Flexible(
child: CustomScrollView( child: CustomScrollView(
slivers: [ slivers: [
SliverToBoxAdapter( SliverGap(24),
child: accountProfileDetail(data),
),
if (user.value != null) if (user.value != null)
SliverToBoxAdapter(child: accountAction(data)), SliverToBoxAdapter(child: accountAction(data)),
SliverToBoxAdapter( SliverToBoxAdapter(
@@ -521,14 +551,15 @@ class AccountProfileScreen extends HookConsumerWidget {
child: FortuneGraphWidget( child: FortuneGraphWidget(
events: accountEvents, events: accountEvents,
eventCalanderUser: data.name, eventCalanderUser: data.name,
margin: EdgeInsets.zero,
),
), ),
).padding(all: 8),
), ),
], ],
), ),
), ),
], ],
) ).padding(horizontal: 24)
: CustomScrollView( : CustomScrollView(
slivers: [ slivers: [
SliverAppBar( SliverAppBar(
@@ -579,34 +610,40 @@ class AccountProfileScreen extends HookConsumerWidget {
), ),
SliverToBoxAdapter( SliverToBoxAdapter(
child: Column( child: Column(
spacing: 12,
children: [ children: [
LevelingProgressCard( LevelingProgressCard(
level: data.profile.level, level: data.profile.level,
experience: data.profile.experience, experience: data.profile.experience,
progress: data.profile.levelingProgress, progress: data.profile.levelingProgress,
), ).padding(top: 8, horizontal: 8, bottom: 4),
if (data.profile.verification != null) if (data.profile.verification != null)
VerificationStatusCard( Card(
child: VerificationStatusCard(
mark: data.profile.verification!, mark: data.profile.verification!,
), ),
).padding(horizontal: 4),
], ],
).padding(horizontal: 20),
), ),
),
SliverToBoxAdapter(child: accountProfileDetail(data)),
if (user.value != null)
SliverToBoxAdapter(child: accountAction(data)),
SliverToBoxAdapter( SliverToBoxAdapter(
child: Column( child: accountProfileBio(data).padding(horizontal: 4),
children: [ ),
FortuneGraphWidget( SliverToBoxAdapter(
child: accountProfileDetail(
data,
).padding(horizontal: 4),
),
if (user.value != null)
SliverToBoxAdapter(
child: accountAction(data).padding(horizontal: 4),
),
SliverToBoxAdapter(
child: Card(
child: FortuneGraphWidget(
events: accountEvents, events: accountEvents,
eventCalanderUser: data.name, eventCalanderUser: data.name,
), ),
], ).padding(horizontal: 4),
).padding(all: 8),
), ),
], ],
), ),