Added Images support in ReqChat

aamir_dev
Faiz Hashmi 1 year ago
parent ff22d2837d
commit 5ed15fa243

@ -71,7 +71,10 @@ Future<void> main() async {
),
),
ChangeNotifierProvider<UserVM>(
create: (_) => UserVM(userRepo: injector.get<UserRepo>(), commanServices: injector.get<CommonAppServices>()),
create: (_) => UserVM(
userRepo: injector.get<UserRepo>(),
commanServices: injector.get<CommonAppServices>(),
),
),
// ChangeNotifierProvider<BranchVM>(
@ -128,10 +131,14 @@ Future<void> main() async {
create: (_) => ChatVM(
chatRepo: injector.get<ChatRepo>(),
requestRepo: injector.get<RequestRepo>(),
commonServices: injector.get<CommonAppServices>(),
),
),
ChangeNotifierProvider<PaymentVM>(
create: (_) => PaymentVM(paymentService: injector.get<PaymentService>(), paymentRepo: injector.get<PaymentsRepo>()),
create: (_) => PaymentVM(
paymentService: injector.get<PaymentService>(),
paymentRepo: injector.get<PaymentsRepo>(),
),
),
],
child: const MyApp(),

@ -40,8 +40,7 @@ class AppointmentDetailListPage extends StatelessWidget {
onTap: () {
appointmentsVM.selectedAppointmentId = appointmentsVM.myFilteredAppointments2[appointmentsVM.selectedAppointmentIndex].customerAppointmentList![index].id ?? 0;
appointmentsVM.selectedAppointmentSubIndex = index;
navigateWithName(context, ProviderAppRoutes.updateAppointmentPage,
arguments: appointmentsVM.myFilteredAppointments2[appointmentsVM.selectedAppointmentIndex].customerAppointmentList![index]);
navigateWithName(context, ProviderAppRoutes.updateAppointmentPage, arguments: appointmentsVM.myFilteredAppointments2[appointmentsVM.selectedAppointmentIndex].customerAppointmentList![index]);
},
);
},
@ -63,7 +62,7 @@ class AppointmentDetailListPage extends StatelessWidget {
navigateWithName(context, ProviderAppRoutes.mergeAppointments);
},
)
: SizedBox(),
: const SizedBox(),
],
)),
);

