Merge branch 'master' of http://34.17.52.79/Haroon6138/car_common_app into faiz_development_common

pull/3/head
FaizHashmiCS22 2 years ago
commit c57aeaf211

Binary file not shown.

After

Width:  |  Height:  |  Size: 891 B

@ -49,11 +49,13 @@ class ApiConsts {
static String ServiceProviderService_Get = "${baseUrlServices}api/ServiceProviders/ServiceProviderService_Get"; static String ServiceProviderService_Get = "${baseUrlServices}api/ServiceProviders/ServiceProviderService_Get";
static String BranchesAndServices = "${baseUrlServices}api/ServiceProviders/ServiceProviderDetail_Get"; static String BranchesAndServices = "${baseUrlServices}api/ServiceProviders/ServiceProviderDetail_Get";
static String GetAllNearBranches = "${baseUrlServices}api/ServiceProviders/ServiceProviderBranchDetail_Get";
//Appointment APIs //Appointment APIs
static String serviceProvidersAppointmentGet = "${baseUrlServices}api/ServiceProviders/ServiceProvidersAppointment_Get"; static String serviceProvidersAppointmentGet = "${baseUrlServices}api/ServiceProviders/ServiceProvidersAppointment_Get";
static String serviceCategoryGet = "${baseUrlServices}api/Master/ServiceCategory_Get"; static String serviceCategoryGet = "${baseUrlServices}api/Master/ServiceCategory_Get";
static String serviceItemsGet = "${baseUrlServices}api/ServiceProviders/ServiceItem_Get"; static String serviceItemsGet = "${baseUrlServices}api/ServiceProviders/ServiceItem_Get";
//ServiceProvidersServiceID as params //ServiceProvidersServiceID as params
// static String servicesGet = "${baseUrlServices}api/ServiceProviders/Services_Get"; // static String servicesGet = "${baseUrlServices}api/ServiceProviders/Services_Get";
@ -198,6 +200,7 @@ class MyAssets {
static String icWhatsAppPng = "${assetPath}icons/ic_whatsapp.png"; static String icWhatsAppPng = "${assetPath}icons/ic_whatsapp.png";
static String icSmsPng = "${assetPath}icons/ic_sms.png"; static String icSmsPng = "${assetPath}icons/ic_sms.png";
static String icFingerprintPng = "${assetPath}icons/ic_fingerprint.png"; static String icFingerprintPng = "${assetPath}icons/ic_fingerprint.png";
static String icRightUpPng = "${assetPath}icons/ic_right_up.png";
static String applePayPng = "${assetPath}icons/payments/apple_pay.png"; static String applePayPng = "${assetPath}icons/payments/apple_pay.png";
static String installmentsPng = "${assetPath}icons/payments/installments.png"; static String installmentsPng = "${assetPath}icons/payments/installments.png";

@ -63,6 +63,10 @@ class AppRoutes {
// Payments // Payments
static const String paymentMethodsView = "/paymentMethodsView"; static const String paymentMethodsView = "/paymentMethodsView";
//Customer APP: Provider & Services
static const String branchDetailPage = "/branchDetailPage";
static const String providerProfilePage = "/providerProfilePage";
// Subcriptions // Subcriptions
static final String mySubscriptionsPage = "/mySubscriptionsPage"; static final String mySubscriptionsPage = "/mySubscriptionsPage";

@ -6,12 +6,12 @@ import 'dart:convert';
import 'package:mc_common_app/models/profile/categroy.dart'; import 'package:mc_common_app/models/profile/categroy.dart';
Branch2 branch2FromJson(String str) => Branch2.fromJson(json.decode(str)); ProviderModel branch2FromJson(String str) => ProviderModel.fromJson(json.decode(str));
String branch2ToJson(Branch2 data) => json.encode(data.toJson()); String branch2ToJson(ProviderModel data) => json.encode(data.toJson());
class Branch2 { class ProviderModel {
Branch2({ ProviderModel({
this.messageStatus, this.messageStatus,
this.totalItemsCount, this.totalItemsCount,
this.data, this.data,
@ -20,13 +20,13 @@ class Branch2 {
final int? messageStatus; final int? messageStatus;
final int? totalItemsCount; final int? totalItemsCount;
final Data? data; final ProviderModelData? data;
final String? message; final String? message;
factory Branch2.fromJson(Map<String, dynamic> json) => Branch2( factory ProviderModel.fromJson(Map<String, dynamic> json) => ProviderModel(
messageStatus: json["messageStatus"] == null ? null : json["messageStatus"], messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"], totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"],
data: json["data"] == null ? null : Data.fromJson(json["data"]), data: json["data"] == null ? null : ProviderModelData.fromJson(json["data"]),
message: json["message"] == null ? null : json["message"], message: json["message"] == null ? null : json["message"],
); );
@ -38,8 +38,8 @@ class Branch2 {
}; };
} }
class Data { class ProviderModelData {
Data({ ProviderModelData({
this.id, this.id,
this.companyName, this.companyName,
this.countryName, this.countryName,
@ -61,7 +61,7 @@ class Data {
final String? userId; final String? userId;
final List<ServiceProviderBranch>? serviceProviderBranch; final List<ServiceProviderBranch>? serviceProviderBranch;
factory Data.fromJson(Map<String, dynamic> json) => Data( factory ProviderModelData.fromJson(Map<String, dynamic> json) => ProviderModelData(
id: json["id"] == null ? null : json["id"], id: json["id"] == null ? null : json["id"],
companyName: json["companyName"] == null ? null : json["companyName"], companyName: json["companyName"] == null ? null : json["companyName"],
countryName: json["countryName"] == null ? null : json["countryName"], countryName: json["countryName"] == null ? null : json["countryName"],

@ -5,7 +5,7 @@
import 'dart:convert'; import 'dart:convert';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:mc_common_app/models/model/branch2.dart'; import 'package:mc_common_app/models/model/provider_model.dart';
Category categoryFromJson(String str) => Category.fromJson(json.decode(str)); Category categoryFromJson(String str) => Category.fromJson(json.decode(str));

@ -0,0 +1,75 @@
import 'package:mc_common_app/models/services/service_model.dart';
class BranchModel {
final int? id;
final int? serviceProviderId;
final String? serviceProviderName;
final String? branchName;
final String? branchDescription;
final int? cityId;
final String? address;
final String? latitude;
final String? longitude;
final double? distanceKm;
final String? openTime;
final String? closeTime;
final int? status;
final dynamic statusText;
final List<ServiceModel>? branchServices;
BranchModel({
this.id,
this.serviceProviderId,
this.serviceProviderName,
this.branchName,
this.branchDescription,
this.cityId,
this.address,
this.latitude,
this.longitude,
this.distanceKm,
this.openTime,
this.closeTime,
this.status,
this.statusText,
this.branchServices,
});
factory BranchModel.fromJson(Map<String, dynamic> json) => BranchModel(
id: json["id"],
serviceProviderId: json["serviceProviderID"],
serviceProviderName: json["serviceProviderName"],
branchName: json["branchName"],
branchDescription: json["branchDescription"],
cityId: json["cityID"],
address: json["address"],
latitude: json["latitude"],
longitude: json["longitude"],
distanceKm: json["distanceKM"]?.toDouble(),
openTime: json["openTime"],
closeTime: json["closeTime"],
status: json["status"],
statusText: json["statusText"],
branchServices: json["branchServices"] == null ? [] : List<ServiceModel>.from(json["branchServices"]!.map((x) => ServiceModel.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"id": id,
"serviceProviderID": serviceProviderId,
"serviceProviderName": serviceProviderName,
"branchName": branchName,
"branchDescription": branchDescription,
"cityID": cityId,
"address": address,
"latitude": latitude,
"longitude": longitude,
"distanceKM": distanceKm,
"openTime": openTime,
"closeTime": closeTime,
"status": status,
"statusText": statusText,
"branchServices": branchServices == null ? [] : List<dynamic>.from(branchServices!.map((x) => x.toJson())),
};
}

@ -0,0 +1,39 @@
// To parse this JSON data, do
//
// final nearBrancheModel = nearBrancheModelFromJson(jsonString);
import 'dart:convert';
import 'branch_model.dart';
NearBrancheModel nearBrancheModelFromJson(String str) => NearBrancheModel.fromJson(json.decode(str));
String nearBrancheModelToJson(NearBrancheModel data) => json.encode(data.toJson());
class NearBrancheModel {
final int? messageStatus;
final int? totalItemsCount;
final List<BranchModel>? data;
final String? message;
NearBrancheModel({
this.messageStatus,
this.totalItemsCount,
this.data,
this.message,
});
factory NearBrancheModel.fromJson(Map<String, dynamic> json) => NearBrancheModel(
messageStatus: json["messageStatus"],
totalItemsCount: json["totalItemsCount"],
data: json["data"] == null ? [] : List<BranchModel>.from(json["data"]!.map((x) => BranchModel.fromJson(x))),
message: json["message"],
);
Map<String, dynamic> toJson() => {
"messageStatus": messageStatus,
"totalItemsCount": totalItemsCount,
"data": data == null ? [] : List<dynamic>.from(data!.map((x) => x.toJson())),
"message": message,
};
}

@ -0,0 +1,61 @@
//TODO: this needs to match with ServiceProviderService from backend side
class ServiceModel {
final int? providerBranchServiceId;
final dynamic providerServiceDescription;
final int? serviceCategoryId;
final int? serviceId;
final String? serviceDescription;
final String? serviceDescriptionN;
final int? status;
final dynamic statusText;
final bool? isAllowAppointment;
final int? customerLocationRange;
final int? itemsCount;
bool isExpanded;
ServiceModel({
this.providerBranchServiceId,
this.providerServiceDescription,
this.serviceCategoryId,
this.serviceId,
this.serviceDescription,
this.serviceDescriptionN,
this.status,
this.statusText,
this.isAllowAppointment,
this.customerLocationRange,
this.itemsCount,
required this.isExpanded,
});
factory ServiceModel.fromJson(Map<String, dynamic> json) =>
ServiceModel(
providerBranchServiceId: json["providerBranchServiceID"],
providerServiceDescription: json["providerServiceDescription"],
serviceCategoryId: json["serviceCategoryID"],
serviceId: json["serviceID"],
serviceDescription: json["serviceDescription"],
serviceDescriptionN: json["serviceDescriptionN"],
status: json["status"],
statusText: json["statusText"],
isAllowAppointment: json["isAllowAppointment"],
customerLocationRange: json["customerLocationRange"],
itemsCount: json["itemsCount"],
isExpanded: false,
);
Map<String, dynamic> toJson() =>
{
"providerBranchServiceID": providerBranchServiceId,
"providerServiceDescription": providerServiceDescription,
"serviceCategoryID": serviceCategoryId,
"serviceID": serviceId,
"serviceDescription": serviceDescription,
"serviceDescriptionN": serviceDescriptionN,
"status": status,
"statusText": statusText,
"isAllowAppointment": isAllowAppointment,
"customerLocationRange": customerLocationRange,
"itemsCount": itemsCount,
};
}

@ -4,34 +4,44 @@ import 'package:mc_common_app/classes/consts.dart';
import 'package:mc_common_app/extensions/int_extensions.dart'; import 'package:mc_common_app/extensions/int_extensions.dart';
import 'package:mc_common_app/extensions/string_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/generated/locale_keys.g.dart';
import 'package:mc_common_app/models/services/service_model.dart';
import 'package:mc_common_app/theme/colors.dart'; import 'package:mc_common_app/theme/colors.dart';
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart'; import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
class ProviderDetailsCard extends StatelessWidget { class ProviderDetailsCard extends StatelessWidget {
final String providerImageUrl; final String providerImageUrl;
final String providerName; final String title;
final String? providerName;
final String providerLocation; final String providerLocation;
final String providerRatings; final String providerRatings;
//TODO: items can be make a generaic, so we can add services/items in the future
final List<ServiceModel>? items;
final Function() onCardTapped; final Function() onCardTapped;
const ProviderDetailsCard({ const ProviderDetailsCard({
Key? key, Key? key,
required this.providerImageUrl, required this.providerImageUrl,
required this.providerName, required this.title,
this.providerName,
required this.providerRatings, required this.providerRatings,
required this.providerLocation, required this.providerLocation,
this.items,
required this.onCardTapped, required this.onCardTapped,
}) : super(key: key); }) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
//TODO: use pading in listview
return Padding( return Padding(
padding: const EdgeInsets.only( padding: EdgeInsets.zero,
bottom: 10, // padding: const EdgeInsets.only(
left: 21, // bottom: 10,
right: 21, // left: 21,
), // right: 21,
// ),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Image.asset( Image.asset(
providerImageUrl, providerImageUrl,
@ -53,14 +63,22 @@ class ProviderDetailsCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
providerName.toText(fontSize: 16, isBold: true), title.toText(fontSize: 16, isBold: true),
Row( Row(
children: [ children: [
LocaleKeys.location.tr().toText(color: MyColors.lightTextColor, fontSize: 12), (LocaleKeys.location.tr() + ":").toText(color: MyColors.lightTextColor, fontSize: 12),
2.width, 4.width,
":$providerLocation".toText(fontSize: 12), providerLocation.toText(fontSize: 12, isBold: true),
], ],
), ),
if (providerName != null)
Row(
children: [
(LocaleKeys.providers.tr() + ":").toText(color: MyColors.lightTextColor, fontSize: 12),
4.width,
providerName!.toText(fontSize: 12, isBold: true),
],
),
], ],
), ),
), ),
@ -79,36 +97,32 @@ class ProviderDetailsCard extends StatelessWidget {
], ],
), ),
8.height, 8.height,
Row( if (items != null)
children: [ Column(
Expanded( children: items!
child: Column( .take(2)
children: [ .map(
(e) =>
Row( Row(
children: [ children: [
MyAssets.maintenanceIcon.buildSvg(), //TODO: Needs to add icon in the future when added from the provider
8.width, // MyAssets.maintenanceIcon.buildSvg(),
LocaleKeys.maintenance.tr().toText( // 8.width,
fontSize: 12, e.serviceDescription.toString().toText(
isBold: true, fontSize: 12,
), isBold: true,
)
], ],
), ),
Row( )
children: [ .toList(),
MyAssets.modificationsIcon.buildSvg(), ),
8.width, if (items != null && items!.length > 2)
LocaleKeys.accessories_modifications.tr().toText( ("+${items!.length - 2} more").toText(
fontSize: 12, color: MyColors.primaryColor,
isBold: true, isUnderLine: true,
), isBold: true,
], ),
)
],
),
),
],
),
], ],
), ),
), ),

Loading…
Cancel
Save