selectChatDrawer function
Future<String?>
selectChatDrawer({ - required dynamic context,
- dynamic key = selectChatDrawerKey,
- String canCheck = 'CanInvite',
- String? currentChatId,
- dynamic title,
})
Implementation
Future<String?> selectChatDrawer({
required BuildContext context,
Key? key = selectChatDrawerKey,
String canCheck = 'CanInvite',
String? currentChatId,
Widget? title,
}) async {
final selected = await showModalBottomSheet(
showDragHandle: true,
enableDrag: true,
context: context,
isDismissible: true,
builder: (context) => SelectRoomDrawer(
key: key,
canCheck: canCheck,
title: title ?? Text(L10n.of(context).selectChat),
keyPrefix: 'select-chat',
roomType: RoomType.groupChat,
),
);
if (selected == null) {
// in case of being dismissed, we return the previously selected item
return currentChatId;
}
if (selected == '') {
// in case of being cleared, we return null
return null;
}
return selected;
}