improvements

main_production_copilot
Sikander Saleem 24 hours 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/material.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/int_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/common_widgets/app_filled_button.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 'helper/chat_audio_player.dart';
@ -272,11 +274,7 @@ class _ChatPageState extends State<ChatPage> {
4.width,
Text(
"View All Documents",
style: AppTextStyles.bodyText.copyWith(
color: AppColor.white10,
decoration: TextDecoration.underline,
decorationColor: AppColor.white10
),
style: AppTextStyles.bodyText.copyWith(color: AppColor.white10, decoration: TextDecoration.underline, decorationColor: AppColor.white10),
).onPress(() {
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();
File? file = (await showModalBottomSheet(
context: context,
backgroundColor: AppColor.bottomSheetColor(context),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(20),
@ -396,7 +395,7 @@ class _ChatPageState extends State<ChatPage> {
style: const ButtonStyle(
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(),
),
IconButton(
@ -417,7 +416,7 @@ class _ChatPageState extends State<ChatPage> {
style: const ButtonStyle(
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(),
),
] 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}) {
String? userAvatar = Provider.of<UserProvider>(context, listen: false).user?.profilePhotoName;
Widget senderHeader = Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"${chatResponse?.currentUserName ?? "User"}(Me)",
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: AppTextStyles.bodyText.copyWith(color: AppColor.neutral50, fontWeight: FontWeight.w600),
).toShimmer(context: context, isShow: loading),
InfoTextLabelWidget(label: "${chatResponse?.currentUserName ?? "User"}(Me)").toShimmer(context: context, isShow: loading),
8.width,
Container(
height: 26,
width: 26,
decoration: const BoxDecoration(shape: BoxShape.circle, color: Colors.grey),
height: 36,
width: 36,
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),
],
);
@ -747,10 +750,13 @@ class _ChatPageState extends State<ChatPage> {
child: Container(
padding: const EdgeInsets.all(8),
margin: const EdgeInsets.only(right: 8, left: 26 + 8),
decoration: BoxDecoration(
color: loading ? Colors.transparent : AppColor.white10,
borderRadius: BorderRadius.circular(6),
),
decoration: loading
? null
: BoxDecoration(
color: AppColor.assetGroupBackground(context),
border: Border.all(color: AppColor.borderColor(context)),
borderRadius: BorderRadius.circular(12),
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
@ -798,13 +804,17 @@ class _ChatPageState extends State<ChatPage> {
] else
Text(
chatResponse?.contant ?? msg,
style: AppTextStyles.bodyText2.copyWith(color: AppColor.neutral120),
style: AppTextStyles.bodyText2.copyWith(color: AppColor.textColor(context)),
).toShimmer(context: context, isShow: loading),
if (loading) 4.height,
Text(
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),
// 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,
children: [
Container(
height: 26,
width: 26,
height: 36,
width: 36,
decoration: const BoxDecoration(shape: BoxShape.circle, color: Colors.grey),
).toShimmer(context: context, isShow: loading),
8.width,
Text(
chatResponse?.currentUserName ?? "User",
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: AppTextStyles.bodyText.copyWith(color: AppColor.neutral50, fontWeight: FontWeight.w600),
).toShimmer(context: context, isShow: loading)
InfoTextLabelWidget(label: chatResponse?.currentUserName ?? "User").toShimmer(context: context, isShow: loading),
// Text(
// chatResponse?.currentUserName ?? "User",
// overflow: TextOverflow.ellipsis,
// maxLines: 1,
// style: AppTextStyles.bodyText.copyWith(color: AppColor.neutral50, fontWeight: FontWeight.w600),
// )
],
);
@ -861,10 +872,13 @@ class _ChatPageState extends State<ChatPage> {
Container(
padding: const EdgeInsets.all(8),
margin: const EdgeInsets.only(left: 26 + 8, right: 26 + 8),
decoration: BoxDecoration(
color: loading ? Colors.transparent : AppColor.primary10,
borderRadius: BorderRadius.circular(6),
),
decoration: loading
? null
: BoxDecoration(
color: AppColor.background(context),
border: Border.all(color: AppColor.borderColor(context)),
borderRadius: BorderRadius.circular(12),
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
@ -874,7 +888,7 @@ class _ChatPageState extends State<ChatPage> {
] else
Text(
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),
if (loading) 4.height,
Align(
@ -882,7 +896,7 @@ class _ChatPageState extends State<ChatPage> {
widthFactor: 1,
child: Text(
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),
],

@ -55,7 +55,6 @@ class _ViewAllAttachmentPageState extends State<ViewAllAttachmentPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
// backgroundColor: AppColor.neutral100,
appBar: const DefaultAppBar(title: "Documents"),
body: FutureBuilder<List<ChatAttachment>>(
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));
} else {
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 {
widget = Image.asset(
"assets/images/${isPdf ? "pdf" : isExcel ? "excel" : "doc"}.png",
@ -135,52 +142,39 @@ class AttachmentFileViewer extends StatelessWidget {
if (snapshot.data == null) {
return Text("Failed to load", style: AppTextStyle.tiny.copyWith(color: context.isDark ? AppColor.red50 : AppColor.red60));
}
return Container(
decoration: BoxDecoration(
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(
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ClipRRect(borderRadius: BorderRadius.circular(8.0), child: widget),
12.width,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
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
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),
],
),
).onPress(() {
).toShadowContainer(context);
}
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) {
context.fullScreenImageViewer(Image.file(snapshot.data!));
} else {

Loading…
Cancel
Save