💄 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/app_scaffold.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:material_symbols_icons/symbols.dart';
import 'package:palette_generator/palette_generator.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:share_plus/share_plus.dart';
import 'package:styled_widget/styled_widget.dart';
part 'profile.g.dart';
@@ -264,18 +266,51 @@ class AccountProfileScreen extends HookConsumerWidget {
children: [
AccountName(account: data, style: TextStyle(fontSize: 20)),
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),
],
),
),
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,
spacing: 24,
children: [
@@ -285,17 +320,6 @@ class AccountProfileScreen extends HookConsumerWidget {
spacing: 2,
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)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -323,7 +347,8 @@ class AccountProfileScreen extends HookConsumerWidget {
],
),
],
).padding(horizontal: 24);
).padding(horizontal: 24, vertical: 16),
);
Widget accountAction(SnAccount data) => Card(
child: Column(
@@ -390,7 +415,7 @@ class AccountProfileScreen extends HookConsumerWidget {
),
),
],
).padding(horizontal: 16),
),
Row(
spacing: 8,
children: [
@@ -498,11 +523,19 @@ class AccountProfileScreen extends HookConsumerWidget {
progress: data.profile.levelingProgress,
),
if (data.profile.verification != null)
VerificationStatusCard(
Card(
child: VerificationStatusCard(
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(
child: CustomScrollView(
slivers: [
SliverToBoxAdapter(
child: accountProfileDetail(data),
),
SliverGap(24),
if (user.value != null)
SliverToBoxAdapter(child: accountAction(data)),
SliverToBoxAdapter(
@@ -521,14 +551,15 @@ class AccountProfileScreen extends HookConsumerWidget {
child: FortuneGraphWidget(
events: accountEvents,
eventCalanderUser: data.name,
margin: EdgeInsets.zero,
),
),
).padding(all: 8),
),
],
),
),
],
)
).padding(horizontal: 24)
: CustomScrollView(
slivers: [
SliverAppBar(
@@ -579,34 +610,40 @@ class AccountProfileScreen extends HookConsumerWidget {
),
SliverToBoxAdapter(
child: Column(
spacing: 12,
children: [
LevelingProgressCard(
level: data.profile.level,
experience: data.profile.experience,
progress: data.profile.levelingProgress,
),
).padding(top: 8, horizontal: 8, bottom: 4),
if (data.profile.verification != null)
VerificationStatusCard(
Card(
child: VerificationStatusCard(
mark: data.profile.verification!,
),
).padding(horizontal: 4),
],
).padding(horizontal: 20),
),
SliverToBoxAdapter(child: accountProfileDetail(data)),
if (user.value != null)
SliverToBoxAdapter(child: accountAction(data)),
),
SliverToBoxAdapter(
child: Column(
children: [
FortuneGraphWidget(
child: accountProfileBio(data).padding(horizontal: 4),
),
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,
eventCalanderUser: data.name,
),
],
).padding(all: 8),
).padding(horizontal: 4),
),
],
),