💄 Optimize publisher name display

This commit is contained in:
2025-10-23 00:38:37 +08:00
parent 1ae81794b1
commit 8bec18813d
7 changed files with 31 additions and 15 deletions

View File

@@ -203,7 +203,7 @@ class AccountScreen extends HookConsumerWidget {
],
).padding(horizontal: 16, vertical: 12),
onTap: () {
context.pushNamed('developerHub');
context.goNamed('developerHub');
},
),
).height(140),

View File

@@ -522,7 +522,7 @@ class CreatorHubScreen extends HookConsumerWidget {
return AppScaffold(
isNoBackground: false,
appBar: AppBar(
leading: const PageBackButton(),
leading: const PageBackButton(backTo: '/account'),
title: Text('creatorHub').tr(),
actions: [
if (!isWideScreen(context))

View File

@@ -181,7 +181,7 @@ class _ConsoleAppBar extends StatelessWidget implements PreferredSizeWidget {
@override
Widget build(BuildContext context) {
return AppBar(
leading: const PageBackButton(),
leading: const PageBackButton(backTo: '/account'),
title: Text('developerHub').tr(),
actions: [
if (currentProject != null)

View File

@@ -276,7 +276,7 @@ class _RealmIdentityProviderElement
String get realmSlug => (origin as RealmIdentityProvider).realmSlug;
}
String _$realmChatRoomsHash() => r'54d36010221cd298f5ee0059259059f8b8aaff7b';
String _$realmChatRoomsHash() => r'5f199906fb287b109e2a2d2a81dcb6675bdcb816';
/// See also [realmChatRooms].
@ProviderFor(realmChatRooms)

View File

@@ -36,11 +36,13 @@ const kVerificationMarkColors = [
class AccountName extends StatelessWidget {
final SnAccount account;
final TextStyle? style;
final String? textOverride;
final bool ignorePermissions;
const AccountName({
super.key,
required this.account,
this.style,
this.textOverride,
this.ignorePermissions = false,
});
@@ -177,7 +179,7 @@ class AccountName extends StatelessWidget {
child: ShaderMask(
shaderCallback: (bounds) => gradient.createShader(bounds),
child: Text(
account.nick,
textOverride ?? account.nick,
style: nameStyle.copyWith(color: Colors.white),
maxLines: 1,
overflow: TextOverflow.ellipsis,

View File

@@ -370,12 +370,18 @@ class PageBackButton extends StatelessWidget {
final Color? color;
final List<Shadow>? shadows;
final VoidCallback? onWillPop;
const PageBackButton({super.key, this.shadows, this.onWillPop, this.color});
final String? backTo;
const PageBackButton({
super.key,
this.shadows,
this.onWillPop,
this.color,
this.backTo,
});
@override
Widget build(BuildContext context) {
final hasPageAction =
!kIsWeb && Platform.isMacOS;
final hasPageAction = !kIsWeb && Platform.isMacOS;
if (hasPageAction && isWideScreen(context)) return const SizedBox.shrink();
@@ -385,7 +391,7 @@ class PageBackButton extends StatelessWidget {
if (context.canPop()) {
context.pop();
} else {
context.go('/');
context.go(backTo ?? '/');
}
},
icon: Icon(

View File

@@ -570,7 +570,9 @@ class PostHeader extends StatelessWidget {
}
: null,
child: ProfilePictureWidget(
file: item.publisher.picture,
file:
item.publisher.picture ??
item.publisher.account?.profile.picture,
radius: 16,
borderRadius: item.publisher.type == 0 ? null : 6,
),
@@ -586,11 +588,17 @@ class PostHeader extends StatelessWidget {
children: [
Flexible(
child:
Text(
item.publisher.nick,
maxLines: 1,
overflow: TextOverflow.ellipsis,
).bold(),
item.publisher.account != null
? AccountName(
account: item.publisher.account!,
textOverride: item.publisher.nick,
style: TextStyle(fontWeight: FontWeight.bold),
)
: Text(
item.publisher.nick,
maxLines: 1,
overflow: TextOverflow.ellipsis,
).bold(),
),
if (item.publisher.verification != null)
VerificationMark(mark: item.publisher.verification!),