improvements

main_production_copilot
Sikander Saleem 3 weeks ago
parent 124156c6a9
commit 5e71e65264

@ -7,6 +7,7 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:test_sa/controllers/providers/api/user_provider.dart';
import 'package:test_sa/extensions/context_extension.dart'; import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart'; import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/string_extensions.dart'; import 'package:test_sa/extensions/string_extensions.dart';
@ -22,6 +23,7 @@ import 'package:test_sa/modules/cx_module/chat/view_all_attachment_page.dart';
import 'package:test_sa/new_views/app_style/app_color.dart'; import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart'; import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart'; import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
import 'package:test_sa/views/widgets/item_views/info_text_widget.dart';
import 'package:test_sa/views/widgets/sound/sound_player.dart'; import 'package:test_sa/views/widgets/sound/sound_player.dart';
import 'helper/chat_audio_player.dart'; import 'helper/chat_audio_player.dart';
@ -272,11 +274,7 @@ class _ChatPageState extends State<ChatPage> {
4.width, 4.width,
Text( Text(
"View All Documents", "View All Documents",
style: AppTextStyles.bodyText.copyWith( style: AppTextStyles.bodyText.copyWith(color: AppColor.white10, decoration: TextDecoration.underline, decorationColor: AppColor.white10),
color: AppColor.white10,
decoration: TextDecoration.underline,
decorationColor: AppColor.white10
),
).onPress(() { ).onPress(() {
Navigator.push(context, CupertinoPageRoute(builder: (context) => ViewAllAttachmentPage(moduleId: widget.moduleId, requestId: widget.requestId))); Navigator.push(context, CupertinoPageRoute(builder: (context) => ViewAllAttachmentPage(moduleId: widget.moduleId, requestId: widget.requestId)));
}), }),
@ -380,6 +378,7 @@ class _ChatPageState extends State<ChatPage> {
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
File? file = (await showModalBottomSheet( File? file = (await showModalBottomSheet(
context: context, context: context,
backgroundColor: AppColor.bottomSheetColor(context),
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical( borderRadius: BorderRadius.vertical(
top: Radius.circular(20), top: Radius.circular(20),
@ -396,7 +395,7 @@ class _ChatPageState extends State<ChatPage> {
style: const ButtonStyle( style: const ButtonStyle(
tapTargetSize: MaterialTapTargetSize.shrinkWrap, // or .padded tapTargetSize: MaterialTapTargetSize.shrinkWrap, // or .padded
), ),
icon: "chat_attachment".toSvgAsset(width: 24, height: 24,color: AppColor.icon2Color(context)), icon: "chat_attachment".toSvgAsset(width: 24, height: 24, color: AppColor.icon2Color(context)),
constraints: const BoxConstraints(), constraints: const BoxConstraints(),
), ),
IconButton( IconButton(
@ -417,7 +416,7 @@ class _ChatPageState extends State<ChatPage> {
style: const ButtonStyle( style: const ButtonStyle(
tapTargetSize: MaterialTapTargetSize.shrinkWrap, // or .padded tapTargetSize: MaterialTapTargetSize.shrinkWrap, // or .padded
), ),
icon: "chat_mic".toSvgAsset(width: 24, height: 24,color: AppColor.icon2Color(context)), icon: "chat_mic".toSvgAsset(width: 24, height: 24, color: AppColor.icon2Color(context)),
constraints: const BoxConstraints(), constraints: const BoxConstraints(),
), ),
] else if (chatState == ChatState.voiceRecordingStarted) ...[ ] else if (chatState == ChatState.voiceRecordingStarted) ...[
@ -713,20 +712,24 @@ class _ChatPageState extends State<ChatPage> {
} }
Widget senderMsgCard(bool showHeader, SingleUserChatModel? chatResponse, {bool loading = false, String msg = "", int index = 0}) { Widget senderMsgCard(bool showHeader, SingleUserChatModel? chatResponse, {bool loading = false, String msg = "", int index = 0}) {
String? userAvatar = Provider.of<UserProvider>(context, listen: false).user?.profilePhotoName;
Widget senderHeader = Row( Widget senderHeader = Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Text( InfoTextLabelWidget(label: "${chatResponse?.currentUserName ?? "User"}(Me)").toShimmer(context: context, isShow: loading),
"${chatResponse?.currentUserName ?? "User"}(Me)",
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: AppTextStyles.bodyText.copyWith(color: AppColor.neutral50, fontWeight: FontWeight.w600),
).toShimmer(context: context, isShow: loading),
8.width, 8.width,
Container( Container(
height: 26, height: 36,
width: 26, width: 36,
decoration: const BoxDecoration(shape: BoxShape.circle, color: Colors.grey), padding: const EdgeInsets.all(4),
decoration: BoxDecoration(color: AppColor.background(context), shape: BoxShape.circle, border: Border.all(color: Colors.transparent)),
child: userAvatar != null
? ClipOval(child: Image.network(userAvatar!, width: 14, height: 14))
: Icon(
Icons.person,
size: 16,
color: AppColor.icon2Color(context),
),
).toShimmer(context: context, isShow: loading), ).toShimmer(context: context, isShow: loading),
], ],
); );
@ -747,10 +750,13 @@ class _ChatPageState extends State<ChatPage> {
child: Container( child: Container(
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
margin: const EdgeInsets.only(right: 8, left: 26 + 8), margin: const EdgeInsets.only(right: 8, left: 26 + 8),
decoration: BoxDecoration( decoration: loading
color: loading ? Colors.transparent : AppColor.white10, ? null
borderRadius: BorderRadius.circular(6), : BoxDecoration(
), color: AppColor.assetGroupBackground(context),
border: Border.all(color: AppColor.borderColor(context)),
borderRadius: BorderRadius.circular(12),
),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
@ -798,13 +804,17 @@ class _ChatPageState extends State<ChatPage> {
] else ] else
Text( Text(
chatResponse?.contant ?? msg, chatResponse?.contant ?? msg,
style: AppTextStyles.bodyText2.copyWith(color: AppColor.neutral120), style: AppTextStyles.bodyText2.copyWith(color: AppColor.textColor(context)),
).toShimmer(context: context, isShow: loading), ).toShimmer(context: context, isShow: loading),
if (loading) 4.height, if (loading) 4.height,
Text( Text(
chatResponse?.createdDate?.toString().chatMsgTime ?? "2:00 PM", chatResponse?.createdDate?.toString().chatMsgTime ?? "2:00 PM",
style: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.neutral50.withOpacity(0.5)), style: AppTextStyles.bodyText2.copyWith(color: AppColor.textColor(context)),
).toShimmer(context: context, isShow: loading), ).toShimmer(context: context, isShow: loading),
// Text(
// chatResponse?.createdDate?.toString().chatMsgTime ?? "2:00 PM",
// style: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.neutral50.withOpacity(0.5)),
// ).toShimmer(context: context, isShow: loading),
], ],
)), )),
), ),
@ -837,17 +847,18 @@ class _ChatPageState extends State<ChatPage> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Container( Container(
height: 26, height: 36,
width: 26, width: 36,
decoration: const BoxDecoration(shape: BoxShape.circle, color: Colors.grey), decoration: const BoxDecoration(shape: BoxShape.circle, color: Colors.grey),
).toShimmer(context: context, isShow: loading), ).toShimmer(context: context, isShow: loading),
8.width, 8.width,
Text( InfoTextLabelWidget(label: chatResponse?.currentUserName ?? "User").toShimmer(context: context, isShow: loading),
chatResponse?.currentUserName ?? "User", // Text(
overflow: TextOverflow.ellipsis, // chatResponse?.currentUserName ?? "User",
maxLines: 1, // overflow: TextOverflow.ellipsis,
style: AppTextStyles.bodyText.copyWith(color: AppColor.neutral50, fontWeight: FontWeight.w600), // maxLines: 1,
).toShimmer(context: context, isShow: loading) // style: AppTextStyles.bodyText.copyWith(color: AppColor.neutral50, fontWeight: FontWeight.w600),
// )
], ],
); );
@ -861,10 +872,13 @@ class _ChatPageState extends State<ChatPage> {
Container( Container(
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
margin: const EdgeInsets.only(left: 26 + 8, right: 26 + 8), margin: const EdgeInsets.only(left: 26 + 8, right: 26 + 8),
decoration: BoxDecoration( decoration: loading
color: loading ? Colors.transparent : AppColor.primary10, ? null
borderRadius: BorderRadius.circular(6), : BoxDecoration(
), color: AppColor.background(context),
border: Border.all(color: AppColor.borderColor(context)),
borderRadius: BorderRadius.circular(12),
),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
@ -874,7 +888,7 @@ class _ChatPageState extends State<ChatPage> {
] else ] else
Text( Text(
contentMsg, contentMsg,
style: AppTextStyles.bodyText2.copyWith(color: AppColor.white10), style: AppTextStyles.bodyText2.copyWith(color: AppColor.textStyleColor(context)),
).paddingOnly(end: 6 * length).toShimmer(context: context, isShow: loading), ).paddingOnly(end: 6 * length).toShimmer(context: context, isShow: loading),
if (loading) 4.height, if (loading) 4.height,
Align( Align(
@ -882,7 +896,7 @@ class _ChatPageState extends State<ChatPage> {
widthFactor: 1, widthFactor: 1,
child: Text( child: Text(
chatResponse?.createdDate?.toString().chatMsgTime ?? "2:00 PM", chatResponse?.createdDate?.toString().chatMsgTime ?? "2:00 PM",
style: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.white10), style: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
), ),
).toShimmer(context: context, isShow: loading), ).toShimmer(context: context, isShow: loading),
], ],

