Merge pull request 'branches list and provider profile 1.0' (#1) from mirza_development into master

Reviewed-on: http://34.17.52.79/Haroon6138/car_common_app/pulls/1
pull/4/head
Mirza Shafique 2 years ago
commit 4f0296b5b6

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 BranchesAndServices = "${baseUrlServices}api/ServiceProviders/ServiceProviderDetail_Get";
static String GetAllNearBranches = "${baseUrlServices}api/ServiceProviders/ServiceProviderBranchDetail_Get";
//Appointment APIs
static String serviceProvidersAppointmentGet = "${baseUrlServices}api/ServiceProviders/ServiceProvidersAppointment_Get";
static String serviceCategoryGet = "${baseUrlServices}api/Master/ServiceCategory_Get";
static String serviceItemsGet = "${baseUrlServices}api/ServiceProviders/ServiceItem_Get";
//ServiceProvidersServiceID as params
// static String servicesGet = "${baseUrlServices}api/ServiceProviders/Services_Get";
@ -197,6 +199,7 @@ class MyAssets {
static String icWhatsAppPng = "${assetPath}icons/ic_whatsapp.png";
static String icSmsPng = "${assetPath}icons/ic_sms.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 installmentsPng = "${assetPath}icons/payments/installments.png";

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

@ -6,12 +6,12 @@ import 'dart:convert';
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 {
Branch2({
class ProviderModel {
ProviderModel({
this.messageStatus,
this.totalItemsCount,
this.data,
@ -20,13 +20,13 @@ class Branch2 {
final int? messageStatus;
final int? totalItemsCount;
final Data? data;
final ProviderModelData? data;
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"],
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"],
);
@ -38,8 +38,8 @@ class Branch2 {
};
}
class Data {
Data({
class ProviderModelData {
ProviderModelData({
this.id,
this.companyName,
this.countryName,
@ -61,7 +61,7 @@ class Data {
final String? userId;
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"],
companyName: json["companyName"] == null ? null : json["companyName"],
countryName: json["countryName"] == null ? null : json["countryName"],

@ -5,7 +5,7 @@
import 'dart:convert';
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));

@ -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/string_extensions.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/widgets/extensions/extensions_widget.dart';
class ProviderDetailsCard extends StatelessWidget {
final String providerImageUrl;
final String providerName;
final String title;
final String? providerName;
final String providerLocation;
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;
const ProviderDetailsCard({
Key? key,
required this.providerImageUrl,
required this.providerName,
required this.title,
this.providerName,
required this.providerRatings,
required this.providerLocation,
this.items,
required this.onCardTapped,
}) : super(key: key);
@override
Widget build(BuildContext context) {
//TODO: use pading in listview
return Padding(
padding: const EdgeInsets.only(
bottom: 10,
left: 21,
right: 21,
),
padding: EdgeInsets.zero,
// padding: const EdgeInsets.only(
// bottom: 10,
// left: 21,
// right: 21,
// ),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(
providerImageUrl,
@ -53,14 +63,22 @@ class ProviderDetailsCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
providerName.toText(fontSize: 16, isBold: true),
title.toText(fontSize: 16, isBold: true),
Row(
children: [
LocaleKeys.location.tr().toText(color: MyColors.lightTextColor, fontSize: 12),
2.width,
":$providerLocation".toText(fontSize: 12),
(LocaleKeys.location.tr() + ":").toText(color: MyColors.lightTextColor, fontSize: 12),
4.width,
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,
Row(
children: [
Expanded(
child: Column(
children: [
if (items != null)
Column(
children: items!
.take(2)
.map(
(e) =>
Row(
children: [
MyAssets.maintenanceIcon.buildSvg(),
8.width,
LocaleKeys.maintenance.tr().toText(
fontSize: 12,
isBold: true,
),
//TODO: Needs to add icon in the future when added from the provider
// MyAssets.maintenanceIcon.buildSvg(),
// 8.width,
e.serviceDescription.toString().toText(
fontSize: 12,
isBold: true,
)
],
),
Row(
children: [
MyAssets.modificationsIcon.buildSvg(),
8.width,
LocaleKeys.accessories_modifications.tr().toText(
fontSize: 12,
isBold: true,
),
],
)
],
),
),
],
),
)
.toList(),
),
if (items != null && items!.length > 2)
("+${items!.length - 2} more").toText(
color: MyColors.primaryColor,
isUnderLine: true,
isBold: true,
),
],
),
),

Loading…
Cancel
Save