👽 Support new attachment reference system
This commit is contained in:
@ -74,7 +74,7 @@ class AccountScreen extends HookConsumerWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (user.value?.profile.backgroundId != null)
|
||||
if (user.value?.profile.background?.id != null)
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(8),
|
||||
@ -83,7 +83,7 @@ class AccountScreen extends HookConsumerWidget {
|
||||
child: AspectRatio(
|
||||
aspectRatio: 16 / 7,
|
||||
child: CloudImageWidget(
|
||||
fileId: user.value!.profile.backgroundId!,
|
||||
fileId: user.value!.profile.background!.id,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
@ -94,7 +94,7 @@ class AccountScreen extends HookConsumerWidget {
|
||||
children: [
|
||||
GestureDetector(
|
||||
child: ProfilePictureWidget(
|
||||
fileId: user.value?.profile.pictureId,
|
||||
fileId: user.value?.profile.picture?.id,
|
||||
radius: 24,
|
||||
),
|
||||
onTap: () {
|
||||
|
@ -202,7 +202,7 @@ class EventCalanderScreen extends HookConsumerWidget {
|
||||
color: Colors.transparent,
|
||||
child: ListTile(
|
||||
leading: ProfilePictureWidget(
|
||||
fileId: user.value!.profile.pictureId,
|
||||
fileId: user.value!.profile.picture?.id,
|
||||
),
|
||||
title: Text(user.value!.nick).bold(),
|
||||
subtitle: Text('@${user.value!.name}'),
|
||||
|
@ -159,9 +159,9 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
||||
child: Container(
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||
child:
|
||||
user.value!.profile.backgroundId != null
|
||||
user.value!.profile.background?.id != null
|
||||
? CloudImageWidget(
|
||||
fileId: user.value!.profile.backgroundId!,
|
||||
fileId: user.value!.profile.background!.id,
|
||||
fit: BoxFit.cover,
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
@ -175,7 +175,7 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
||||
bottom: -32,
|
||||
child: GestureDetector(
|
||||
child: ProfilePictureWidget(
|
||||
fileId: user.value!.profile.pictureId,
|
||||
fileId: user.value!.profile.picture?.id,
|
||||
radius: 40,
|
||||
),
|
||||
onTap: () {
|
||||
|
@ -67,9 +67,9 @@ class AccountProfileScreen extends HookConsumerWidget {
|
||||
leading: PageBackButton(shadows: [iconShadow]),
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background:
|
||||
data.profile.backgroundId != null
|
||||
data.profile.background?.id != null
|
||||
? CloudImageWidget(
|
||||
fileId: data.profile.backgroundId!,
|
||||
fileId: data.profile.background!.id,
|
||||
)
|
||||
: Container(
|
||||
color:
|
||||
@ -91,7 +91,7 @@ class AccountProfileScreen extends HookConsumerWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ProfilePictureWidget(
|
||||
fileId: data.profile.pictureId,
|
||||
fileId: data.profile.picture?.id,
|
||||
radius: 32,
|
||||
),
|
||||
const Gap(20),
|
||||
|
@ -100,7 +100,7 @@ class RelationshipListTile extends StatelessWidget {
|
||||
|
||||
return ListTile(
|
||||
contentPadding: const EdgeInsets.only(left: 16, right: 12),
|
||||
leading: ProfilePictureWidget(fileId: account.profile.pictureId),
|
||||
leading: ProfilePictureWidget(fileId: account.profile.picture?.id),
|
||||
title: Row(
|
||||
spacing: 6,
|
||||
children: [
|
||||
|
@ -1,3 +1,5 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -17,6 +19,7 @@ class TabNavigationObserver extends AutoRouterObserver {
|
||||
|
||||
@override
|
||||
void didPush(Route route, Route? previousRoute) {
|
||||
log('pushed ${previousRoute?.settings.name} -> ${route.settings.name}');
|
||||
if (route is DialogRoute) return;
|
||||
Future(() {
|
||||
onChange(route.settings.name);
|
||||
@ -25,6 +28,7 @@ class TabNavigationObserver extends AutoRouterObserver {
|
||||
|
||||
@override
|
||||
void didPop(Route route, Route? previousRoute) {
|
||||
log('popped ${route.settings.name} -> ${previousRoute?.settings.name}');
|
||||
if (route is DialogRoute) return;
|
||||
Future(() {
|
||||
onChange(previousRoute?.settings.name);
|
||||
@ -81,6 +85,7 @@ class TabsNavigationWidget extends HookConsumerWidget {
|
||||
];
|
||||
final routeNames = [
|
||||
ExploreRoute.name,
|
||||
ExploreShellRoute.name,
|
||||
ChatListRoute.name,
|
||||
RealmListRoute.name,
|
||||
AccountRoute.name,
|
||||
|
@ -166,7 +166,8 @@ class CallScreen extends HookConsumerWidget {
|
||||
.profile
|
||||
?.account
|
||||
.profile
|
||||
.pictureId,
|
||||
.picture
|
||||
?.id,
|
||||
size: 72,
|
||||
),
|
||||
),
|
||||
|
@ -109,7 +109,7 @@ class ChatRoomListTile extends HookConsumerWidget {
|
||||
},
|
||||
loading: () => const SizedBox.shrink(),
|
||||
error:
|
||||
(_, __) =>
|
||||
(_, _) =>
|
||||
isDirect && room.description == null
|
||||
? Text(
|
||||
room.members!.map((e) => '@${e.account.name}').join(', '),
|
||||
@ -127,19 +127,19 @@ class ChatRoomListTile extends HookConsumerWidget {
|
||||
isLabelVisible: summary.when(
|
||||
data: (data) => (data?.unreadCount ?? 0) > 0,
|
||||
loading: () => false,
|
||||
error: (_, __) => false,
|
||||
error: (_, _) => false,
|
||||
),
|
||||
child:
|
||||
(isDirect && room.pictureId == null)
|
||||
(isDirect && room.picture?.id == null)
|
||||
? SplitAvatarWidget(
|
||||
filesId:
|
||||
room.members!
|
||||
.map((e) => e.account.profile.pictureId)
|
||||
.map((e) => e.account.profile.picture?.id)
|
||||
.toList(),
|
||||
)
|
||||
: room.pictureId == null
|
||||
: room.picture?.id == null
|
||||
? CircleAvatar(child: Text(room.name![0].toUpperCase()))
|
||||
: ProfilePictureWidget(fileId: room.pictureId),
|
||||
: ProfilePictureWidget(fileId: room.picture?.id),
|
||||
),
|
||||
title: Text(
|
||||
(isDirect && room.name == null)
|
||||
@ -147,7 +147,7 @@ class ChatRoomListTile extends HookConsumerWidget {
|
||||
: room.name ?? '',
|
||||
),
|
||||
subtitle: buildSubtitle(),
|
||||
trailing: trailing, // Add this line
|
||||
trailing: trailing, // Add this line
|
||||
onTap: () async {
|
||||
// Clear unread count if there are unread messages
|
||||
ref.read(chatSummaryProvider.future).then((summary) {
|
||||
@ -280,13 +280,13 @@ class ChatListScreen extends HookConsumerWidget {
|
||||
label: Text(
|
||||
chatInvites.when(
|
||||
data: (invites) => invites.length.toString(),
|
||||
error: (_, __) => '0',
|
||||
error: (_, _) => '0',
|
||||
loading: () => '0',
|
||||
),
|
||||
),
|
||||
isLabelVisible: chatInvites.when(
|
||||
data: (invites) => invites.isNotEmpty,
|
||||
error: (_, __) => false,
|
||||
error: (_, _) => false,
|
||||
loading: () => false,
|
||||
),
|
||||
child: const Icon(Symbols.email),
|
||||
@ -589,7 +589,7 @@ class EditChatScreen extends HookConsumerWidget {
|
||||
realms: joinedRealms.when(
|
||||
data: (realms) => realms,
|
||||
loading: () => [],
|
||||
error: (_, __) => [],
|
||||
error: (_, _) => [],
|
||||
),
|
||||
onChanged: (SnRealm? value) {
|
||||
currentRealm.value = value;
|
||||
|
@ -433,19 +433,23 @@ class ChatRoomScreen extends HookConsumerWidget {
|
||||
height: 26,
|
||||
width: 26,
|
||||
child:
|
||||
(room!.type == 1 && room.pictureId == null)
|
||||
(room!.type == 1 && room.picture?.id == null)
|
||||
? SplitAvatarWidget(
|
||||
filesId:
|
||||
room.members!
|
||||
.map(
|
||||
(e) =>
|
||||
e.account.profile.pictureId,
|
||||
e
|
||||
.account
|
||||
.profile
|
||||
.picture
|
||||
?.id,
|
||||
)
|
||||
.toList(),
|
||||
)
|
||||
: room.pictureId != null
|
||||
: room.picture?.id != null
|
||||
? ProfilePictureWidget(
|
||||
fileId: room.pictureId,
|
||||
fileId: room.picture?.id,
|
||||
fallbackIcon: Symbols.chat,
|
||||
)
|
||||
: CircleAvatar(
|
||||
@ -473,19 +477,23 @@ class ChatRoomScreen extends HookConsumerWidget {
|
||||
height: 26,
|
||||
width: 26,
|
||||
child:
|
||||
(room!.type == 1 && room.pictureId == null)
|
||||
(room!.type == 1 && room.picture?.id == null)
|
||||
? SplitAvatarWidget(
|
||||
filesId:
|
||||
room.members!
|
||||
.map(
|
||||
(e) =>
|
||||
e.account.profile.pictureId,
|
||||
e
|
||||
.account
|
||||
.profile
|
||||
.picture
|
||||
?.id,
|
||||
)
|
||||
.toList(),
|
||||
)
|
||||
: room.pictureId != null
|
||||
: room.picture?.id != null
|
||||
? ProfilePictureWidget(
|
||||
fileId: room.pictureId,
|
||||
fileId: room.picture?.id,
|
||||
fallbackIcon: Symbols.chat,
|
||||
)
|
||||
: CircleAvatar(
|
||||
|
@ -48,9 +48,9 @@ class ChatDetailScreen extends HookConsumerWidget {
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background:
|
||||
(currentRoom!.type == 1 &&
|
||||
currentRoom.backgroundId != null)
|
||||
currentRoom.background?.id != null)
|
||||
? CloudImageWidget(
|
||||
fileId: currentRoom.backgroundId!,
|
||||
fileId: currentRoom.background!.id,
|
||||
)
|
||||
: (currentRoom.type == 1 &&
|
||||
currentRoom.members!.length == 1 &&
|
||||
@ -59,7 +59,8 @@ class ChatDetailScreen extends HookConsumerWidget {
|
||||
.first
|
||||
.account
|
||||
.profile
|
||||
.backgroundId !=
|
||||
.background
|
||||
?.id !=
|
||||
null)
|
||||
? CloudImageWidget(
|
||||
fileId:
|
||||
@ -68,11 +69,12 @@ class ChatDetailScreen extends HookConsumerWidget {
|
||||
.first
|
||||
.account
|
||||
.profile
|
||||
.backgroundId!,
|
||||
.background!
|
||||
.id,
|
||||
)
|
||||
: currentRoom.backgroundId != null
|
||||
: currentRoom.background?.id != null
|
||||
? CloudImageWidget(
|
||||
fileId: currentRoom.backgroundId!,
|
||||
fileId: currentRoom.background!.id,
|
||||
fit: BoxFit.cover,
|
||||
)
|
||||
: Container(
|
||||
@ -390,7 +392,7 @@ class _ChatMemberListSheet extends HookConsumerWidget {
|
||||
return ListTile(
|
||||
contentPadding: EdgeInsets.only(left: 16, right: 12),
|
||||
leading: ProfilePictureWidget(
|
||||
fileId: member.account.profile.pictureId,
|
||||
fileId: member.account.profile.picture?.id,
|
||||
),
|
||||
title: Row(
|
||||
spacing: 6,
|
||||
|
@ -101,7 +101,7 @@ class CreatorHubScreen extends HookConsumerWidget {
|
||||
minTileHeight: 48,
|
||||
leading: ProfilePictureWidget(
|
||||
radius: 16,
|
||||
fileId: item.pictureId,
|
||||
fileId: item.picture?.id,
|
||||
),
|
||||
title: Text(item.nick),
|
||||
subtitle: Text('@${item.name}'),
|
||||
@ -115,7 +115,7 @@ class CreatorHubScreen extends HookConsumerWidget {
|
||||
)
|
||||
.toList(),
|
||||
loading: () => [],
|
||||
error: (_, __) => [],
|
||||
error: (_, _) => [],
|
||||
);
|
||||
|
||||
final publisherStats = ref.watch(
|
||||
@ -150,7 +150,7 @@ class CreatorHubScreen extends HookConsumerWidget {
|
||||
...publishersMenu.map(
|
||||
(e) => ProfilePictureWidget(
|
||||
radius: 16,
|
||||
fileId: e.value?.pictureId,
|
||||
fileId: e.value?.picture?.id,
|
||||
).center().padding(right: 8),
|
||||
),
|
||||
];
|
||||
@ -204,7 +204,7 @@ class CreatorHubScreen extends HookConsumerWidget {
|
||||
...(publishers.value?.map(
|
||||
(publisher) => ListTile(
|
||||
leading: ProfilePictureWidget(
|
||||
fileId: publisher.pictureId,
|
||||
fileId: publisher.picture?.id,
|
||||
),
|
||||
title: Text(publisher.nick),
|
||||
subtitle: Text('@${publisher.name}'),
|
||||
@ -293,7 +293,7 @@ class CreatorHubScreen extends HookConsumerWidget {
|
||||
),
|
||||
),
|
||||
loading: () => const Center(child: CircularProgressIndicator()),
|
||||
error: (_, __) => const SizedBox.shrink(),
|
||||
error: (_, _) => const SizedBox.shrink(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -138,8 +138,8 @@ class EditPublisherScreen extends HookConsumerWidget {
|
||||
|
||||
useEffect(() {
|
||||
if (publisher.value != null) {
|
||||
picture.value = publisher.value!.pictureId;
|
||||
background.value = publisher.value!.backgroundId;
|
||||
picture.value = publisher.value!.picture?.id;
|
||||
background.value = publisher.value!.background?.id;
|
||||
nameController.text = publisher.value!.name;
|
||||
nickController.text = publisher.value!.nick;
|
||||
bioController.text = publisher.value!.bio;
|
||||
@ -193,7 +193,7 @@ class EditPublisherScreen extends HookConsumerWidget {
|
||||
realms: joinedRealms.when(
|
||||
data: (realms) => realms,
|
||||
loading: () => [],
|
||||
error: (_, __) => [],
|
||||
error: (_, _) => [],
|
||||
),
|
||||
onChanged: (SnRealm? value) {
|
||||
currentRealm.value = value;
|
||||
@ -279,14 +279,14 @@ class EditPublisherScreen extends HookConsumerWidget {
|
||||
nameController.text = user.value!.name;
|
||||
nickController.text = user.value!.nick;
|
||||
bioController.text = user.value!.profile.bio;
|
||||
picture.value = user.value!.profile.pictureId;
|
||||
background.value = user.value!.profile.backgroundId;
|
||||
picture.value = user.value!.profile.picture?.id;
|
||||
background.value = user.value!.profile.background?.id;
|
||||
} else {
|
||||
nameController.text = currentRealm.value!.slug;
|
||||
nickController.text = currentRealm.value!.name;
|
||||
bioController.text = currentRealm.value!.description;
|
||||
picture.value = currentRealm.value!.pictureId;
|
||||
background.value = currentRealm.value!.backgroundId;
|
||||
picture.value = currentRealm.value!.picture?.id;
|
||||
background.value = currentRealm.value!.background?.id;
|
||||
}
|
||||
},
|
||||
label:
|
||||
|
@ -303,7 +303,7 @@ class PostComposeScreen extends HookConsumerWidget {
|
||||
children: [
|
||||
GestureDetector(
|
||||
child: ProfilePictureWidget(
|
||||
fileId: currentPublisher.value?.pictureId,
|
||||
fileId: currentPublisher.value?.picture?.id,
|
||||
radius: 20,
|
||||
fallbackIcon:
|
||||
currentPublisher.value == null
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'package:auto_route/annotations.dart';
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@ -108,8 +109,8 @@ class PublisherProfileScreen extends HookConsumerWidget {
|
||||
leading: PageBackButton(shadows: [iconShadow]),
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background:
|
||||
data.backgroundId != null
|
||||
? CloudImageWidget(fileId: data.backgroundId!)
|
||||
data.background?.id != null
|
||||
? CloudImageWidget(fileId: data.background!.id)
|
||||
: Container(
|
||||
color:
|
||||
Theme.of(context).appBarTheme.backgroundColor,
|
||||
@ -139,7 +140,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
|
||||
shadows: [iconShadow],
|
||||
),
|
||||
),
|
||||
error: (_, __) => const SizedBox(),
|
||||
error: (_, _) => const SizedBox(),
|
||||
loading:
|
||||
() => const SizedBox(
|
||||
width: 48,
|
||||
@ -163,7 +164,10 @@ class PublisherProfileScreen extends HookConsumerWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 20,
|
||||
children: [
|
||||
ProfilePictureWidget(fileId: data.pictureId!, radius: 32),
|
||||
ProfilePictureWidget(
|
||||
fileId: data.picture!.id,
|
||||
radius: 32,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
@ -177,6 +181,26 @@ class PublisherProfileScreen extends HookConsumerWidget {
|
||||
).fontSize(14).opacity(0.85),
|
||||
],
|
||||
),
|
||||
if (data.type == 0 && data.account != null)
|
||||
InkWell(
|
||||
onTap: () {
|
||||
context.router.pushPath(
|
||||
'/account/${data.account!.name}',
|
||||
);
|
||||
},
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
spacing: 4,
|
||||
children: [
|
||||
Text(
|
||||
'publisherVisitAccountPage'.tr(
|
||||
args: ['@${data.account!.name}'],
|
||||
),
|
||||
).fontSize(14),
|
||||
Icon(Icons.launch, size: 14),
|
||||
],
|
||||
).opacity(0.85),
|
||||
).padding(bottom: 6),
|
||||
if (data.type == 0 && data.account != null)
|
||||
AccountStatusWidget(
|
||||
uname: data.account!.name,
|
||||
|
@ -54,8 +54,8 @@ class RealmDetailScreen extends HookConsumerWidget {
|
||||
leading: PageBackButton(shadows: [iconShadow]),
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background:
|
||||
realm!.backgroundId != null
|
||||
? CloudImageWidget(fileId: realm.backgroundId!)
|
||||
realm!.background?.id != null
|
||||
? CloudImageWidget(fileId: realm.background!.id)
|
||||
: Container(
|
||||
color:
|
||||
Theme.of(context).appBarTheme.backgroundColor,
|
||||
@ -118,7 +118,7 @@ class _RealmActionMenu extends HookConsumerWidget {
|
||||
final isModerator = realmIdentityAsync.when(
|
||||
data: (identity) => (identity?.role ?? 0) >= 50,
|
||||
loading: () => false,
|
||||
error: (_, __) => false,
|
||||
error: (_, _) => false,
|
||||
);
|
||||
|
||||
return PopupMenuButton(
|
||||
@ -212,7 +212,7 @@ class _RealmActionMenu extends HookConsumerWidget {
|
||||
child: Center(child: CircularProgressIndicator()),
|
||||
),
|
||||
error:
|
||||
(_, __) => PopupMenuItem(
|
||||
(_, _) => PopupMenuItem(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
@ -403,7 +403,7 @@ class _RealmMemberListSheet extends HookConsumerWidget {
|
||||
return ListTile(
|
||||
contentPadding: EdgeInsets.only(left: 16, right: 12),
|
||||
leading: ProfilePictureWidget(
|
||||
fileId: member.account!.profile.pictureId,
|
||||
fileId: member.account!.profile.picture?.id,
|
||||
),
|
||||
title: Row(
|
||||
spacing: 6,
|
||||
|
@ -49,13 +49,13 @@ class RealmListScreen extends HookConsumerWidget {
|
||||
label: Text(
|
||||
realmInvites.when(
|
||||
data: (invites) => invites.length.toString(),
|
||||
error: (_, __) => '0',
|
||||
error: (_, _) => '0',
|
||||
loading: () => '0',
|
||||
),
|
||||
),
|
||||
isLabelVisible: realmInvites.when(
|
||||
data: (invites) => invites.isNotEmpty,
|
||||
error: (_, __) => false,
|
||||
error: (_, _) => false,
|
||||
loading: () => false,
|
||||
),
|
||||
child: const Icon(Symbols.email),
|
||||
@ -97,7 +97,7 @@ class RealmListScreen extends HookConsumerWidget {
|
||||
return ListTile(
|
||||
isThreeLine: true,
|
||||
leading: ProfilePictureWidget(
|
||||
fileId: value[item].pictureId,
|
||||
fileId: value[item].picture?.id,
|
||||
fallbackIcon: Symbols.group,
|
||||
),
|
||||
title: Text(value[item].name),
|
||||
@ -448,7 +448,7 @@ class _RealmInviteSheet extends HookConsumerWidget {
|
||||
final invite = items[index];
|
||||
return ListTile(
|
||||
leading: ProfilePictureWidget(
|
||||
fileId: invite.realm!.pictureId,
|
||||
fileId: invite.realm!.picture?.id,
|
||||
fallbackIcon: Symbols.group,
|
||||
),
|
||||
title: Text(invite.realm!.name),
|
||||
|
Reference in New Issue
Block a user