BASE: Update Icons & Name Of The App.
This commit is contained in:
@@ -11,7 +11,7 @@ import 'package:customer/utils/network_image_widget.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get.dart' hide Trans;
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import '../../../service/fire_store_utils.dart';
|
||||
@@ -33,13 +33,18 @@ class ChatScreen extends StatelessWidget {
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
backgroundColor:
|
||||
isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
centerTitle: false,
|
||||
titleSpacing: 0,
|
||||
title: Text(
|
||||
controller.restaurantName.value,
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.medium, fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900),
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontSize: 16,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Column(
|
||||
@@ -53,18 +58,28 @@ class ChatScreen extends StatelessWidget {
|
||||
controller: controller.scrollController,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
itemBuilder: (context, documentSnapshots, index) {
|
||||
ConversationModel inboxModel = ConversationModel.fromJson(documentSnapshots[index].data() as Map<String, dynamic>);
|
||||
return chatItemView(isDark, inboxModel.senderId == FireStoreUtils.getCurrentUid(), inboxModel);
|
||||
ConversationModel inboxModel = ConversationModel.fromJson(
|
||||
documentSnapshots[index].data() as Map<String, dynamic>,
|
||||
);
|
||||
return chatItemView(
|
||||
isDark,
|
||||
inboxModel.senderId == FireStoreUtils.getCurrentUid(),
|
||||
inboxModel,
|
||||
);
|
||||
},
|
||||
onEmpty: Constant.showEmptyView(message: "No Conversion found".tr()),
|
||||
onEmpty: Constant.showEmptyView(
|
||||
message: "No Conversion found".tr(),
|
||||
),
|
||||
// orderBy is compulsory to enable pagination
|
||||
query: FirebaseFirestore.instance
|
||||
.collection(
|
||||
controller.chatType.value == "Driver"
|
||||
? 'chat_driver'
|
||||
: controller.chatType.value == "Provider" || controller.chatType.value == "provider"
|
||||
: controller.chatType.value == "Provider" ||
|
||||
controller.chatType.value == "provider"
|
||||
? 'chat_provider'
|
||||
: controller.chatType.value == "worker" || controller.chatType.value == "Worker"
|
||||
: controller.chatType.value == "worker" ||
|
||||
controller.chatType.value == "Worker"
|
||||
? 'chat_worker'
|
||||
: 'chat_store',
|
||||
)
|
||||
@@ -79,7 +94,10 @@ class ChatScreen extends StatelessWidget {
|
||||
Container(
|
||||
color: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 10,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -90,7 +108,9 @@ class ChatScreen extends StatelessWidget {
|
||||
onTap: () {
|
||||
onCameraClick(context, controller);
|
||||
},
|
||||
child: SvgPicture.asset("assets/icons/ic_picture_one.svg"),
|
||||
child: SvgPicture.asset(
|
||||
"assets/icons/ic_picture_one.svg",
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Padding(
|
||||
@@ -98,18 +118,39 @@ class ChatScreen extends StatelessWidget {
|
||||
child: TextField(
|
||||
textInputAction: TextInputAction.send,
|
||||
keyboardType: TextInputType.text,
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
textCapitalization:
|
||||
TextCapitalization.sentences,
|
||||
controller: controller.messageController.value,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: const EdgeInsets.only(top: 3, left: 10),
|
||||
contentPadding: const EdgeInsets.only(
|
||||
top: 3,
|
||||
left: 10,
|
||||
),
|
||||
focusedBorder: InputBorder.none,
|
||||
enabledBorder: InputBorder.none,
|
||||
hintText: 'Type message here....'.tr(),
|
||||
),
|
||||
onSubmitted: (value) async {
|
||||
if (controller.messageController.value.text.isNotEmpty) {
|
||||
controller.sendMessage(controller.messageController.value.text, null, '', 'text');
|
||||
Timer(const Duration(milliseconds: 500), () => controller.scrollController.jumpTo(controller.scrollController.position.maxScrollExtent));
|
||||
if (controller
|
||||
.messageController
|
||||
.value
|
||||
.text
|
||||
.isNotEmpty) {
|
||||
controller.sendMessage(
|
||||
controller.messageController.value.text,
|
||||
null,
|
||||
'',
|
||||
'text',
|
||||
);
|
||||
Timer(
|
||||
const Duration(milliseconds: 500),
|
||||
() => controller.scrollController.jumpTo(
|
||||
controller
|
||||
.scrollController
|
||||
.position
|
||||
.maxScrollExtent,
|
||||
),
|
||||
);
|
||||
controller.messageController.value.clear();
|
||||
}
|
||||
},
|
||||
@@ -118,16 +159,36 @@ class ChatScreen extends StatelessWidget {
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
if (controller.messageController.value.text.isNotEmpty) {
|
||||
controller.sendMessage(controller.messageController.value.text, null, '', 'text');
|
||||
if (controller
|
||||
.messageController
|
||||
.value
|
||||
.text
|
||||
.isNotEmpty) {
|
||||
controller.sendMessage(
|
||||
controller.messageController.value.text,
|
||||
null,
|
||||
'',
|
||||
'text',
|
||||
);
|
||||
controller.messageController.value.clear();
|
||||
// Timer(const Duration(milliseconds: 500), () => controller.scrollController.jumpTo(controller.scrollController.position.maxScrollExtent));
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(left: 10),
|
||||
decoration: BoxDecoration(color: isDark ? AppThemeData.grey700 : AppThemeData.grey200, borderRadius: BorderRadius.circular(30)),
|
||||
child: Padding(padding: const EdgeInsets.all(10), child: SvgPicture.asset("assets/icons/ic_send.svg")),
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey700
|
||||
: AppThemeData.grey200,
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: SvgPicture.asset(
|
||||
"assets/icons/ic_send.svg",
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -157,23 +218,53 @@ class ChatScreen extends StatelessWidget {
|
||||
data.messageType == "text"
|
||||
? Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12), bottomLeft: Radius.circular(12)),
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(12),
|
||||
topRight: Radius.circular(12),
|
||||
bottomLeft: Radius.circular(12),
|
||||
),
|
||||
color: AppThemeData.primary300,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
child: Text(data.message.toString(), style: const TextStyle(fontFamily: AppThemeData.medium, fontSize: 16, color: AppThemeData.grey50)),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 10,
|
||||
),
|
||||
child: Text(
|
||||
data.message.toString(),
|
||||
style: const TextStyle(
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontSize: 16,
|
||||
color: AppThemeData.grey50,
|
||||
),
|
||||
),
|
||||
)
|
||||
: data.messageType == "image"
|
||||
? ClipRRect(
|
||||
borderRadius: const BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12), bottomLeft: Radius.circular(12)),
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(12),
|
||||
topRight: Radius.circular(12),
|
||||
bottomLeft: Radius.circular(12),
|
||||
),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.to(FullScreenImageViewer(imageUrl: data.url!.url));
|
||||
Get.to(
|
||||
FullScreenImageViewer(
|
||||
imageUrl: data.url!.url,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Hero(tag: data.url!.url, child: NetworkImageWidget(imageUrl: data.url!.url, height: 100, width: 100, fit: BoxFit.cover)),
|
||||
child: Hero(
|
||||
tag: data.url!.url,
|
||||
child: NetworkImageWidget(
|
||||
imageUrl: data.url!.url,
|
||||
height: 100,
|
||||
width: 100,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -183,13 +274,25 @@ class ChatScreen extends StatelessWidget {
|
||||
heroTag: data.id,
|
||||
backgroundColor: AppThemeData.primary300,
|
||||
onPressed: () {
|
||||
Get.to(FullScreenVideoViewer(heroTag: data.id.toString(), videoUrl: data.url!.url));
|
||||
Get.to(
|
||||
FullScreenVideoViewer(
|
||||
heroTag: data.id.toString(),
|
||||
videoUrl: data.url!.url,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: const Icon(Icons.play_arrow, color: Colors.white),
|
||||
child: const Icon(
|
||||
Icons.play_arrow,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
DateFormat('MMM d, yyyy hh:mm aa').format(DateTime.fromMillisecondsSinceEpoch(data.createdAt!.millisecondsSinceEpoch)),
|
||||
DateFormat('MMM d, yyyy hh:mm aa').format(
|
||||
DateTime.fromMillisecondsSinceEpoch(
|
||||
data.createdAt!.millisecondsSinceEpoch,
|
||||
),
|
||||
),
|
||||
style: const TextStyle(color: Colors.grey, fontSize: 12),
|
||||
),
|
||||
],
|
||||
@@ -201,25 +304,61 @@ class ChatScreen extends StatelessWidget {
|
||||
data.messageType == "text"
|
||||
? Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12), bottomRight: Radius.circular(12)),
|
||||
color: isDark ? AppThemeData.grey700 : AppThemeData.grey200,
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(12),
|
||||
topRight: Radius.circular(12),
|
||||
bottomRight: Radius.circular(12),
|
||||
),
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey700
|
||||
: AppThemeData.grey200,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 10,
|
||||
),
|
||||
child: Text(
|
||||
data.message.toString(),
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontSize: 16,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey100
|
||||
: AppThemeData.grey800,
|
||||
),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
child: Text(data.message.toString(), style: TextStyle(fontFamily: AppThemeData.medium, fontSize: 16, color: isDark ? AppThemeData.grey100 : AppThemeData.grey800)),
|
||||
)
|
||||
: data.messageType == "image"
|
||||
? ConstrainedBox(
|
||||
constraints: const BoxConstraints(minWidth: 50, maxWidth: 200),
|
||||
constraints: const BoxConstraints(
|
||||
minWidth: 50,
|
||||
maxWidth: 200,
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: const BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12), bottomRight: Radius.circular(12)),
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(12),
|
||||
topRight: Radius.circular(12),
|
||||
bottomRight: Radius.circular(12),
|
||||
),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.to(FullScreenImageViewer(imageUrl: data.url!.url));
|
||||
Get.to(
|
||||
FullScreenImageViewer(
|
||||
imageUrl: data.url!.url,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Hero(tag: data.url!.url, child: NetworkImageWidget(imageUrl: data.url!.url)),
|
||||
child: Hero(
|
||||
tag: data.url!.url,
|
||||
child: NetworkImageWidget(
|
||||
imageUrl: data.url!.url,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -230,13 +369,25 @@ class ChatScreen extends StatelessWidget {
|
||||
heroTag: data.id,
|
||||
backgroundColor: AppThemeData.primary300,
|
||||
onPressed: () {
|
||||
Get.to(FullScreenVideoViewer(heroTag: data.id.toString(), videoUrl: data.url!.url));
|
||||
Get.to(
|
||||
FullScreenVideoViewer(
|
||||
heroTag: data.id.toString(),
|
||||
videoUrl: data.url!.url,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: const Icon(Icons.play_arrow, color: Colors.white),
|
||||
child: const Icon(
|
||||
Icons.play_arrow,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
DateFormat('MMM d, yyyy hh:mm aa').format(DateTime.fromMillisecondsSinceEpoch(data.createdAt!.millisecondsSinceEpoch)),
|
||||
DateFormat('MMM d, yyyy hh:mm aa').format(
|
||||
DateTime.fromMillisecondsSinceEpoch(
|
||||
data.createdAt!.millisecondsSinceEpoch,
|
||||
),
|
||||
),
|
||||
style: const TextStyle(color: Colors.grey, fontSize: 12),
|
||||
),
|
||||
],
|
||||
@@ -252,9 +403,14 @@ class ChatScreen extends StatelessWidget {
|
||||
isDefaultAction: false,
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
XFile? image = await controller.imagePicker.pickImage(source: ImageSource.gallery);
|
||||
XFile? image = await controller.imagePicker.pickImage(
|
||||
source: ImageSource.gallery,
|
||||
);
|
||||
if (image != null) {
|
||||
Url url = await FireStoreUtils.uploadChatImageToFireStorage(File(image.path), context);
|
||||
Url url = await FireStoreUtils.uploadChatImageToFireStorage(
|
||||
File(image.path),
|
||||
context,
|
||||
);
|
||||
controller.sendMessage('', url, '', 'image');
|
||||
}
|
||||
},
|
||||
@@ -264,11 +420,22 @@ class ChatScreen extends StatelessWidget {
|
||||
isDefaultAction: false,
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
XFile? galleryVideo = await controller.imagePicker.pickVideo(source: ImageSource.gallery);
|
||||
XFile? galleryVideo = await controller.imagePicker.pickVideo(
|
||||
source: ImageSource.gallery,
|
||||
);
|
||||
if (galleryVideo != null) {
|
||||
ChatVideoContainer? videoContainer = await FireStoreUtils.uploadChatVideoToFireStorage(context, File(galleryVideo.path));
|
||||
ChatVideoContainer? videoContainer =
|
||||
await FireStoreUtils.uploadChatVideoToFireStorage(
|
||||
context,
|
||||
File(galleryVideo.path),
|
||||
);
|
||||
if (videoContainer != null) {
|
||||
controller.sendMessage('', videoContainer.videoUrl, videoContainer.thumbnailUrl, 'video');
|
||||
controller.sendMessage(
|
||||
'',
|
||||
videoContainer.videoUrl,
|
||||
videoContainer.thumbnailUrl,
|
||||
'video',
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -278,9 +445,14 @@ class ChatScreen extends StatelessWidget {
|
||||
isDestructiveAction: false,
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
XFile? image = await controller.imagePicker.pickImage(source: ImageSource.camera);
|
||||
XFile? image = await controller.imagePicker.pickImage(
|
||||
source: ImageSource.camera,
|
||||
);
|
||||
if (image != null) {
|
||||
Url url = await FireStoreUtils.uploadChatImageToFireStorage(File(image.path), context);
|
||||
Url url = await FireStoreUtils.uploadChatImageToFireStorage(
|
||||
File(image.path),
|
||||
context,
|
||||
);
|
||||
controller.sendMessage('', url, '', 'image');
|
||||
}
|
||||
},
|
||||
|
||||
@@ -7,8 +7,7 @@ import 'package:customer/themes/responsive.dart';
|
||||
import 'package:customer/utils/network_image_widget.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:get/get.dart' hide Trans;
|
||||
import '../../../controllers/theme_controller.dart';
|
||||
import '../../../service/fire_store_utils.dart';
|
||||
import '../../../themes/show_toast_dialog.dart';
|
||||
@@ -25,10 +24,19 @@ class DriverInboxScreen extends StatelessWidget {
|
||||
final isDark = themeController.isDark.value;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
backgroundColor:
|
||||
isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
centerTitle: false,
|
||||
titleSpacing: 0,
|
||||
title: Text("Driver Inbox".tr(), textAlign: TextAlign.start, style: TextStyle(fontFamily: AppThemeData.medium, fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900)),
|
||||
title: Text(
|
||||
"Driver Inbox".tr(),
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontSize: 16,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
),
|
||||
),
|
||||
),
|
||||
body: FirestorePagination(
|
||||
//item builder type is compulsory.
|
||||
@@ -40,8 +48,12 @@ class DriverInboxScreen extends StatelessWidget {
|
||||
onTap: () async {
|
||||
ShowToastDialog.showLoader("Please wait...".tr());
|
||||
|
||||
UserModel? customer = await FireStoreUtils.getUserProfile(inboxModel.customerId.toString());
|
||||
UserModel? restaurantUser = await FireStoreUtils.getUserProfile(inboxModel.restaurantId.toString());
|
||||
UserModel? customer = await FireStoreUtils.getUserProfile(
|
||||
inboxModel.customerId.toString(),
|
||||
);
|
||||
UserModel? restaurantUser = await FireStoreUtils.getUserProfile(
|
||||
inboxModel.restaurantId.toString(),
|
||||
);
|
||||
ShowToastDialog.closeLoader();
|
||||
|
||||
Get.to(
|
||||
@@ -62,15 +74,23 @@ class DriverInboxScreen extends StatelessWidget {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 5),
|
||||
child: Container(
|
||||
decoration: ShapeDecoration(color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8))),
|
||||
decoration: ShapeDecoration(
|
||||
color: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10),
|
||||
),
|
||||
child: NetworkImageWidget(
|
||||
imageUrl: inboxModel.restaurantProfileImage.toString(),
|
||||
imageUrl:
|
||||
inboxModel.restaurantProfileImage.toString(),
|
||||
fit: BoxFit.cover,
|
||||
height: Responsive.height(6, context),
|
||||
width: Responsive.width(12, context),
|
||||
@@ -87,13 +107,29 @@ class DriverInboxScreen extends StatelessWidget {
|
||||
child: Text(
|
||||
"${inboxModel.restaurantName}",
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.semiBold, fontSize: 16, color: isDark ? AppThemeData.grey100 : AppThemeData.grey800),
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
fontSize: 16,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey100
|
||||
: AppThemeData.grey800,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
Constant.timestampToDate(inboxModel.createdAt!),
|
||||
Constant.timestampToDate(
|
||||
inboxModel.createdAt!,
|
||||
),
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.regular, fontSize: 16, color: isDark ? AppThemeData.grey400 : AppThemeData.grey500),
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.regular,
|
||||
fontSize: 16,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey400
|
||||
: AppThemeData.grey500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -101,7 +137,14 @@ class DriverInboxScreen extends StatelessWidget {
|
||||
Text(
|
||||
"${inboxModel.lastMessage}",
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.medium, fontSize: 14, color: isDark ? AppThemeData.grey200 : AppThemeData.grey700),
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontSize: 14,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey200
|
||||
: AppThemeData.grey700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -116,7 +159,10 @@ class DriverInboxScreen extends StatelessWidget {
|
||||
shrinkWrap: true,
|
||||
onEmpty: Constant.showEmptyView(message: "No Conversion found".tr()),
|
||||
// orderBy is compulsory to enable pagination
|
||||
query: FirebaseFirestore.instance.collection('chat_driver').where("customerId", isEqualTo: FireStoreUtils.getCurrentUid()).orderBy('createdAt', descending: true),
|
||||
query: FirebaseFirestore.instance
|
||||
.collection('chat_driver')
|
||||
.where("customerId", isEqualTo: FireStoreUtils.getCurrentUid())
|
||||
.orderBy('createdAt', descending: true),
|
||||
//Change types customerId
|
||||
viewType: ViewType.list,
|
||||
initialLoader: Constant.loader(),
|
||||
|
||||
@@ -10,8 +10,7 @@ import 'package:customer/widget/firebase_pagination/src/fireStore_pagination.dar
|
||||
import 'package:customer/widget/firebase_pagination/src/models/view_type.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:get/get.dart' hide Trans;
|
||||
import '../../../controllers/theme_controller.dart';
|
||||
import '../../../service/fire_store_utils.dart';
|
||||
import '../../../themes/show_toast_dialog.dart';
|
||||
@@ -26,10 +25,19 @@ class RestaurantInboxScreen extends StatelessWidget {
|
||||
final isDark = themeController.isDark.value;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
backgroundColor:
|
||||
isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
centerTitle: false,
|
||||
titleSpacing: 0,
|
||||
title: Text("Store Inbox".tr(), textAlign: TextAlign.start, style: TextStyle(fontFamily: AppThemeData.medium, fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900)),
|
||||
title: Text(
|
||||
"Store Inbox".tr(),
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontSize: 16,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
),
|
||||
),
|
||||
),
|
||||
body: FirestorePagination(
|
||||
//item builder type is compulsory.
|
||||
@@ -41,9 +49,15 @@ class RestaurantInboxScreen extends StatelessWidget {
|
||||
onTap: () async {
|
||||
ShowToastDialog.showLoader("Please wait...".tr());
|
||||
|
||||
UserModel? customer = await FireStoreUtils.getUserProfile(inboxModel.customerId.toString());
|
||||
UserModel? restaurantUser = await FireStoreUtils.getUserProfile(inboxModel.restaurantId.toString());
|
||||
VendorModel? vendorModel = await FireStoreUtils.getVendorById(restaurantUser!.vendorID.toString());
|
||||
UserModel? customer = await FireStoreUtils.getUserProfile(
|
||||
inboxModel.customerId.toString(),
|
||||
);
|
||||
UserModel? restaurantUser = await FireStoreUtils.getUserProfile(
|
||||
inboxModel.restaurantId.toString(),
|
||||
);
|
||||
VendorModel? vendorModel = await FireStoreUtils.getVendorById(
|
||||
restaurantUser!.vendorID.toString(),
|
||||
);
|
||||
ShowToastDialog.closeLoader();
|
||||
|
||||
Get.to(
|
||||
@@ -64,15 +78,23 @@ class RestaurantInboxScreen extends StatelessWidget {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 5),
|
||||
child: Container(
|
||||
decoration: ShapeDecoration(color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8))),
|
||||
decoration: ShapeDecoration(
|
||||
color: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10),
|
||||
),
|
||||
child: NetworkImageWidget(
|
||||
imageUrl: inboxModel.restaurantProfileImage.toString(),
|
||||
imageUrl:
|
||||
inboxModel.restaurantProfileImage.toString(),
|
||||
fit: BoxFit.cover,
|
||||
height: Responsive.height(6, context),
|
||||
width: Responsive.width(12, context),
|
||||
@@ -89,13 +111,29 @@ class RestaurantInboxScreen extends StatelessWidget {
|
||||
child: Text(
|
||||
"${inboxModel.restaurantName}",
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.semiBold, fontSize: 16, color: isDark ? AppThemeData.grey100 : AppThemeData.grey800),
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
fontSize: 16,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey100
|
||||
: AppThemeData.grey800,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
Constant.timestampToDate(inboxModel.createdAt!),
|
||||
Constant.timestampToDate(
|
||||
inboxModel.createdAt!,
|
||||
),
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.regular, fontSize: 16, color: isDark ? AppThemeData.grey400 : AppThemeData.grey500),
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.regular,
|
||||
fontSize: 16,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey400
|
||||
: AppThemeData.grey500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -103,7 +141,14 @@ class RestaurantInboxScreen extends StatelessWidget {
|
||||
Text(
|
||||
"${inboxModel.lastMessage}",
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.medium, fontSize: 14, color: isDark ? AppThemeData.grey200 : AppThemeData.grey700),
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontSize: 14,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey200
|
||||
: AppThemeData.grey700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -118,7 +163,10 @@ class RestaurantInboxScreen extends StatelessWidget {
|
||||
shrinkWrap: true,
|
||||
onEmpty: Constant.showEmptyView(message: "No Conversion found".tr()),
|
||||
// orderBy is compulsory to enable pagination
|
||||
query: FirebaseFirestore.instance.collection('chat_store').where("customerId", isEqualTo: FireStoreUtils.getCurrentUid()).orderBy('createdAt', descending: true),
|
||||
query: FirebaseFirestore.instance
|
||||
.collection('chat_store')
|
||||
.where("customerId", isEqualTo: FireStoreUtils.getCurrentUid())
|
||||
.orderBy('createdAt', descending: true),
|
||||
//Change types customerId
|
||||
viewType: ViewType.list,
|
||||
initialLoader: Constant.loader(),
|
||||
|
||||
Reference in New Issue
Block a user