💄 Optimize publisher name display
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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!),
|
||||
|
||||
Reference in New Issue
Block a user