@ -55,7 +55,6 @@ class _ViewAllAttachmentPageState extends State<ViewAllAttachmentPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
// backgroundColor: AppColor.neutral100,
appBar: const DefaultAppBar(title: "Documents"), appBar: const DefaultAppBar(title: "Documents"),
body: FutureBuilder<List<ChatAttachment>>( body: FutureBuilder<List<ChatAttachment>>(
future: viewAllDocuments(widget.moduleId, widget.requestId), future: viewAllDocuments(widget.moduleId, widget.requestId),
@ -122,7 +121,15 @@ class AttachmentFileViewer extends StatelessWidget {
widget = const SizedBox(width: 24, height: 24, child: CircularProgressIndicator(color: AppColor.primary10, strokeWidth: 2)); widget = const SizedBox(width: 24, height: 24, child: CircularProgressIndicator(color: AppColor.primary10, strokeWidth: 2));
} else { } else {
if (isImage) { if (isImage) {
widget = Image.file(snapshot.data!, width: 48, height: 48, fit: BoxFit.contain); widget = Image.file(
snapshot.data!,
width: 48,
height: 48,
fit: BoxFit.contain,
errorBuilder: (context, error, stackTrace) {
return const Icon(Icons.broken_image, size: 48);
},
);
} else { } else {
widget = Image.asset( widget = Image.asset(
"assets/images/${isPdf ? "pdf" : isExcel ? "excel" : "doc"}.png", "assets/images/${isPdf ? "pdf" : isExcel ? "excel" : "doc"}.png",
@ -135,52 +142,39 @@ class AttachmentFileViewer extends StatelessWidget {
if (snapshot.data == null) { if (snapshot.data == null) {
return Text("Failed to load", style: AppTextStyle.tiny.copyWith(color: context.isDark ? AppColor.red50 : AppColor.red60)); return Text("Failed to load", style: AppTextStyle.tiny.copyWith(color: context.isDark ? AppColor.red50 : AppColor.red60));
} }
return Container( return Column(
decoration: BoxDecoration( crossAxisAlignment: CrossAxisAlignment.start,
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
padding: const EdgeInsets.all(8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ASoundPlayer(audio: snapshot.data!.path),
4.height,
Text(
chatAttachment.createdOn!.toServiceRequestDetailsFormat,
style: AppTextStyles.textFieldLabelStyle.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
).paddingOnly(start: 60),
],
));
}
return Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
padding: const EdgeInsets.all(8),
child: Row(
children: [ children: [
ClipRRect(borderRadius: BorderRadius.circular(8.0), child: widget), ASoundPlayer(audio: snapshot.data!.path),
12.width, 4.height,
Column( Text(
crossAxisAlignment: CrossAxisAlignment.start, chatAttachment.createdOn!.toServiceRequestDetailsFormat,
children: [ style: AppTextStyles.textFieldLabelStyle.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
Text( ).paddingOnly(start: 60),
chatAttachment.storedFileName!,
style: AppTextStyles.textFieldLabelStyle.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
4.height,
Text(
chatAttachment.createdOn!.toServiceRequestDetailsFormat,
style: AppTextStyles.textFieldLabelStyle.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
],
).expanded
], ],
), ).toShadowContainer(context);
).onPress(() { }
return Row(
children: [
ClipRRect(borderRadius: BorderRadius.circular(8.0), child: widget),
12.width,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
chatAttachment.storedFileName!,
style: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.labelTextStyleColor(context)),
),
4.height,
Text(
chatAttachment.createdOn!.toServiceRequestDetailsFormat,
style: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.labelTextStyleColor(context)),
),
],
).expanded
],
).toShadowContainer(context).onPress(() {
if (isImage) { if (isImage) {
context.fullScreenImageViewer(Image.file(snapshot.data!)); context.fullScreenImageViewer(Image.file(snapshot.data!));
} else { } else {

Loading…
Cancel
Save