💄 Changes to the showing of realm post
This commit is contained in:
parent
3defd3a593
commit
25550ba197
@ -13,6 +13,7 @@ class AccountImage extends StatelessWidget {
|
||||
final double? borderRadius;
|
||||
final Widget? fallbackWidget;
|
||||
final Widget? badge;
|
||||
final Offset? badgeOffset;
|
||||
|
||||
const AccountImage({
|
||||
super.key,
|
||||
@ -23,6 +24,7 @@ class AccountImage extends StatelessWidget {
|
||||
this.borderRadius,
|
||||
this.fallbackWidget,
|
||||
this.badge,
|
||||
this.badgeOffset,
|
||||
});
|
||||
|
||||
@override
|
||||
@ -40,7 +42,8 @@ class AccountImage extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(borderRadius ?? radius ?? 20),
|
||||
child: (content?.isEmpty ?? true)
|
||||
? Container(
|
||||
color: backgroundColor ?? Theme.of(context).colorScheme.primaryContainer,
|
||||
color: backgroundColor ??
|
||||
Theme.of(context).colorScheme.primaryContainer,
|
||||
child: (fallbackWidget ??
|
||||
Icon(
|
||||
Symbols.account_circle,
|
||||
@ -58,8 +61,8 @@ class AccountImage extends StatelessWidget {
|
||||
),
|
||||
if (badge != null)
|
||||
Positioned(
|
||||
right: -4,
|
||||
bottom: -2,
|
||||
right: badgeOffset?.dx ?? -4,
|
||||
bottom: badgeOffset?.dy ?? -2,
|
||||
child: badge!,
|
||||
),
|
||||
],
|
||||
|
@ -923,27 +923,48 @@ class _PostContentHeader extends StatelessWidget {
|
||||
return Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
child: AccountImage(
|
||||
content: data.publisher.avatar,
|
||||
radius: isCompact ? 12 : 20,
|
||||
borderRadius: data.publisher.type == 1 ? (isCompact ? 4 : 8) : 20,
|
||||
badge: (user?.badges.isNotEmpty ?? false)
|
||||
? Icon(
|
||||
kBadgesMeta[user!.badges.first.type]?.$2 ??
|
||||
Symbols.question_mark,
|
||||
color: kBadgesMeta[user.badges.first.type]?.$3,
|
||||
fill: 1,
|
||||
size: 18,
|
||||
shadows: [
|
||||
Shadow(
|
||||
offset: Offset(1, 1),
|
||||
blurRadius: 5.0,
|
||||
color: Color.fromARGB(200, 0, 0, 0),
|
||||
child: data.preload?.realm == null
|
||||
? AccountImage(
|
||||
content: data.publisher.avatar,
|
||||
radius: isCompact ? 12 : 20,
|
||||
borderRadius:
|
||||
data.publisher.type == 1 ? (isCompact ? 4 : 8) : 20,
|
||||
badge: (user?.badges.isNotEmpty ?? false)
|
||||
? Icon(
|
||||
kBadgesMeta[user!.badges.first.type]?.$2 ??
|
||||
Symbols.question_mark,
|
||||
color: kBadgesMeta[user.badges.first.type]?.$3,
|
||||
fill: 1,
|
||||
size: 18,
|
||||
shadows: [
|
||||
Shadow(
|
||||
offset: Offset(1, 1),
|
||||
blurRadius: 5.0,
|
||||
color: Color.fromARGB(200, 0, 0, 0),
|
||||
),
|
||||
],
|
||||
)
|
||||
: null,
|
||||
)
|
||||
: AccountImage(
|
||||
content: data.preload!.realm!.avatar,
|
||||
radius: isCompact ? 12 : 20,
|
||||
borderRadius: isCompact ? 4 : 8,
|
||||
badgeOffset: Offset(-6, -4),
|
||||
badge: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
width: 2,
|
||||
),
|
||||
],
|
||||
)
|
||||
: null,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: AccountImage(
|
||||
content: data.publisher.avatar,
|
||||
radius: 10,
|
||||
),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
showPopover(
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
@ -988,7 +1009,17 @@ class _PostContentHeader extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(data.publisher.nick).bold(),
|
||||
Row(
|
||||
children: [
|
||||
Text(data.publisher.nick).bold(),
|
||||
if (data.preload?.realm != null)
|
||||
const Icon(Symbols.arrow_right, size: 16)
|
||||
.padding(horizontal: 2)
|
||||
.opacity(0.5),
|
||||
if (data.preload?.realm != null)
|
||||
Text(data.preload!.realm!.name),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text('@${data.publisher.name}').fontSize(13),
|
||||
|
Loading…
x
Reference in New Issue
Block a user