diff --git a/assets/icons/ic_ads.svg b/assets/icons/ic_ads.svg
new file mode 100644
index 0000000..dad55fd
--- /dev/null
+++ b/assets/icons/ic_ads.svg
@@ -0,0 +1,6 @@
+
diff --git a/assets/icons/ic_appoinments.svg b/assets/icons/ic_appoinments.svg
new file mode 100644
index 0000000..ebf91e9
--- /dev/null
+++ b/assets/icons/ic_appoinments.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/icons/ic_branches.svg b/assets/icons/ic_branches.svg
new file mode 100644
index 0000000..c0ba51c
--- /dev/null
+++ b/assets/icons/ic_branches.svg
@@ -0,0 +1,9 @@
+
diff --git a/assets/icons/ic_home.svg b/assets/icons/ic_home.svg
new file mode 100644
index 0000000..758dd1b
--- /dev/null
+++ b/assets/icons/ic_home.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/icons/ic_requests.svg b/assets/icons/ic_requests.svg
new file mode 100644
index 0000000..c6fd34a
--- /dev/null
+++ b/assets/icons/ic_requests.svg
@@ -0,0 +1,5 @@
+
diff --git a/lib/api/api_client.dart b/lib/api/api_client.dart
index 4819948..8f999cb 100644
--- a/lib/api/api_client.dart
+++ b/lib/api/api_client.dart
@@ -5,7 +5,7 @@ import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:http/http.dart';
import 'package:http/io_client.dart';
-import 'package:mc_common_app/classes/app_state_cm.dart';
+import 'package:mc_common_app/classes/app_state.dart';
import 'package:mc_common_app/classes/consts.dart';
import 'package:mc_common_app/exceptions/api_exception.dart';
import 'package:mc_common_app/models/user/refresh_token.dart';
@@ -295,7 +295,7 @@ class ApiClientImp implements ApiClient {
// Future refreshTokenAPI(String token, String refreshToken) async {
// var postParams = {"token": token, "refreshToken": refreshToken};
-// // String t = AppStateCm().getUser.data!.accessToken ?? "";
+// // String t = AppState().getUser.data!.accessToken ?? "";
// return await postJsonForObject((json) => RefreshToken.fromJson(json), ApiConsts.RefreshToken, postParams);
// }
@@ -306,7 +306,7 @@ class ApiClientImp implements ApiClient {
Future refreshTokenAPI(String token, String refreshToken) async {
var postParams = {"token": token, "refreshToken": refreshToken};
- // String t = AppStateCm().getUser.data!.accessToken ?? "";
+ // String t = AppState().getUser.data!.accessToken ?? "";
return await postJsonForObject((json) => RefreshToken.fromJson(json), ApiConsts.RefreshToken, postParams);
}
@@ -320,7 +320,7 @@ class ApiClientImp implements ApiClient {
UserInfo info = UserInfo.fromJson(jsonDecode(mdata));
User user = User();
user.data = UserData(accessToken: refresh.data!.accessToken ?? "", refreshToken: refresh.data!.refreshToken ?? "", userInfo: info);
- AppStateCm().setUser = user;
+ AppState().setUser = user;
return refresh.data!.accessToken??"";
}
}
diff --git a/lib/classes/app_state_cm.dart b/lib/classes/app_state.dart
similarity index 62%
rename from lib/classes/app_state_cm.dart
rename to lib/classes/app_state.dart
index dcd2f86..32a5f71 100644
--- a/lib/classes/app_state_cm.dart
+++ b/lib/classes/app_state.dart
@@ -1,16 +1,15 @@
-
-import 'package:injector/injector.dart';
+import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:mc_common_app/models/post_params_model.dart';
import 'package:mc_common_app/models/user/user.dart';
-class AppStateCm {
- static final AppStateCm _instance = AppStateCm._internal();
+class AppState {
+ static final AppState _instance = AppState._internal();
- AppStateCm._internal();
+ AppState._internal();
- factory AppStateCm() => _instance;
+ factory AppState() => _instance;
bool isLogged = false;
@@ -32,4 +31,11 @@ class AppStateCm {
void setPostParamsModel(PostParamsModel _postParams) {
this._postParams = _postParams;
}
+
+ LatLng currentLocation = const LatLng(0, 0);
+
+ set setCurrentLocation(v) => currentLocation = v;
+
+ LatLng get getCurrentLocation => currentLocation;
+
}
diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart
index f08f443..5c5854e 100644
--- a/lib/classes/consts.dart
+++ b/lib/classes/consts.dart
@@ -37,11 +37,17 @@ class ApiConsts {
static String ServiceProviderDocument_Update = baseUrlServices + "api/ServiceProviders/ServiceProviderDocument_Update";
//Branch
+ static String getProviderBranch = baseUrlServices + "api/ServiceProviders/ServiceProviderBranch_Get";
static String createProviderBranch = baseUrlServices + "api/ServiceProviders/ServiceProviderBranch_Create";
+ static String updateProviderBranch = baseUrlServices + "api/ServiceProviders/ServiceProviderBranch_Update";
static String ServiceProviderBranchGet = baseUrlServices + "api/ServiceProviders/ServiceProviderBranch_Get";
static String ServiceCategory_Get = baseUrlServices + "api/Master/ServiceCategory_Get";
static String Services_Get = baseUrlServices + "api/ServiceProviders/Services_Get";
static String ServiceProviderService_Create = baseUrlServices + "api/ServiceProviders/ServiceProviderService_Create";
+ static String ServiceProviderService_Update = baseUrlServices + "api/ServiceProviders/ServiceProviderService_Update";
+
+ static String ServiceProviderService_Get= baseUrlServices + "api/ServiceProviders/ServiceProviderService_Get";
+ static String BranchesAndServices= baseUrlServices + "api/ServiceProviders/ServiceProviderDetail_Get";
}
class GlobalConsts {
diff --git a/lib/config/dependencies.dart b/lib/config/dependencies.dart
index 857bc62..c9710dc 100644
--- a/lib/config/dependencies.dart
+++ b/lib/config/dependencies.dart
@@ -5,7 +5,7 @@
import 'package:injector/injector.dart';
import 'package:mc_common_app/api/api_client.dart';
-import 'package:mc_common_app/classes/app_state_cm.dart';
+import 'package:mc_common_app/classes/app_state.dart';
import 'package:mc_common_app/repositories/user_repo.dart';
import 'package:mc_common_app/services/services.dart';
@@ -15,7 +15,7 @@ class AppDependencies {
static void addDependencies() {
//services
- injector.registerSingleton(() => AppStateCm());
+ injector.registerSingleton(() => AppState());
injector.registerSingleton(() => ApiClientImp());
injector.registerSingleton(() => CommonServicesImp());
diff --git a/lib/config/routes.dart b/lib/config/routes.dart
index 0c17e79..8d47fa8 100644
--- a/lib/config/routes.dart
+++ b/lib/config/routes.dart
@@ -42,7 +42,6 @@ class AppRoutes {
static const String profile3 = "/profile3";
static const String verifyPassword = "/vertifyPassword";
static const String confirmNewPasswordPage = "/confirmNewPasswordPage";
- static const String defineLicense = "/defineLicese";
static const String changePassword = "/changePassword";
static const String forgetPasswordMethodPage = "/forgetPasswordMethodPage";
static const String changeMobilePage = "/changeMobilePage";
@@ -51,10 +50,7 @@ class AppRoutes {
static const String dashboard = "/dashboard";
- //settings
- static const String dealershipSetting = "/dealershipSetting";
- static const String defineBranch = "/defineBranch";
- static const String createServices = "/createServices";
+
static const String initialRoute = splash;
diff --git a/lib/extensions/widget_extensions.dart b/lib/extensions/widget_extensions.dart
deleted file mode 100644
index 474cbee..0000000
--- a/lib/extensions/widget_extensions.dart
+++ /dev/null
@@ -1,10 +0,0 @@
-import 'package:flutter/material.dart';
-
-extension WidgetExtensions on Widget {
- Widget onPress(VoidCallback onTap) => InkWell(onTap: onTap, child: this);
-
- Widget paddingAll(double _value) => Padding(padding: EdgeInsets.all(_value), child: this);
-
- Widget paddingOnly({double left = 0.0, double right = 0.0, double top = 0.0, double bottom = 0.0}) =>
- Padding(padding: EdgeInsets.only(left: left, right: right, top: top, bottom: bottom), child: this);
-}
diff --git a/lib/main.dart b/lib/main.dart
index 9ad34b6..4b2e9ac 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -3,9 +3,11 @@ import 'dart:io';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
-import 'package:mc_common_app/classes/app_state_cm.dart';
-import 'package:mc_common_app/classes/app_state_cm.dart';
-import 'package:mc_common_app/classes/app_state_cm.dart';
+import 'package:mc_common_app/classes/app_state.dart';
+import 'package:mc_common_app/classes/app_state.dart';
+import 'package:mc_common_app/classes/app_state.dart';
+import 'package:mc_common_app/classes/app_state.dart';
+import 'package:mc_common_app/classes/app_state.dart';
import 'package:mc_common_app/theme/app_theme.dart';
import 'package:injector/injector.dart';
@@ -14,7 +16,7 @@ import 'package:provider/provider.dart';
import 'package:provider/single_child_widget.dart';
import 'package:sizer/sizer.dart';
-late AppStateCm appStateCm;
+late AppState appState;
final navigatorKey = GlobalKey();
@@ -35,7 +37,7 @@ Future main() async {
WidgetsFlutterBinding.ensureInitialized();
await EasyLocalization.ensureInitialized();
- // AppStateCm().setPostParamsInitConfig();
+ // AppState().setPostParamsInitConfig();
HttpOverrides.global = MyHttpOverrides();
runApp(
@@ -72,7 +74,7 @@ class MyApp extends StatelessWidget {
DeviceType deviceType,
) {
List> delegates = context.localizationDelegates;
- // AppStateCm().setPostParamsModel(
+ // AppState().setPostParamsModel(
// PostParamsModel(
// languageID: EasyLocalization.of(context)?.locale.languageCode == "ar" ? 1 : 2,
// ),
@@ -97,8 +99,8 @@ class MyApp extends StatelessWidget {
// class MyApp extends StatelessWidget {
// MyApp({super.key}) {
// AppDependencies.addDependencies();
-// AppStateCm = Injector.appInstance.get();
-// // AppStateCm.setPostParamsInitConfig();
+// AppState = Injector.appInstance.get();
+// // AppState.setPostParamsInitConfig();
// }
//
// @override
@@ -112,7 +114,7 @@ class MyApp extends StatelessWidget {
// ) {
// SizeConfig().init(constraints, orientation);
// List> delegates = context.localizationDelegates;
-// // AppStateCm().setPostParamsModel(
+// // AppState().setPostParamsModel(
// // PostParamsModel(
// // languageID: EasyLocalization.of(context)?.locale.languageCode == "ar" ? 1 : 2,
// // ),
diff --git a/lib/models/account.dart b/lib/models/account.dart
index 699bfba..ecafb24 100644
--- a/lib/models/account.dart
+++ b/lib/models/account.dart
@@ -28,17 +28,17 @@ class Account {
: List.from(
json["parentList"].map((x) => ParentList.fromJson(x))),
selectedItem:
- json["selectedItem"],
+ json["selectedItem"] == null ? null : json["selectedItem"],
);
Map toJson() => {
"parentList": parentList == null
? null
: List.from(parentList!.map((x) => x.toJson())),
- "selectedItem": selectedItem,
+ "selectedItem": selectedItem == null ? null : selectedItem,
};
Map toJsonData() => {
- "selectedItem": selectedItem,
+ "selectedItem": selectedItem == null ? null : selectedItem,
};
}
diff --git a/lib/models/model/branch2.dart b/lib/models/model/branch2.dart
new file mode 100644
index 0000000..dd9df37
--- /dev/null
+++ b/lib/models/model/branch2.dart
@@ -0,0 +1,184 @@
+// To parse this JSON data, do
+//
+// final branch2 = branch2FromJson(jsonString);
+
+import 'dart:convert';
+
+import 'package:mc_common_app/models/profile/categroy.dart';
+
+
+
+Branch2 branch2FromJson(String str) => Branch2.fromJson(json.decode(str));
+
+String branch2ToJson(Branch2 data) => json.encode(data.toJson());
+
+class Branch2 {
+ Branch2({
+ this.messageStatus,
+ this.totalItemsCount,
+ this.data,
+ this.message,
+ });
+
+ final int? messageStatus;
+ final int? totalItemsCount;
+ final Data? data;
+ final String? message;
+
+ factory Branch2.fromJson(Map json) => Branch2(
+ messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
+ totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"],
+ data: json["data"] == null ? null : Data.fromJson(json["data"]),
+ message: json["message"] == null ? null : json["message"],
+ );
+
+ Map toJson() => {
+ "messageStatus": messageStatus == null ? null : messageStatus,
+ "totalItemsCount": totalItemsCount == null ? null : totalItemsCount,
+ "data": data == null ? null : data!.toJson(),
+ "message": message == null ? null : message,
+ };
+}
+
+class Data {
+ Data({
+ this.id,
+ this.companyName,
+ this.countryName,
+ this.companyDescription,
+ this.allDocStatus,
+ this.isValidSubscription,
+ this.userId,
+ this.serviceProviderBranch,
+ this.countryID,
+ });
+
+ final int? id;
+ final String? companyName;
+ final String? countryName;
+ int? countryID;
+ final String? companyDescription;
+ final int? allDocStatus;
+ final bool? isValidSubscription;
+ final String? userId;
+ final List? serviceProviderBranch;
+
+ factory Data.fromJson(Map json) => Data(
+ id: json["id"] == null ? null : json["id"],
+ companyName: json["companyName"] == null ? null : json["companyName"],
+ countryName: json["countryName"] == null ? null : json["countryName"],
+ countryID: json["countryID"] == null ? null : json["countryID"],
+ companyDescription: json["companyDescription"] == null ? null : json["companyDescription"],
+ allDocStatus: json["allDocStatus"] == null ? null : json["allDocStatus"],
+ isValidSubscription: json["isValidSubscription"] == null ? null : json["isValidSubscription"],
+ userId: json["userID"] == null ? null : json["userID"],
+ serviceProviderBranch: json["serviceProviderBranch"] == null ? null : List.from(json["serviceProviderBranch"].map((x) => ServiceProviderBranch.fromJson(x))),
+ );
+
+ Map toJson() => {
+ "id": id == null ? null : id,
+ "companyName": companyName == null ? null : companyName,
+ "companyDescription": companyDescription == null ? null : companyDescription,
+ "allDocStatus": allDocStatus == null ? null : allDocStatus,
+ "isValidSubscription": isValidSubscription == null ? null : isValidSubscription,
+ "userID": userId == null ? null : userId,
+ "serviceProviderBranch": serviceProviderBranch == null ? null : List.from(serviceProviderBranch!.map((x) => x.toJson())),
+ };
+}
+
+class ServiceProviderBranch {
+ ServiceProviderBranch({
+ this.id,
+ this.cityId,
+ this.cityName,
+ this.branchName,
+ this.branchDescription,
+ this.address,
+ this.latitude,
+ this.longitude,
+ this.status,
+ this.serviceProviderServices,
+ this.countryID,
+ this.countryName,
+ this.categories,
+ });
+
+ final int? id;
+ int? countryID;
+ String? countryName;
+ final int? cityId;
+ final dynamic? cityName;
+ final String? branchName;
+ final String? branchDescription;
+ final String? address;
+ final String? latitude;
+ final String? longitude;
+ final int? status;
+ final List? serviceProviderServices;
+ List? categories;
+
+ factory ServiceProviderBranch.fromJson(Map json) => ServiceProviderBranch(
+ id: json["id"] == null ? null : json["id"],
+ countryID: 0,
+ countryName: "",
+ cityId: json["cityID"] == null ? null : json["cityID"],
+ cityName: json["cityName"],
+ branchName: json["branchName"] == null ? null : json["branchName"],
+ branchDescription: json["branchDescription"] == null ? null : json["branchDescription"],
+ address: json["address"] == null ? null : json["address"],
+ latitude: json["latitude"] == null ? null : json["latitude"],
+ longitude: json["longitude"] == null ? null : json["longitude"],
+ status: json["status"] == null ? null : json["status"],
+ serviceProviderServices: json["serviceProviderServices"] == null ? null : List.from(json["serviceProviderServices"].map((x) => ServiceProviderService.fromJson(x))),
+ categories: [],
+ );
+
+ Map toJson() => {
+ "id": id == null ? null : id,
+ "cityID": cityId == null ? null : cityId,
+ "cityName": cityName,
+ "branchName": branchName == null ? null : branchName,
+ "branchDescription": branchDescription == null ? null : branchDescription,
+ "address": address == null ? null : address,
+ "latitude": latitude == null ? null : latitude,
+ "longitude": longitude == null ? null : longitude,
+ "status": status == null ? null : status,
+ "serviceProviderServices": serviceProviderServices == null ? null : List.from(serviceProviderServices!.map((x) => x.toJson())),
+ };
+}
+
+class ServiceProviderService {
+ ServiceProviderService({
+ this.serviceId,
+ this.serviceName,
+ this.serviceNameN,
+ this.categoryId,
+ this.categoryName,
+ this.serviceStatus,
+ });
+
+ final int? serviceId;
+ final String? serviceName;
+ final String? serviceNameN;
+ final int? categoryId;
+ final String? categoryName;
+ final int? serviceStatus;
+
+ factory ServiceProviderService.fromJson(Map json) => ServiceProviderService(
+ serviceId: json["serviceID"] == null ? null : json["serviceID"],
+ serviceName: json["serviceName"] == null ? null : json["serviceName"],
+ serviceNameN: json["serviceNameN"] == null ? null : json["serviceNameN"],
+ categoryId: json["categoryID"] == null ? null : json["categoryID"],
+ categoryName: json["categoryName"] == null ? null : json["categoryName"],
+ serviceStatus: json["serviceStatus"] == null ? null : json["serviceStatus"],
+ );
+
+ Map toJson() => {
+ "serviceID": serviceId == null ? null : serviceId,
+ "serviceName": serviceName == null ? null : serviceName,
+ "serviceNameN": serviceNameN == null ? null : serviceNameN,
+ "categoryID": categoryId == null ? null : categoryId,
+ "categoryName": categoryName == null ? null : categoryName,
+ "serviceStatus": serviceStatus == null ? null : serviceStatus,
+ };
+}
diff --git a/lib/models/profile/categroy.dart b/lib/models/profile/categroy.dart
index 6f566f1..25fd487 100644
--- a/lib/models/profile/categroy.dart
+++ b/lib/models/profile/categroy.dart
@@ -4,6 +4,9 @@
import 'dart:convert';
+import 'package:equatable/equatable.dart';
+import 'package:mc_common_app/models/model/branch2.dart';
+
Category categoryFromJson(String str) => Category.fromJson(json.decode(str));
String categoryToJson(Category data) => json.encode(data.toJson());
@@ -22,27 +25,29 @@ class Category {
String? message;
factory Category.fromJson(Map json) => Category(
- totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"],
- data: json["data"] == null ? null : List.from(json["data"].map((x) => CategoryData.fromJson(x))),
- messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
- message: json["message"] == null ? null : json["message"],
- );
+ totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"],
+ data: json["data"] == null ? null : List.from(json["data"].map((x) => CategoryData.fromJson(x))),
+ messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
+ message: json["message"] == null ? null : json["message"],
+ );
Map toJson() => {
- "totalItemsCount": totalItemsCount == null ? null : totalItemsCount,
- "data": data == null ? null : List.from(data!.map((x) => x.toJson())),
- "messageStatus": messageStatus == null ? null : messageStatus,
- "message": message == null ? null : message,
- };
+ "totalItemsCount": totalItemsCount == null ? null : totalItemsCount,
+ "data": data == null ? null : List.from(data!.map((x) => x.toJson())),
+ "messageStatus": messageStatus == null ? null : messageStatus,
+ "message": message == null ? null : message,
+ };
}
-class CategoryData {
+// ignore: must_be_immutable
+class CategoryData extends Equatable {
CategoryData({
this.id,
this.categoryName,
this.categoryNameN,
this.serviceCategoryIconUrl,
this.serviceCategoryImageUrl,
+ this.services,
});
int? id;
@@ -50,20 +55,25 @@ class CategoryData {
String? categoryNameN;
dynamic? serviceCategoryIconUrl;
dynamic? serviceCategoryImageUrl;
+ List? services;
factory CategoryData.fromJson(Map json) => CategoryData(
- id: json["id"] == null ? null : json["id"],
- categoryName: json["categoryName"] == null ? null : json["categoryName"],
- categoryNameN: json["categoryNameN"] == null ? null : json["categoryNameN"],
- serviceCategoryIconUrl: json["serviceCategoryIconUrl"],
- serviceCategoryImageUrl: json["serviceCategoryImageUrl"],
- );
+ id: json["id"] == null ? null : json["id"],
+ categoryName: json["categoryName"] == null ? null : json["categoryName"],
+ categoryNameN: json["categoryNameN"] == null ? null : json["categoryNameN"],
+ serviceCategoryIconUrl: json["serviceCategoryIconUrl"],
+ serviceCategoryImageUrl: json["serviceCategoryImageUrl"],
+ services: [],
+ );
Map toJson() => {
- "id": id == null ? null : id,
- "categoryName": categoryName == null ? null : categoryName,
- "categoryNameN": categoryNameN == null ? null : categoryNameN,
- "serviceCategoryIconUrl": serviceCategoryIconUrl,
- "serviceCategoryImageUrl": serviceCategoryImageUrl,
- };
+ "id": id == null ? null : id,
+ "categoryName": categoryName == null ? null : categoryName,
+ "categoryNameN": categoryNameN == null ? null : categoryNameN,
+ "serviceCategoryIconUrl": serviceCategoryIconUrl,
+ "serviceCategoryImageUrl": serviceCategoryImageUrl,
+ };
+
+ @override
+ List