@ -14,6 +14,7 @@ import 'package:mc_common_app/utils/navigator.dart';
import 'package:mc_common_app/utils/utils.dart';
import 'package:mc_common_app/view_models/appointments_view_model.dart';
import 'package:mc_common_app/widgets/common_widgets/categories_list.dart';
import 'package:mc_common_app/widgets/empty_widget.dart';
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
import 'package:flutter/material.dart';
import 'package:mc_common_app/classes/consts.dart';
@ -99,9 +100,9 @@ class _AppointmentPageState extends State<AppointmentPage> {
},
),
if (appointmentsVM.myFilteredAppointments2.isEmpty)
Padding(
padding: const EdgeInsets.symmetric(vertical: 12),
child: LocaleKeys.noAppointmentFound.tr().toText(),
EmptyWidget(
spacerWidget: const SizedBox(height: 25),
text: LocaleKeys.noAppointmentFound.tr(),
),
ListView.separated(
itemBuilder: (context, index) {

@ -2,10 +2,12 @@ import 'package:flutter/material.dart';
import 'package:mc_common_app/classes/consts.dart';
import 'package:mc_common_app/extensions/int_extensions.dart';
import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/models/appointments_models/appointment_list_model.dart';
import 'package:mc_common_app/theme/colors.dart';
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:easy_localization/easy_localization.dart';
class GeneralAppointmentWidget extends StatelessWidget {
final AppointmentListModel appointmentListModel;
@ -127,7 +129,7 @@ class GeneralAppointmentWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (isNeedToShowMergeStatus)
"Appointment Merged".toText(color: MyColors.white).toContainer(
"${LocaleKeys.merged.tr()}".toText(color: MyColors.white).toContainer(
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 3),
borderRadius: 12,
backgroundColor: MyColors.greenColor,
@ -149,7 +151,7 @@ class GeneralAppointmentWidget extends StatelessWidget {
(appointmentListModel.customerName ?? "").toText(color: MyColors.black, isBold: true, fontSize: 16),
Row(
children: [
"Phone:".toText(
"${LocaleKeys.phone.tr()}:".toText(
color: MyColors.lightTextColor,
),
2.width,
@ -162,38 +164,39 @@ class GeneralAppointmentWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
"Appt. On:".toText(
"${LocaleKeys.time.tr()}:".toText(
color: MyColors.lightTextColor,
),
4.width,
Flexible(child: (appointmentListModel.duration ?? "").toText(fontSize: 8))
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
"${LocaleKeys.date.tr()}:".toText(
color: MyColors.lightTextColor,
),
4.width,
Flexible(child: appointmentListModel.appointmentDate!.toFormattedDateWithoutTime().toText(fontSize: 8))
],
),
Row(
children: [
"${LocaleKeys.location.tr()}: ".toText(color: MyColors.lightTextColor),
2.width,
Expanded(
child: "${appointmentListModel.duration ?? ""} ${appointmentListModel.appointmentDate!.toFormattedDateWithoutTime()}".toText(
fontSize: 12,
),
(appointmentListModel.appointmentType == 1 ? LocaleKeys.home.tr() : LocaleKeys.workshop.tr()).toText(
fontSize: 12,
),
],
),
// Row(
// children: [
// "Location: ".toText(
// color: MyColors.lightTextColor,
// ),
// 2.width,
// appointmentListModel.appointmentType.toString().toText(
// fontSize: 12,
// ),
// ],
// ),
],
),
),
if (!isNeedTotalPayment)
if (appointmentListModel.customerAppointmentList!.length > 1)
"${appointmentListModel.customerAppointmentList!.length - 1}+ Appointments"
.toText(
fontSize: 8,
)
.toContainer(
"${appointmentListModel.customerAppointmentList!.length - 1}+ Appointments".toText(fontSize: 8).toContainer(
borderRadius: 15,
backgroundColor: MyColors.lightGreyEAColor,
padding: const EdgeInsets.symmetric(
@ -223,21 +226,18 @@ class GeneralAppointmentWidget extends StatelessWidget {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
24.height,
"Total Amount".toText(
fontSize: 12,
color: MyColors.lightTextColor,
isBold: true,
),
18.height,
LocaleKeys.totalAmount.tr().toText(
fontSize: 12,
color: MyColors.lightTextColor,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
appointmentListModel.totalAmount.toString().toText(fontSize: 16, isBold: true),
2.width,
"SAR:".toText(
color: MyColors.lightTextColor,
),
LocaleKeys.sar.tr().toText(color: MyColors.lightTextColor),
],
),
],
@ -246,20 +246,17 @@ class GeneralAppointmentWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
2.height,
"Remaining Amount".toText(
fontSize: 12,
color: MyColors.lightTextColor,
isBold: true,
),
LocaleKeys.remainingAmount.tr().toText(
fontSize: 12,
color: MyColors.lightTextColor,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
appointmentListModel.remainingAmount.toString().toText(fontSize: 16, isBold: true),
2.width,
"SAR:".toText(
color: MyColors.lightTextColor,
),
LocaleKeys.sar.tr().toText(color: MyColors.lightTextColor),
],
),
],
@ -269,10 +266,7 @@ class GeneralAppointmentWidget extends StatelessWidget {
],
),
),
if (!isNeedToShowItems)
const Icon(
Icons.arrow_forward,
),
if (!isNeedToShowItems) const Icon(Icons.arrow_forward),
],
),
],

@ -1,6 +1,4 @@
import 'dart:convert';
import 'package:mc_common_app/models/general_models/generic_resp_model.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/view_models/service_view_model.dart';
import 'package:car_provider_app/views/settings/services/duplication/sheet/approved_branches_list_sheet.dart';
import 'package:car_provider_app/views/settings/services/duplication/sheet/items_selection_sheet.dart';
@ -11,7 +9,6 @@ import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mc_common_app/models/services_models/item_model.dart';
import 'package:mc_common_app/theme/colors.dart';
import 'package:mc_common_app/utils/navigator.dart';
import 'package:mc_common_app/utils/utils.dart';
import 'package:mc_common_app/widgets/bottom_sheet.dart';
import 'package:mc_common_app/widgets/button/show_fill_button.dart';
@ -20,6 +17,7 @@ import 'package:mc_common_app/widgets/dropdown/dropdown_text.dart';
import 'package:mc_common_app/widgets/empty_widget.dart';
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
import 'package:provider/provider.dart';
import 'package:easy_localization/easy_localization.dart';
class MatchedServicesPage extends StatefulWidget {
final MatchServicesArguments? matchServicesArguments;
@ -47,8 +45,8 @@ class _MatchedServicesPageState extends State<MatchedServicesPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: const CustomAppBar(
title: "Select Services",
appBar: CustomAppBar(
title: LocaleKeys.selectServices.tr(),
),
body: SizedBox(
width: double.infinity,
@ -74,19 +72,17 @@ class _MatchedServicesPageState extends State<MatchedServicesPage> {
serviceVM.selectAllServices(v ?? false);
},
),
"Select All".toText(
isBold: true,
)
LocaleKeys.selectAll.tr().toText(isBold: true)
],
),
Container(
alignment: Alignment.centerRight,
child: "Unselect All".toText(
color: MyColors.primaryColor,
isUnderLine: true,
isBold: true,
),
margin: const EdgeInsets.symmetric(horizontal: 14, vertical: 7),
child: LocaleKeys.unselectAll.tr().toText(
color: MyColors.primaryColor,
isUnderLine: true,
isBold: true,
),
).onPress(() {
serviceVM.selectAllServices(false);
}),
@ -98,7 +94,7 @@ class _MatchedServicesPageState extends State<MatchedServicesPage> {
if (model.matchedServices == null) {
return const Center(child: CircularProgressIndicator());
} else if (model.matchedServices!.isEmpty) {
return const EmptyWidget(text: "No Services found", isWrapedColumn: false);
return EmptyWidget(text: LocaleKeys.noServicesAvailable.tr(), isWrappedColumn: false);
}
return ListView.separated(
itemBuilder: (context, index) {
@ -110,7 +106,7 @@ class _MatchedServicesPageState extends State<MatchedServicesPage> {
value: model.matchedServices![index].isExpandedOrSelected,
onChanged: (v) {
if (model.matchedServices![index].serviceItems!.isEmpty) {
Utils.showToast("No Items Available in this service");
Utils.showToast(LocaleKeys.noItemstoShow.tr());
} else {
model.matchedServices![index].isExpandedOrSelected = v ?? false;
model.updateServiceItem(index, model.matchedServices![index].isExpandedOrSelected);
@ -123,8 +119,7 @@ class _MatchedServicesPageState extends State<MatchedServicesPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
model.matchedServices![index].serviceDescription.toString().toText(fontSize: 16, isBold: true),
"${model.matchedServices![index].serviceItems!.where((c) => c.isUpdateOrSelected == true).length} items selected out of ${model.matchedServices![index].serviceItems!.length}"
.toText(color: MyColors.lightTextColor)
"${model.matchedServices![index].serviceItems!.where((c) => c.isUpdateOrSelected == true).length} items selected out of ${model.matchedServices![index].serviceItems!.length}".toText(color: MyColors.lightTextColor)
],
),
),
@ -158,25 +153,14 @@ class _MatchedServicesPageState extends State<MatchedServicesPage> {
),
12.height,
ShowFillButton(
title: "Copy Selected Services",
title: LocaleKeys.copySelectedServices.tr(),
maxWidth: double.infinity,
margin: const EdgeInsets.all(14),
onPressed: () async {
Utils.showLoading(context);
List<int> items = [];
for (var element in serviceVM.matchedServices!) {
items.addAll(element.serviceItems!.where((e) => e.isUpdateOrSelected == true).map((e) => e.id ?? 0).toList());
}
Map<String, dynamic> map = {
"providerBranchID": widget.matchServicesArguments!.newBranch.toString(),
"serviceItems": items,
};
print(jsonEncode(map));
GenericRespModel mResponse = await serviceVM.duplicateItems(map);
Utils.hideLoading(context);
Utils.showToast(mResponse.message ?? "");
pop(context);
pop(context);
await serviceVM.duplicateItems(
providerBranchID: widget.matchServicesArguments!.newBranch.toString(),
context: context,
);
},
),
],

@ -41,7 +41,7 @@ class ItemsListPage extends StatelessWidget {
return model.state == ViewState.busy
? const Center(child: CircularProgressIndicator())
: model.serviceItems!.data!.isEmpty
? const EmptyWidget(text: "No Service Items found", isWrapedColumn: false)
? const EmptyWidget(text: "No Service Items found", isWrappedColumn: false)
: ListView.separated(
itemBuilder: (BuildContext context, int index) {
return SizedBox(

@ -40,8 +40,8 @@ dependencies:
# path: C:/Users/mirza.shafique/AndroidStudioProjects/mc_common_app
mc_common_app:
# path: /Volumes/Data/Projects/Flutter/car_common_app
path: /Users/amir/StudioProjects/car_common_app
path: /Volumes/Data/Projects/Flutter/car_common_app
# path: /Users/amir/StudioProjects/car_common_app

Loading…
Cancel
Save