chats date dividing bug fix
This commit is contained in:
parent
2fe2a57b9b
commit
dcfd9ffce7
|
|
@ -135,8 +135,10 @@ class ChatScreen extends StatelessWidget {
|
|||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (BuildContext context, index) {
|
||||
return ChatWidget(
|
||||
room: chatController.rooms.result.data[index],
|
||||
);
|
||||
room: chatController.rooms.result.data[index],
|
||||
onBack: () {
|
||||
lastDate = 'today'.tr;
|
||||
});
|
||||
},
|
||||
separatorBuilder: (BuildContext context, index) {
|
||||
// return Container();
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ class ChatDetails extends StatelessWidget {
|
|||
final ChatController chatController = Get.find<ChatController>();
|
||||
final KeyboardVisibilityController _keyboardVisibilityController =
|
||||
KeyboardVisibilityController();
|
||||
Room room = Get.arguments;
|
||||
Room room = Get.arguments['room'];
|
||||
void Function()? onBack = Get.arguments['onBack'];
|
||||
|
||||
void loadMessages() {
|
||||
if (chatController.currentRoom.value!.messages.page < 2) {
|
||||
|
|
@ -88,6 +89,7 @@ class ChatDetails extends StatelessWidget {
|
|||
chatUser: room.user,
|
||||
roomType: room.type,
|
||||
avatar: room.user?.avatar,
|
||||
onBack: onBack,
|
||||
),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
|
|
|
|||
|
|
@ -19,8 +19,14 @@ class AppBarChatWidget extends StatelessWidget implements PreferredSizeWidget {
|
|||
final HomeController homeController = Get.find<HomeController>();
|
||||
final ChatController chatController = Get.find<ChatController>();
|
||||
final RoomType roomType;
|
||||
AppBarChatWidget(
|
||||
{super.key, required this.chatUser, this.avatar, required this.roomType});
|
||||
final void Function()? onBack;
|
||||
AppBarChatWidget({
|
||||
super.key,
|
||||
required this.chatUser,
|
||||
this.avatar,
|
||||
required this.roomType,
|
||||
this.onBack,
|
||||
});
|
||||
ChatUser? chatUser;
|
||||
final String? avatar;
|
||||
@override
|
||||
|
|
@ -41,7 +47,7 @@ class AppBarChatWidget extends StatelessWidget implements PreferredSizeWidget {
|
|||
if (roomType == RoomType.private) {
|
||||
chatController.updateRoom();
|
||||
}
|
||||
|
||||
onBack?.call();
|
||||
RoutingManager.back();
|
||||
},
|
||||
).expanded(Responsive.isTablet() ? 0 : 1),
|
||||
|
|
|
|||
|
|
@ -11,8 +11,13 @@ import 'package:taafee_mobile/features/chat/presentation_layer/widgets/circle_av
|
|||
import '../../data_layer/model/room.dart';
|
||||
|
||||
class ChatWidget extends StatelessWidget {
|
||||
ChatWidget({super.key, required this.room});
|
||||
ChatWidget({
|
||||
super.key,
|
||||
required this.room,
|
||||
this.onBack,
|
||||
});
|
||||
final Room room;
|
||||
final void Function()? onBack;
|
||||
final ChatController chatController = Get.find<ChatController>();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -63,7 +68,8 @@ class ChatWidget extends StatelessWidget {
|
|||
),
|
||||
).onTap(() {
|
||||
chatController.setCurrentRoom(room);
|
||||
RoutingManager.to(RouteName.chatDetails, arguments: room);
|
||||
RoutingManager.to(RouteName.chatDetails,
|
||||
arguments: {'room': room, 'onBack': onBack});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user