🐛 Fix bugs in the share sheet
This commit is contained in:
@@ -585,10 +585,10 @@
|
|||||||
"unknownChat": "未知聊天",
|
"unknownChat": "未知聊天",
|
||||||
"addAdditionalMessage": "添加附加消息……",
|
"addAdditionalMessage": "添加附加消息……",
|
||||||
"uploadingFiles": "上传文件中……",
|
"uploadingFiles": "上传文件中……",
|
||||||
"sharedSuccessfully": "分享成功!",
|
"sharedSuccessfully": "分享成功",
|
||||||
"shareSuccess": "分享成功!",
|
"shareSuccess": "分享成功",
|
||||||
"shareToSpecificChatSuccess": "成功分享至 {}!",
|
"shareToSpecificChatSuccess": "成功分享至 {}",
|
||||||
"wouldYouLikeToGoToChat": "是否前往该聊天?",
|
"wouldYouLikeToGoToChat": "是否前往该聊天页面?",
|
||||||
"no": "否",
|
"no": "否",
|
||||||
"yes": "是",
|
"yes": "是",
|
||||||
"navigateToChat": "前往聊天",
|
"navigateToChat": "前往聊天",
|
||||||
@@ -1092,4 +1092,4 @@
|
|||||||
"aiThought": "寻思",
|
"aiThought": "寻思",
|
||||||
"aiThoughtTitle": "让 SN 酱寻思寻思",
|
"aiThoughtTitle": "让 SN 酱寻思寻思",
|
||||||
"thoughtUnpaidHint": "寻思因为有未支付的订单而被禁用"
|
"thoughtUnpaidHint": "寻思因为有未支付的订单而被禁用"
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:gap/gap.dart';
|
import 'package:gap/gap.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:island/pods/userinfo.dart';
|
||||||
import 'package:island/services/file_uploader.dart';
|
import 'package:island/services/file_uploader.dart';
|
||||||
import 'package:island/widgets/alert.dart';
|
import 'package:island/widgets/alert.dart';
|
||||||
import 'package:island/widgets/content/sheet.dart';
|
import 'package:island/widgets/content/sheet.dart';
|
||||||
@@ -177,8 +178,11 @@ class _ShareSheetState extends ConsumerState<ShareSheet> {
|
|||||||
|
|
||||||
// Show compose sheet
|
// Show compose sheet
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
PostComposeSheet.show(context, initialState: initialState);
|
await PostComposeSheet.show(context, initialState: initialState);
|
||||||
Navigator.of(context).pop(); // Close the share sheet
|
// Close the share sheet after the compose sheet is dismissed
|
||||||
|
if (mounted) {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showErrorAlert(e);
|
showErrorAlert(e);
|
||||||
@@ -650,19 +654,26 @@ class _ChatRoomsList extends ConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ChatRoomOption extends StatelessWidget {
|
class _ChatRoomOption extends HookConsumerWidget {
|
||||||
final SnChatRoom room;
|
final SnChatRoom room;
|
||||||
final VoidCallback? onTap;
|
final VoidCallback? onTap;
|
||||||
|
|
||||||
const _ChatRoomOption({required this.room, this.onTap});
|
const _ChatRoomOption({required this.room, this.onTap});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final userInfo = ref.watch(userInfoProvider);
|
||||||
|
|
||||||
|
final validMembers =
|
||||||
|
(room.members ?? [])
|
||||||
|
.where((m) => m.accountId != userInfo.value?.id)
|
||||||
|
.toList();
|
||||||
|
|
||||||
final isDirect = room.type == 1; // Assuming type 1 is direct chat
|
final isDirect = room.type == 1; // Assuming type 1 is direct chat
|
||||||
final displayName =
|
final displayName =
|
||||||
room.name ??
|
room.name ??
|
||||||
(isDirect && room.members != null
|
(isDirect
|
||||||
? room.members!.map((m) => m.account.nick).join(', ')
|
? validMembers.map((m) => m.account.nick).join(', ')
|
||||||
: 'unknownChat'.tr());
|
: 'unknownChat'.tr());
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
@@ -694,18 +705,22 @@ class _ChatRoomOption extends StatelessWidget {
|
|||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
),
|
),
|
||||||
child:
|
child:
|
||||||
room.picture != null
|
(isDirect && room.picture?.id == null)
|
||||||
? ClipRRect(
|
? SplitAvatarWidget(
|
||||||
borderRadius: BorderRadius.circular(16),
|
filesId:
|
||||||
child: CloudFileWidget(
|
validMembers
|
||||||
item: room.picture!,
|
.map((e) => e.account.profile.picture?.id)
|
||||||
fit: BoxFit.cover,
|
.toList(),
|
||||||
),
|
radius: 16,
|
||||||
)
|
)
|
||||||
: Icon(
|
: room.picture?.id == null
|
||||||
isDirect ? Symbols.person : Symbols.group,
|
? CircleAvatar(
|
||||||
size: 20,
|
radius: 16,
|
||||||
color: Theme.of(context).colorScheme.primary,
|
child: Text(room.name![0].toUpperCase()),
|
||||||
|
)
|
||||||
|
: ProfilePictureWidget(
|
||||||
|
fileId: room.picture?.id,
|
||||||
|
radius: 16,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
|
|||||||
Reference in New Issue
Block a user