💄 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,66 +266,89 @@ 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(
crossAxisAlignment: CrossAxisAlignment.stretch, child: Column(
spacing: 24, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if (buildSubcolumn(data).isNotEmpty) Text('bio').tr().bold().fontSize(15).padding(bottom: 8),
Column( if (data.profile.bio.isEmpty)
crossAxisAlignment: CrossAxisAlignment.start, Text('descriptionNone').tr().italic()
spacing: 2, else
children: buildSubcolumn(data), MarkdownTextContent(
), content: data.profile.bio,
Column( linesMargin: EdgeInsets.zero,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('bio').tr().bold(),
Text(
data.profile.bio.isEmpty
? 'descriptionNone'.tr()
: data.profile.bio,
), ),
], ],
), ).padding(horizontal: 24, vertical: 20),
if (data.profile.timeZone.isNotEmpty) );
Column(
crossAxisAlignment: CrossAxisAlignment.start, Widget accountProfileDetail(SnAccount data) => Card(
children: [ child: Column(
Text('timeZone').tr().bold(), crossAxisAlignment: CrossAxisAlignment.stretch,
Row( spacing: 24,
crossAxisAlignment: CrossAxisAlignment.baseline, children: [
textBaseline: TextBaseline.alphabetic, if (buildSubcolumn(data).isNotEmpty)
spacing: 6, Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Text(data.profile.timeZone), spacing: 2,
Text( children: buildSubcolumn(data),
getTzInfo( ),
data.profile.timeZone, if (data.profile.timeZone.isNotEmpty)
).$2.formatCustomGlobal('HH:mm'), Column(
), crossAxisAlignment: CrossAxisAlignment.start,
Text( children: [
getTzInfo(data.profile.timeZone).$1.formatOffsetLocal(), Text('timeZone').tr().bold(),
).fontSize(11), Row(
Text( crossAxisAlignment: CrossAxisAlignment.baseline,
'UTC${getTzInfo(data.profile.timeZone).$1.formatOffset()}', textBaseline: TextBaseline.alphabetic,
).fontSize(11).opacity(0.75), spacing: 6,
], children: [
), Text(data.profile.timeZone),
], Text(
), getTzInfo(
], data.profile.timeZone,
).padding(horizontal: 24); ).$2.formatCustomGlobal('HH:mm'),
),
Text(
getTzInfo(data.profile.timeZone).$1.formatOffsetLocal(),
).fontSize(11),
Text(
'UTC${getTzInfo(data.profile.timeZone).$1.formatOffset()}',
).fontSize(11).opacity(0.75),
],
),
],
),
],
).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(
mark: data.profile.verification!, 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( 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(
mark: data.profile.verification!, 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( SliverToBoxAdapter(
child: Column( child: accountProfileBio(data).padding(horizontal: 4),
children: [ ),
FortuneGraphWidget( SliverToBoxAdapter(
events: accountEvents, child: accountProfileDetail(
eventCalanderUser: data.name, data,
), ).padding(horizontal: 4),
], ),
).padding(all: 8), if (user.value != null)
SliverToBoxAdapter(
child: accountAction(data).padding(horizontal: 4),
),
SliverToBoxAdapter(
child: Card(
child: FortuneGraphWidget(
events: accountEvents,
eventCalanderUser: data.name,
),
).padding(horizontal: 4),
), ),
], ],
), ),