From a887d9733ed62cd68863a234247be996d3c6e479 Mon Sep 17 00:00:00 2001 From: "mirza.shafique" Date: Wed, 24 May 2023 16:51:12 +0300 Subject: [PATCH 1/4] add services and items widgets --- assets/langs/ar-SA.json | 16 +++- assets/langs/en-US.json | 20 ++++- lib/api/api_client.dart | 8 +- lib/classes/consts.dart | 14 ++++ lib/generated/codegen_loader.g.dart | 30 ++++++- lib/generated/locale_keys.g.dart | 11 +++ lib/models/m_response.dart | 3 + lib/models/model/branch2.dart | 11 ++- lib/models/profile/categroy.dart | 16 +++- lib/theme/colors.dart | 1 + lib/utils/date_helper.dart | 48 +++++++++++ lib/utils/enums.dart | 9 ++ lib/utils/utils.dart | 37 +++++++-- lib/views/user/login_with_password_page.dart | 2 +- lib/widgets/bottom_sheet.dart | 86 ++++++++++++++++++++ lib/widgets/common_widgets/app_bar.dart | 2 +- lib/widgets/tab/role_type_tab.dart | 11 ++- lib/widgets/txt_field.dart | 4 +- pubspec.lock | 78 ++++++++++++------ pubspec.yaml | 3 +- 20 files changed, 350 insertions(+), 60 deletions(-) create mode 100644 lib/utils/date_helper.dart create mode 100644 lib/widgets/bottom_sheet.dart diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 1b6217e..ba7d926 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -170,6 +170,18 @@ "my_recent_providers": "مزودي الخدمة الجدد", "my_active_ads": "إعلاناتي النشطة", "recommended_Ads": "الإعلانات الموصى بها", - "location": "موقع" - + "location": "موقع", + "address": "عنوان", + "branchName": "اسم الفرع", + "branchDescription": "وصف الفرع", + "branchInfo": "معلومات الفرع", + "defineServices": "تحديد الخدمات", + "defineBranches": "تحديد الفروع", + "defineProviders": "تحديد الموفرين", + "closeAccount": "حساب مغلق", + "selectServiceCategory": "حدد فئة الخدمة", + "selectService": "حدد الخدمة", + "selectBranch": "حدد الفرع", + "createBranch": "Create Branch", + "updateBranch": "Update Branch" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index a499d5b..dd6bc7a 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -162,8 +162,8 @@ "tapToEdit": "Tap to edit", "myServiceBranches": "My Service Branches", "enter_licence_detail": "Please enter the detail for commercial records and attach the license images", - "country": "country", - "city": "city", + "country": "Country", + "city": "City", "editServices": "Edit Services", "maintenance": "Maintenance", "accessories_modifications": "Accessories and Modifications", @@ -171,6 +171,18 @@ "my_active_ads": "My Active Ads", "recommended_Ads": "Recommended Ads", "select_services": "Select services you want", - "location": "Location" - + "location": "Location", + "address": "Address", + "branchName": "Branch Name", + "branchDescription": "Branch Description", + "branchInfo": "Branch Info", + "defineServices": "Define Services", + "defineBranches": "Define Branches", + "defineProviders": "Define Providers", + "closeAccount": "Close Account", + "selectServiceCategory": "Select Service Category", + "selectService": "Select Service", + "selectBranch": "Select Branch", + "createBranch": "Create Branch", + "updateBranch": "Update Branch" } \ No newline at end of file diff --git a/lib/api/api_client.dart b/lib/api/api_client.dart index b59e938..8c9f2a4 100644 --- a/lib/api/api_client.dart +++ b/lib/api/api_client.dart @@ -8,6 +8,7 @@ import 'package:http/io_client.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/main.dart'; import 'package:mc_common_app/models/user/refresh_token.dart'; import 'package:mc_common_app/models/user/user.dart'; import 'package:mc_common_app/utils/shared_prefrence.dart'; @@ -203,6 +204,7 @@ class ApiClientImp implements ApiClient { } var response = await getJsonForResponse(url, token: token, queryParameters: queryParameters, headers: headers0, retryTimes: retryTimes); try { + logger.wtf(url); if (!kReleaseMode) { debugPrint("res:${response.body}"); } @@ -317,9 +319,9 @@ class ApiClientImp implements ApiClient { SharedPrefManager.setRefreshToken(refresh.data!.refreshToken ?? ""); String mdata = await SharedPrefManager.getData(); UserInfo info = UserInfo.fromJson(jsonDecode(mdata)); - User user = User(); - user.data = UserData(accessToken: refresh.data!.accessToken ?? "", refreshToken: refresh.data!.refreshToken ?? "", userInfo: info); + User user = User(); + user.data = UserData(accessToken: refresh.data!.accessToken ?? "", refreshToken: refresh.data!.refreshToken ?? "", userInfo: info); AppState().setUser = user; - return refresh.data!.accessToken??""; + return refresh.data!.accessToken ?? ""; } } diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index dc88a76..95d89a7 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -50,6 +50,17 @@ class ApiConsts { static String ServiceProviderService_Get = "${baseUrlServices}api/ServiceProviders/ServiceProviderService_Get"; static String BranchesAndServices = "${baseUrlServices}api/ServiceProviders/ServiceProviderDetail_Get"; + //Services & items + static String createService = "${baseUrlServices}api/ServiceProviders/Service_Create"; + static String createItems = "${baseUrlServices}api/ServiceProviders/ServiceItem_Create"; + static String getServiceItems = "${baseUrlServices}api/ServiceProviders/ServiceItem_Get"; + static String updateServiceItem = "${baseUrlServices}api/ServiceProviders/ServiceItem_Update"; + + //Schedule & Group + static String createSchedule = "${baseUrlServices}api/ServiceProviders/BranchAppointmentSchedule_Create"; + static String getSchedule = "${baseUrlServices}api/ServiceProviders/BranchAppointmentSchedule_Get"; + static String createGroup = "${baseUrlServices}api/ServiceProviders/BranchScheduleGroupService_Create"; + //Advertisement APIs static String vehicleTypeGet = "${baseUrlServices}api/ServiceProviders/VehicleType_Get"; static String vehicleModelGet = "${baseUrlServices}api/Master/VehicleModel_Get"; @@ -68,6 +79,9 @@ class ApiConsts { static String vehicleAdsSpecialServicesGet = "${baseUrlServices}api/Common/SpecialService_Get"; static String vehicleAdsSingleStepCreate = "${baseUrlServices}api/Advertisement/AdsSingleStep_Create"; static String vehicleAdsGet = "${baseUrlServices}api/Advertisement/Ads_Get"; + + //Subscription + static String getAllSubscriptions = "${baseUrlServices}api/Common/Subscription_Get"; } class GlobalConsts { diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 12353ee..18e8bbb 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -186,7 +186,18 @@ class CodegenLoader extends AssetLoader{ "my_recent_providers": "مزودي الخدمة الجدد", "my_active_ads": "إعلاناتي النشطة", "recommended_Ads": "الإعلانات الموصى بها", - "location": "موقع" + "location": "موقع", + "address": "عنوان", + "branchName": "اسم الفرع", + "branchDescription": "وصف الفرع", + "branchInfo": "معلومات الفرع", + "defineServices": "تحديد الخدمات", + "defineBranches": "تحديد الفروع", + "defineProviders": "تحديد الموفرين", + "closeAccount": "حساب مغلق", + "selectServiceCategory": "حدد فئة الخدمة", + "selectService": "حدد الخدمة", + "selectBranch": "حدد الفرع" }; static const Map en_US = { "firstTimeLogIn": "First Time Log In", @@ -352,8 +363,8 @@ static const Map en_US = { "tapToEdit": "Tap to edit", "myServiceBranches": "My Service Branches", "enter_licence_detail": "Please enter the detail for commercial records and attach the license images", - "country": "country", - "city": "city", + "country": "Country", + "city": "City", "editServices": "Edit Services", "maintenance": "Maintenance", "accessories_modifications": "Accessories and Modifications", @@ -361,7 +372,18 @@ static const Map en_US = { "my_active_ads": "My Active Ads", "recommended_Ads": "Recommended Ads", "select_services": "Select services you want", - "location": "Location" + "location": "Location", + "address": "Address", + "branchName": "Branch Name", + "branchDescription": "Branch Description", + "branchInfo": "Branch Info", + "defineServices": "Define Services", + "defineBranches": "Define Branches", + "defineProviders": "Define Providers", + "closeAccount": "Close Account", + "selectServiceCategory": "Select Service Category", + "selectService": "Select Service", + "selectBranch": "Select Branch" }; static const Map> mapLocales = {"ar_SA": ar_SA, "en_US": en_US}; } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 7e54e6e..cabfe5e 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -151,5 +151,16 @@ abstract class LocaleKeys { static const my_active_ads = 'my_active_ads'; static const recommended_Ads = 'recommended_Ads'; static const location = 'location'; + static const address = 'address'; + static const branchName = 'branchName'; + static const branchDescription = 'branchDescription'; + static const branchInfo = 'branchInfo'; + static const defineServices = 'defineServices'; + static const defineBranches = 'defineBranches'; + static const defineProviders = 'defineProviders'; + static const closeAccount = 'closeAccount'; + static const selectServiceCategory = 'selectServiceCategory'; + static const selectService = 'selectService'; + static const selectBranch = 'selectBranch'; } diff --git a/lib/models/m_response.dart b/lib/models/m_response.dart index 5926e33..856de8e 100644 --- a/lib/models/m_response.dart +++ b/lib/models/m_response.dart @@ -13,16 +13,19 @@ class MResponse { this.totalItemsCount, this.messageStatus, this.message, + this.data, }); int? totalItemsCount; int? messageStatus; String? message; + dynamic data; factory MResponse.fromJson(Map json) => MResponse( totalItemsCount: json["totalItemsCount"], messageStatus: json["messageStatus"], message: json["message"], + data: json["data"], ); Map toJson() => { diff --git a/lib/models/model/branch2.dart b/lib/models/model/branch2.dart index dd9df37..2fa672e 100644 --- a/lib/models/model/branch2.dart +++ b/lib/models/model/branch2.dart @@ -6,8 +6,6 @@ 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()); @@ -155,6 +153,9 @@ class ServiceProviderService { this.categoryId, this.categoryName, this.serviceStatus, + this.isAllowAppointment, + this.customerLocationRange, + this.rangePricePerKm, }); final int? serviceId; @@ -163,6 +164,9 @@ class ServiceProviderService { final int? categoryId; final String? categoryName; final int? serviceStatus; + final bool? isAllowAppointment; + final int? customerLocationRange; + final String? rangePricePerKm; factory ServiceProviderService.fromJson(Map json) => ServiceProviderService( serviceId: json["serviceID"] == null ? null : json["serviceID"], @@ -171,6 +175,9 @@ class ServiceProviderService { categoryId: json["categoryID"] == null ? null : json["categoryID"], categoryName: json["categoryName"] == null ? null : json["categoryName"], serviceStatus: json["serviceStatus"] == null ? null : json["serviceStatus"], + isAllowAppointment: json["isAllowAppointment"] == null ? null : json["isAllowAppointment"], + customerLocationRange: json["customerLocationRange"] == null ? null : json["customerLocationRange"], + rangePricePerKm: json["rangePricePerKm"] == null ? null : json["rangePricePerKm"].toString(), ); Map toJson() => { diff --git a/lib/models/profile/categroy.dart b/lib/models/profile/categroy.dart index 25fd487..eddcf64 100644 --- a/lib/models/profile/categroy.dart +++ b/lib/models/profile/categroy.dart @@ -24,14 +24,16 @@ class Category { int? messageStatus; String? message; - factory Category.fromJson(Map json) => Category( + 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"], ); - Map toJson() => { + Map toJson() => + { "totalItemsCount": totalItemsCount == null ? null : totalItemsCount, "data": data == null ? null : List.from(data!.map((x) => x.toJson())), "messageStatus": messageStatus == null ? null : messageStatus, @@ -48,6 +50,8 @@ class CategoryData extends Equatable { this.serviceCategoryIconUrl, this.serviceCategoryImageUrl, this.services, + this.branchId, + this.branchName, }); int? id; @@ -55,9 +59,12 @@ class CategoryData extends Equatable { String? categoryNameN; dynamic? serviceCategoryIconUrl; dynamic? serviceCategoryImageUrl; + String? branchId; + String? branchName; List? services; - factory CategoryData.fromJson(Map json) => CategoryData( + 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"], @@ -66,7 +73,8 @@ class CategoryData extends Equatable { services: [], ); - Map toJson() => { + Map toJson() => + { "id": id == null ? null : id, "categoryName": categoryName == null ? null : categoryName, "categoryNameN": categoryNameN == null ? null : categoryNameN, diff --git a/lib/theme/colors.dart b/lib/theme/colors.dart index 09fc842..3ea0c68 100644 --- a/lib/theme/colors.dart +++ b/lib/theme/colors.dart @@ -20,6 +20,7 @@ class MyColors { static const Color greyButtonColor = Color(0xffEBEBEB); static const Color grey70Color = Color(0xff707070); static const Color greyACColor = Color(0xffACACAC); + static const Color chipColor = Color(0xffE6E6E6); static const Color greyShadowColor = Color(0xFFE8E7E7); static const Color grey98Color = Color(0xff989898); static const Color lightGreyEFColor = Color(0xffEFEFEF); diff --git a/lib/utils/date_helper.dart b/lib/utils/date_helper.dart new file mode 100644 index 0000000..b41653c --- /dev/null +++ b/lib/utils/date_helper.dart @@ -0,0 +1,48 @@ +import 'package:intl/intl.dart'; + +class DateHelper { + static DateTime parseStringToDate(String dateString) { + final formatter = DateFormat('yyyy-MM-dd'); + return formatter.parse(dateString); + } + + static String formatAsShortDate(DateTime date) { + final formatter = DateFormat.yMd(); + return formatter.format(date); + } + + static String formatAsLongDate(DateTime date) { + final formatter = DateFormat.yMMMMEEEEd(); + return formatter.format(date); + } + + static String formatAsTime(DateTime date) { + final formatter = DateFormat.jm(); + return formatter.format(date); + } + + static String formatAsYearMonthDay(DateTime date) { + final formatter = DateFormat('y-MM-d'); + return date != null ? formatter.format(date) : "N/A"; + } + + static String formatAsCustomPattern(DateTime date, String pattern) { + final formatter = DateFormat(pattern); + return formatter.format(date); + } + + static String formatAsDayMonthYear(DateTime? date) { + final formatter = DateFormat('d MMM, y'); + return date != null ? formatter.format(date) : "N/A"; + } + + static String formatAsMonthDayYear(DateTime date) { + final formatter = DateFormat('MMMM d, y'); + return formatter.format(date); + } + + static String formatAsMonthYear(DateTime date) { + final formatter = DateFormat('MMMM y'); + return formatter.format(date); + } +} diff --git a/lib/utils/enums.dart b/lib/utils/enums.dart index 8c9b0fb..54acb6e 100644 --- a/lib/utils/enums.dart +++ b/lib/utils/enums.dart @@ -36,3 +36,12 @@ enum LoginType { } enum AppType { provider, customer } + +enum ServiceStatus { + pending, //1 + review, //2 + approvedOrActive, //3 + rejected, //4 + blocked, //5 + deactivated, //6 +} diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index 9bdd7a7..d35577c 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -4,6 +4,7 @@ import 'dart:typed_data'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; +import 'package:mc_common_app/utils/date_helper.dart'; import 'package:path/path.dart' as p; import 'package:fluttertoast/fluttertoast.dart'; @@ -18,26 +19,44 @@ class Utils { static void showToast(String message) { Fluttertoast.showToast( - msg: message, toastLength: Toast.LENGTH_SHORT, gravity: ToastGravity.BOTTOM, timeInSecForIosWeb: 2, backgroundColor: Colors.black54, textColor: Colors.white, fontSize: 16.0); + msg: message, + toastLength: Toast.LENGTH_SHORT, + gravity: ToastGravity.BOTTOM, + timeInSecForIosWeb: 2, + backgroundColor: Colors.black54, + textColor: Colors.white, + fontSize: 16.0); } - static Future pickDateFromDatePicker(BuildContext context) async { + static Future pickDateFromDatePicker(BuildContext context, {DateTime? firstDate, DateTime? lastDate}) async { DateTime? pickedDate = await showDatePicker( context: context, - - initialDate: DateTime.now(), //get today's date - firstDate: DateTime.now(), //DateTime.now() - not to allow to choose before today. - lastDate: DateTime(2101)); + firstDate: firstDate ?? DateTime.now(), //DateTime.now() - not to allow to choose before today. + lastDate: lastDate ?? DateTime(2101)); if (pickedDate == null) { return ""; } - String formattedDate = DateFormat.yMMMMd().format(pickedDate); // format date in required form here we use yyyy-MM-dd that means time is removed + String formattedDate = DateHelper.formatAsYearMonthDay(pickedDate); // format date in required form here we use yyyy-MM-dd that means time is removed return formattedDate; } + static Future pickTime(BuildContext context, {TimeOfDay? initialTime}) async { + TimeOfDay? timeOfDay = await showTimePicker(context: context, initialTime: initialTime ?? TimeOfDay.now()); + + if (timeOfDay == null) { + return ""; + } + + return ("${timeOfDay.hour + .toString() + .length == 1 ? "0" : ""}${timeOfDay.hour}:${timeOfDay.minute + .toString() + .length == 1 ? "0" : ""}${timeOfDay.minute}").toString(); + } + static dynamic getNotNullValue(List list, int index) { try { return list[index]; @@ -289,7 +308,7 @@ class Utils { border: Border.all( width: w, // color: color // <--- border width here - ), + ), borderRadius: BorderRadius.circular(radius), ); } @@ -312,7 +331,7 @@ class Utils { border: Border.all( width: 1, // color: color // <--- border width here - ), + ), borderRadius: BorderRadius.circular(radius), ); } diff --git a/lib/views/user/login_with_password_page.dart b/lib/views/user/login_with_password_page.dart index 0009ed9..b114723 100644 --- a/lib/views/user/login_with_password_page.dart +++ b/lib/views/user/login_with_password_page.dart @@ -28,7 +28,7 @@ class _LoginWithPasswordState extends State { int otpType = 1; ClassType type = ClassType.EMAIL; - String phoneNum = "", password = ""; + String phoneNum = "580816976", password = "123@Shf"; String email = ""; String countryCode = ""; Country? _country; diff --git a/lib/widgets/bottom_sheet.dart b/lib/widgets/bottom_sheet.dart new file mode 100644 index 0000000..b4a8b80 --- /dev/null +++ b/lib/widgets/bottom_sheet.dart @@ -0,0 +1,86 @@ +import 'package:flutter/material.dart'; +import 'package:mc_common_app/extensions/int_extensions.dart'; + +void showMyBottomSheet(BuildContext context, {required Widget child, VoidCallback? callBackFunc}) { + showModalBottomSheet( + context: context, + isScrollControlled: true, + backgroundColor: Colors.transparent, + builder: (BuildContext context) { + return Container( + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topRight: Radius.circular(25), + topLeft: Radius.circular(25), + ), + ), + clipBehavior: Clip.antiAlias, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + 13.height, + Container( + height: 6, + width: 60, + decoration: const BoxDecoration( + color: Color(0xff9A9A9A), + borderRadius: BorderRadius.all( + Radius.circular(20), + ), + ), + ), + 8.height, + child, + ], + ), + ); + }, + ).then((value) { + // print("BACK FROM DELEGATE!!!!"); + // print("value: $value"); + if (value == "delegate_reload") { + if (callBackFunc != null) callBackFunc(); + } + }); +} + +class BottomSheetItem extends StatelessWidget { + final Function onTap; + final IconData icon; + final String title; + final Color color; + + const BottomSheetItem({Key? key, required this.onTap, required this.title, required this.icon, this.color = Colors.black}) : super(key: key); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: () { + if (onTap != null) { + Navigator.pop(context); + onTap(); + } + }, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 18.0, vertical: 18.0), + child: Row( + children: [ + if (icon != null) + Icon( + icon, + color: color, + size: 18.0, + ), + if (icon != null) SizedBox(width: 24.0), + Text( + title ?? "", + style: TextStyle(color: color), + ), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/common_widgets/app_bar.dart b/lib/widgets/common_widgets/app_bar.dart index a30c28d..207aeba 100644 --- a/lib/widgets/common_widgets/app_bar.dart +++ b/lib/widgets/common_widgets/app_bar.dart @@ -60,7 +60,7 @@ import 'package:mc_common_app/widgets/extensions/extensions_widget.dart'; // @override // Size get preferredSize => const Size.fromHeight(kToolbarHeight); // } -class CustomAppBar extends StatelessWidget with PreferredSizeWidget { +class CustomAppBar extends StatelessWidget implements PreferredSizeWidget { final Color? backgroundColor; final double? elevation; final String? title; diff --git a/lib/widgets/tab/role_type_tab.dart b/lib/widgets/tab/role_type_tab.dart index ec80506..fa363ba 100644 --- a/lib/widgets/tab/role_type_tab.dart +++ b/lib/widgets/tab/role_type_tab.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:mc_common_app/extensions/int_extensions.dart'; import 'package:mc_common_app/theme/colors.dart'; @@ -8,8 +7,9 @@ class RoleTypeTab extends StatefulWidget { int selectedIndex; List dropList; Function(DropValue value) onSelect; + double? width; - RoleTypeTab(this.selectedIndex, this.dropList, {required this.onSelect}); + RoleTypeTab(this.selectedIndex, this.dropList, {required this.onSelect, this.width}); @override State createState() => _RoleTypeTabState(); @@ -31,7 +31,10 @@ class _RoleTypeTabState extends State { }); }, child: Container( - width: (MediaQuery.of(context).size.width / 2)-30, + width: widget.width ?? (MediaQuery + .of(context) + .size + .width / 2) - 30, height: 45, decoration: BoxDecoration( color: widget.selectedIndex == index ? MyColors.darkPrimaryColor : Colors.grey[200], @@ -43,7 +46,7 @@ class _RoleTypeTabState extends State { widget.dropList[index].value, style: TextStyle( color: widget.selectedIndex == index ? MyColors.white : Colors.black, - fontSize: 10, + fontSize: 15, ), ), ), diff --git a/lib/widgets/txt_field.dart b/lib/widgets/txt_field.dart index 15332cf..d02a23d 100644 --- a/lib/widgets/txt_field.dart +++ b/lib/widgets/txt_field.dart @@ -28,6 +28,7 @@ class TxtField extends StatelessWidget { Function(String)? onChanged; TextInputType? keyboardType; bool isBackgroundEnabled = false; + Widget? postfixWidget; TxtField({ Key? key, @@ -51,6 +52,7 @@ class TxtField extends StatelessWidget { this.isPasswordEnabled, this.keyboardType, this.isBackgroundEnabled = false, + this.postfixWidget, }) : super(key: key); @override @@ -107,7 +109,7 @@ class TxtField extends StatelessWidget { postfixData, color: postFixDataColor, ) - : null, + : postfixWidget ?? null, prefixIcon: prefixData != null ? const Icon(Icons.search, color: borderColor) : null, labelStyle: TextStyle(color: borderColor, fontSize: 13.sp), hintStyle: TextStyle(color: borderColor, fontSize: 9.sp), diff --git a/pubspec.lock b/pubspec.lock index 580abde..1ca2083 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -13,10 +13,10 @@ packages: dependency: transitive description: name: async - sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" url: "https://pub.dev" source: hosted - version: "2.10.0" + version: "2.11.0" auto_size_text: dependency: "direct main" description: @@ -77,10 +77,10 @@ packages: dependency: transitive description: name: characters - sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" clock: dependency: transitive description: @@ -93,10 +93,10 @@ packages: dependency: transitive description: name: collection - sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" url: "https://pub.dev" source: hosted - version: "1.17.0" + version: "1.17.1" cross_file: dependency: transitive description: @@ -133,10 +133,10 @@ packages: dependency: "direct main" description: name: easy_localization - sha256: "6a2e99fa0bfe5765bf4c6ca9b137d5de2c75593007178c5e4cd2ae985f870080" + sha256: f30e9b20ed4d1b890171c30241d9b9c43efe21fee55dee7bd68f94daf269ea75 url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2-dev.2" easy_logger: dependency: transitive description: @@ -425,18 +425,18 @@ packages: dependency: transitive description: name: intl - sha256: "910f85bce16fb5c6f614e117efa303e85a1731bb0081edf3604a2ae6e9a3cc91" + sha256: a3715e3bc90294e971cb7dc063fbf3cd9ee0ebf8604ffeafabd9e6f16abbdbe6 url: "https://pub.dev" source: hosted - version: "0.17.0" + version: "0.18.0" js: dependency: transitive description: name: js - sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 url: "https://pub.dev" source: hosted - version: "0.6.5" + version: "0.6.7" lints: dependency: transitive description: @@ -449,10 +449,42 @@ packages: dependency: "direct main" description: name: local_auth - sha256: d3fece0749101725b03206f84a7dab7aaafb702dbbd09131ff8d8173259a9b19 + sha256: "0cf238be2bfa51a6c9e7e9cfc11c05ea39f2a3a4d3e5bb255d0ebc917da24401" + url: "https://pub.dev" + source: hosted + version: "2.1.6" + local_auth_android: + dependency: transitive + description: + name: local_auth_android + sha256: c5e48c4a67fc0e5dd9b5725cc8766b67e2da9a54155c82c6e2ea4a0d1cf9ef93 + url: "https://pub.dev" + source: hosted + version: "1.0.28" + local_auth_ios: + dependency: transitive + description: + name: local_auth_ios + sha256: "503a938c4edde6b244c6ee3b1e2e675ddb7e37e79d5056658dbed1997cf04785" url: "https://pub.dev" source: hosted - version: "1.1.11" + version: "1.1.2" + local_auth_platform_interface: + dependency: transitive + description: + name: local_auth_platform_interface + sha256: "9e160d59ef0743e35f1b50f4fb84dc64f55676b1b8071e319ef35e7f3bc13367" + url: "https://pub.dev" + source: hosted + version: "1.0.7" + local_auth_windows: + dependency: transitive + description: + name: local_auth_windows + sha256: "19323b75ab781d5362dbb15dcb7e0916d2431c7a6dbdda016ec9708689877f73" + url: "https://pub.dev" + source: hosted + version: "1.0.8" logger: dependency: "direct main" description: @@ -465,10 +497,10 @@ packages: dependency: transitive description: name: matcher - sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" url: "https://pub.dev" source: hosted - version: "0.12.13" + version: "0.12.15" material_color_utilities: dependency: transitive description: @@ -481,10 +513,10 @@ packages: dependency: transitive description: name: meta - sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.1" nested: dependency: transitive description: @@ -505,10 +537,10 @@ packages: dependency: transitive description: name: path - sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.8.3" path_drawing: dependency: transitive description: @@ -830,10 +862,10 @@ packages: dependency: transitive description: name: test_api - sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb url: "https://pub.dev" source: hosted - version: "0.4.16" + version: "0.5.1" typed_data: dependency: transitive description: @@ -955,5 +987,5 @@ packages: source: hosted version: "6.1.0" sdks: - dart: ">=2.18.0 <3.0.0" + dart: ">=3.0.0-0 <4.0.0" flutter: ">=3.3.0" diff --git a/pubspec.yaml b/pubspec.yaml index 1f4ccf5..d6259a7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -28,7 +28,7 @@ dependencies: logger: ^1.1.0 auto_size_text: any shimmer: ^2.0.0 - local_auth: ^1.1.9 + local_auth: any hexcolor: ^2.0.4 cached_network_image: any url_launcher: ^6.1.7 @@ -36,7 +36,6 @@ dependencies: carousel_slider: ^4.2.1 dropdown_button2: ^2.0.0 - # google google_maps_flutter: ^2.1.1 geolocator: any From b7892099153c99d5fe0955eead010dcdf84fbf6f Mon Sep 17 00:00:00 2001 From: "mirza.shafique" Date: Sun, 4 Jun 2023 13:58:39 +0300 Subject: [PATCH 2/4] services changes --- assets/icons/ic_requests.svg | 2 + assets/langs/ar-SA.json | 4 +- assets/langs/en-US.json | 4 +- lib/classes/consts.dart | 1 + lib/generated/codegen_loader.g.dart | 14 +- lib/generated/locale_keys.g.dart | 4 + lib/models/profile/services.dart | 22 +- lib/models/schedule_model.dart | 127 ++++++++++ .../common_widgets/bottom_nav_bar.dart | 37 ++- pubspec.lock | 236 +++++++++--------- 10 files changed, 312 insertions(+), 139 deletions(-) create mode 100644 lib/models/schedule_model.dart diff --git a/assets/icons/ic_requests.svg b/assets/icons/ic_requests.svg index c6fd34a..17729af 100644 --- a/assets/icons/ic_requests.svg +++ b/assets/icons/ic_requests.svg @@ -1,3 +1,5 @@ + + diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index ba7d926..ad5189c 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -183,5 +183,7 @@ "selectService": "حدد الخدمة", "selectBranch": "حدد الفرع", "createBranch": "Create Branch", - "updateBranch": "Update Branch" + "updateBranch": "Update Branch", + "branches": "Branches", + "requests": "Requests" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index dd6bc7a..51222f7 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -184,5 +184,7 @@ "selectService": "Select Service", "selectBranch": "Select Branch", "createBranch": "Create Branch", - "updateBranch": "Update Branch" + "updateBranch": "Update Branch", + "branches": "Branches", + "requests": "Requests" } \ No newline at end of file diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index 95d89a7..881e8c1 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -57,6 +57,7 @@ class ApiConsts { static String updateServiceItem = "${baseUrlServices}api/ServiceProviders/ServiceItem_Update"; //Schedule & Group + static String getServicesOfBranch = "${baseUrlServices}api/ServiceProviders/ServiceProviderService_Get"; static String createSchedule = "${baseUrlServices}api/ServiceProviders/BranchAppointmentSchedule_Create"; static String getSchedule = "${baseUrlServices}api/ServiceProviders/BranchAppointmentSchedule_Get"; static String createGroup = "${baseUrlServices}api/ServiceProviders/BranchScheduleGroupService_Create"; diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 18e8bbb..0f9ec0b 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -10,7 +10,7 @@ class CodegenLoader extends AssetLoader{ const CodegenLoader(); @override - Future> load(String fullPath, Locale locale ) { + Future?> load(String path, Locale locale) { return Future.value(mapLocales[locale.toString()]); } @@ -197,7 +197,11 @@ class CodegenLoader extends AssetLoader{ "closeAccount": "حساب مغلق", "selectServiceCategory": "حدد فئة الخدمة", "selectService": "حدد الخدمة", - "selectBranch": "حدد الفرع" + "selectBranch": "حدد الفرع", + "createBranch": "Create Branch", + "updateBranch": "Update Branch", + "branches": "Branches", + "requests": "Requests" }; static const Map en_US = { "firstTimeLogIn": "First Time Log In", @@ -383,7 +387,11 @@ static const Map en_US = { "closeAccount": "Close Account", "selectServiceCategory": "Select Service Category", "selectService": "Select Service", - "selectBranch": "Select Branch" + "selectBranch": "Select Branch", + "createBranch": "Create Branch", + "updateBranch": "Update Branch", + "branches": "Branches", + "requests": "Requests" }; static const Map> mapLocales = {"ar_SA": ar_SA, "en_US": en_US}; } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index cabfe5e..8bccc18 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -162,5 +162,9 @@ abstract class LocaleKeys { static const selectServiceCategory = 'selectServiceCategory'; static const selectService = 'selectService'; static const selectBranch = 'selectBranch'; + static const createBranch = 'createBranch'; + static const updateBranch = 'updateBranch'; + static const branches = 'branches'; + static const requests = 'requests'; } diff --git a/lib/models/profile/services.dart b/lib/models/profile/services.dart index d296300..1d3d7ec 100644 --- a/lib/models/profile/services.dart +++ b/lib/models/profile/services.dart @@ -21,14 +21,16 @@ class Services { int? messageStatus; String? message; - factory Services.fromJson(Map json) => Services( + factory Services.fromJson(Map json) => + Services( totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"], data: json["data"] == null ? null : List.from(json["data"].map((x) => ServicesData.fromJson(x))), messageStatus: json["messageStatus"] == null ? null : json["messageStatus"], message: json["message"] == null ? null : json["message"], ); - Map toJson() => { + Map toJson() => + { "totalItemsCount": totalItemsCount == null ? null : totalItemsCount, "data": data == null ? null : List.from(data!.map((x) => x.toJson())), "messageStatus": messageStatus == null ? null : messageStatus, @@ -57,18 +59,20 @@ class ServicesData { dynamic? categoryName; bool? isSelected; - factory ServicesData.fromJson(Map json) => ServicesData( + factory ServicesData.fromJson(Map json) => + ServicesData( id: json["id"] == null ? null : json["id"], - description: json["description"] == null ? null : json["description"], - descriptionN: json["descriptionN"] == null ? null : json["descriptionN"], - serviceIconUrl: json["serviceIconUrl"], - serviceImageUrl: json["serviceImageUrl"], + description: json["description"] == null ? (json["serviceDescription"] == null ? null : json["serviceDescription"]) : json["description"], + descriptionN: json["descriptionN"] == null ? (json["serviceDescriptionN"] == null ? null : json["serviceDescriptionN"]) : json["descriptionN"], + serviceIconUrl: json["serviceIconUrl"] == null ? null : json["serviceIconUrl"], + serviceImageUrl: json["serviceImageUrl"] == null ? null : json["serviceImageUrl"], serviceCategoryId: json["serviceCategoryID"] == null ? null : json["serviceCategoryID"], - categoryName: json["categoryName"], + categoryName: json["categoryName"] == null ? null : json["categoryName"], isSelected: false, ); - Map toJson() => { + Map toJson() => + { "id": id == null ? null : id, "description": description == null ? null : description, "descriptionN": descriptionN == null ? null : descriptionN, diff --git a/lib/models/schedule_model.dart b/lib/models/schedule_model.dart new file mode 100644 index 0000000..642c8d8 --- /dev/null +++ b/lib/models/schedule_model.dart @@ -0,0 +1,127 @@ +// To parse this JSON data, do +// +// final schedule = scheduleFromJson(jsonString); + +import 'dart:convert'; + +Schedule scheduleFromJson(String str) => Schedule.fromJson(json.decode(str)); + +String scheduleToJson(Schedule data) => json.encode(data.toJson()); + +class Schedule { + final int? messageStatus; + final int? totalItemsCount; + final List? data; + final String? message; + + Schedule({ + this.messageStatus, + this.totalItemsCount, + this.data, + this.message, + }); + + factory Schedule.fromJson(Map json) => Schedule( + messageStatus: json["messageStatus"], + totalItemsCount: json["totalItemsCount"], + data: json["data"] == null ? [] : List.from(json["data"]!.map((x) => ScheduleData.fromJson(x))), + message: json["message"], + ); + + Map toJson() => { + "messageStatus": messageStatus, + "totalItemsCount": totalItemsCount, + "data": data == null ? [] : List.from(data!.map((x) => x.toJson())), + "message": message, + }; +} + +class ScheduleData { + final int? id; + final String? scheduleName; + final int? serviceProviderBranchId; + final DateTime? fromDate; + final DateTime? toDate; + final String? startTime; + final String? endTime; + final int? slotDurationMinute; + final int? perSlotAppointment; + final String? branchName; + final String? address; + final String? latitude; + final String? longitude; + final List? scheduleServices; + String branchId; + + ScheduleData({ + this.id, + this.scheduleName, + this.serviceProviderBranchId, + this.fromDate, + this.toDate, + this.startTime, + this.endTime, + this.slotDurationMinute, + this.perSlotAppointment, + this.branchName, + this.address, + this.latitude, + this.longitude, + this.scheduleServices, + this.branchId = "", + }); + + factory ScheduleData.fromJson(Map json) => ScheduleData( + id: json["id"], + scheduleName: json["scheduleName"], + serviceProviderBranchId: json["serviceProviderBranchID"], + fromDate: json["fromDate"] == null ? null : DateTime.parse(json["fromDate"]), + toDate: json["toDate"] == null ? null : DateTime.parse(json["toDate"]), + startTime: json["startTime"], + endTime: json["endTime"], + slotDurationMinute: json["slotDurationMinute"], + perSlotAppointment: json["perSlotAppointment"], + branchName: json["branchName"], + address: json["address"], + latitude: json["latitude"], + longitude: json["longitude"], + scheduleServices: json["scheduleServices"] == null ? [] : List.from(json["scheduleServices"]!.map((x) => ScheduleService.fromJson(x))), + ); + + Map toJson() => { + "id": id, + "scheduleName": scheduleName, + "serviceProviderBranchID": serviceProviderBranchId, + "fromDate": fromDate?.toIso8601String(), + "toDate": toDate?.toIso8601String(), + "startTime": startTime, + "endTime": endTime, + "slotDurationMinute": slotDurationMinute, + "perSlotAppointment": perSlotAppointment, + "branchName": branchName, + "address": address, + "latitude": latitude, + "longitude": longitude, + "scheduleServices": scheduleServices == null ? [] : List.from(scheduleServices!.map((x) => x.toJson())), + }; +} + +class ScheduleService { + final int? providerServiceId; + final String? providerServiceName; + + ScheduleService({ + this.providerServiceId, + this.providerServiceName, + }); + + factory ScheduleService.fromJson(Map json) => ScheduleService( + providerServiceId: json["providerServiceID"], + providerServiceName: json["providerServiceName"], + ); + + Map toJson() => { + "providerServiceID": providerServiceId, + "providerServiceName": providerServiceName, + }; +} diff --git a/lib/widgets/common_widgets/bottom_nav_bar.dart b/lib/widgets/common_widgets/bottom_nav_bar.dart index e4b01b7..c65aadf 100644 --- a/lib/widgets/common_widgets/bottom_nav_bar.dart +++ b/lib/widgets/common_widgets/bottom_nav_bar.dart @@ -9,18 +9,26 @@ import 'package:mc_common_app/widgets/extensions/extensions_widget.dart'; class CustomBottomNavbar extends StatelessWidget { final int selectedNavbarBarIndex; final Function(int) onSelected; + bool isProvider; - const CustomBottomNavbar({Key? key, required this.onSelected, required this.selectedNavbarBarIndex}) : super(key: key); + CustomBottomNavbar({Key? key, required this.onSelected, required this.selectedNavbarBarIndex, this.isProvider = false}) : super(key: key); @override Widget build(BuildContext context) { return BottomNavigationBar( items: [ - BottomNavigationBarItem( - icon: SvgPicture.asset(MyAssets.providersIcon).paddingAll(5), - activeIcon: SvgPicture.asset(MyAssets.providersIcon, color: MyColors.darkIconColor).paddingAll(5), - label: LocaleKeys.providers.tr(), - ), + if (isProvider) + BottomNavigationBarItem( + icon: SvgPicture.asset(MyAssets.icBranches).paddingAll(5), + activeIcon: SvgPicture.asset(MyAssets.icBranches, color: MyColors.darkIconColor).paddingAll(5), + label: LocaleKeys.branches.tr(), + ), + if (!isProvider) + BottomNavigationBarItem( + icon: SvgPicture.asset(MyAssets.providersIcon).paddingAll(5), + activeIcon: SvgPicture.asset(MyAssets.providersIcon, color: MyColors.darkIconColor).paddingAll(5), + label: LocaleKeys.providers.tr(), + ), BottomNavigationBarItem( icon: SvgPicture.asset(MyAssets.appointmentsIcon).paddingAll(5), activeIcon: SvgPicture.asset(MyAssets.appointmentsIcon, color: MyColors.darkIconColor).paddingAll(5), @@ -39,11 +47,18 @@ class CustomBottomNavbar extends StatelessWidget { activeIcon: SvgPicture.asset(MyAssets.announcementIcon, color: MyColors.darkIconColor).paddingAll(5), label: LocaleKeys.ads.tr(), ), - BottomNavigationBarItem( - icon: SvgPicture.asset(MyAssets.settingsIcon).paddingAll(5), - activeIcon: SvgPicture.asset(MyAssets.settingsIcon, color: MyColors.darkIconColor).paddingAll(5), - label: LocaleKeys.settings.tr(), - ), + if (isProvider) + BottomNavigationBarItem( + icon: SvgPicture.asset(MyAssets.icRequests).paddingAll(5), + activeIcon: SvgPicture.asset(MyAssets.icRequests, color: MyColors.darkIconColor).paddingAll(5), + label: LocaleKeys.requests.tr(), + ), + if (!isProvider) + BottomNavigationBarItem( + icon: SvgPicture.asset(MyAssets.settingsIcon).paddingAll(5), + activeIcon: SvgPicture.asset(MyAssets.settingsIcon, color: MyColors.darkIconColor).paddingAll(5), + label: LocaleKeys.settings.tr(), + ), ], currentIndex: selectedNavbarBarIndex, type: BottomNavigationBarType.fixed, diff --git a/pubspec.lock b/pubspec.lock index 1ca2083..7d3910c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: args - sha256: "4cab82a83ffef80b262ddedf47a0a8e56ee6fbf7fe21e6e768b02792034dd440" + sha256: c372bb384f273f0c2a8aaaa226dad84dc27c8519a691b888725dec59518ad53a url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.4.1" async: dependency: transitive description: @@ -29,10 +29,10 @@ packages: dependency: "direct main" description: name: badges - sha256: "461031a60efbb95276f52107f63d5d45008b5ca1eb7f8ca440cadda9ec2143b0" + sha256: "6e7f3ec561ec08f47f912cfe349d4a1707afdc8dda271e17b046aa6d42c89e77" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.1.1" boolean_selector: dependency: transitive description: @@ -45,26 +45,26 @@ packages: dependency: "direct main" description: name: cached_network_image - sha256: e764e48ef036cabdf84319ba7b8b5871b6b43266e14de787cb43f77639089ae5 + sha256: fd3d0dc1d451f9a252b32d95d3f0c3c487bc41a75eba2e6097cb0b9c71491b15 url: "https://pub.dev" source: hosted - version: "3.2.1" + version: "3.2.3" cached_network_image_platform_interface: dependency: transitive description: name: cached_network_image_platform_interface - sha256: "8e2b5befefec5063bee8f209fda21751f6328d405d4237c70f21104568b2fee7" + sha256: bb2b8403b4ccdc60ef5f25c70dead1f3d32d24b9d6117cfc087f496b178594a7 url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "2.0.0" cached_network_image_web: dependency: transitive description: name: cached_network_image_web - sha256: d4351c7eb16767df129b0474a5ebc4e028870379c063e8ba265a56aa00831e70 + sha256: b8eb814ebfcb4dea049680f8c1ffb2df399e4d03bf7a352c775e26fa06e02fa0 url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.0.2" carousel_slider: dependency: "direct main" description: @@ -125,18 +125,18 @@ packages: dependency: "direct main" description: name: dropdown_button2 - sha256: "4458d81bfd24207f3d58f66f78097064e02f810f94cf1bc80bf20fe7685ebc80" + sha256: "374f2390161bf782b4896f0b1b24cbb2b5daaa1cfb11047c3307461dcdf44e07" url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.1.3" easy_localization: dependency: "direct main" description: name: easy_localization - sha256: f30e9b20ed4d1b890171c30241d9b9c43efe21fee55dee7bd68f94daf269ea75 + sha256: "30ebf25448ffe169e0bd9bc4b5da94faa8398967a2ad2ca09f438be8b6953645" url: "https://pub.dev" source: hosted - version: "3.0.2-dev.2" + version: "3.0.2" easy_logger: dependency: transitive description: @@ -223,10 +223,10 @@ packages: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: "60fc7b78455b94e6de2333d2f95196d32cf5c22f4b0b0520a628804cb463503b" + sha256: "950e77c2bbe1692bc0874fc7fb491b96a4dc340457f4ea1641443d0a6c1ea360" url: "https://pub.dev" source: hosted - version: "2.0.7" + version: "2.0.15" flutter_svg: dependency: "direct main" description: @@ -249,18 +249,34 @@ packages: dependency: "direct main" description: name: fluttertoast - sha256: "7cc92eabe01e3f1babe1571c5560b135dfc762a34e41e9056881e2196b178ec1" + sha256: "474f7d506230897a3cd28c965ec21c5328ae5605fc9c400cd330e9e9d6ac175c" url: "https://pub.dev" source: hosted - version: "8.1.2" + version: "8.2.2" geocoding: dependency: "direct main" description: name: geocoding - sha256: "26218460a902d4249b81e6baf9d55ce400fd1ebe6fc0a7e92b2c12b0b8e1e14e" + sha256: b34c0501bbbaf3190b85bef3078b27cf66c28a8915c6d3af50d67f356aa7da31 url: "https://pub.dev" source: hosted - version: "2.0.5" + version: "2.1.0" + geocoding_android: + dependency: transitive + description: + name: geocoding_android + sha256: "5a1fc0cec9b0497b44ca31c1fa8d1c891f3aded1053e6bb2eac075d3bd1bf046" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + geocoding_ios: + dependency: transitive + description: + name: geocoding_ios + sha256: c85495ce8fb34e4fbd2dd8fc5f79263d622d9f88c4af948c965daf6b27a7f3a1 + url: "https://pub.dev" + source: hosted + version: "2.1.0" geocoding_platform_interface: dependency: transitive description: @@ -281,18 +297,18 @@ packages: dependency: transitive description: name: geolocator_android - sha256: fe90565c3a8789dc3b433d8f95cdb18343f9bde298a419d978337ba1ae1037d3 + sha256: "6cd3c622df085a79fd61f5c14fa024c3ba593aa6b1df2ee809ac59f45e6a9861" url: "https://pub.dev" source: hosted - version: "4.1.4" + version: "4.1.8" geolocator_apple: dependency: transitive description: name: geolocator_apple - sha256: "567cf6d9879b4c33b2bd8bbfff0995e75c62a14f87b1480c8522c5dca5d3b166" + sha256: "22b60ca3b8c0f58e6a9688ff855ee39ab813ca3f0c0609a48d282f6631266f2e" url: "https://pub.dev" source: hosted - version: "2.2.3" + version: "2.2.5" geolocator_platform_interface: dependency: transitive description: @@ -321,34 +337,34 @@ packages: dependency: "direct main" description: name: google_maps_flutter - sha256: "0c6b72b4b1e0f6204973e2b40868a75fe6380725d498f215cd7e35ed920d1c57" + sha256: abefcb1e5e5c96bdd8084939dda555257af272c7972902ca46d5631092c1df68 url: "https://pub.dev" source: hosted - version: "2.2.3" + version: "2.2.8" google_maps_flutter_android: dependency: transitive description: name: google_maps_flutter_android - sha256: "701761b234579b4cfc0f6ae0791e2bb7184b31207b0d716e536b6d1a190dc143" + sha256: "9512c862df77c1f0fa5f445513dd3c57f5996f0a809dccb74e54b690ee4e3a0f" url: "https://pub.dev" source: hosted - version: "2.4.3" + version: "2.4.15" google_maps_flutter_ios: dependency: transitive description: name: google_maps_flutter_ios - sha256: "33bbca8d4148ed373251ea2ec2344fdc63009926b6d6be71a0854fd42409b1ba" + sha256: a9462a433bf3ebe60aadcf4906d2d6341a270d69d3e0fcaa8eb2b64699fcfb4f url: "https://pub.dev" source: hosted - version: "2.1.13" + version: "2.2.3" google_maps_flutter_platform_interface: dependency: transitive description: name: google_maps_flutter_platform_interface - sha256: "0967430c25240836b794d42336bd4c61f0e78e9fd33d1365fa9316bb36b6b410" + sha256: "308f0af138fa78e8224d598d46ca182673874d0ef4d754b7157c073b5b4b8e0d" url: "https://pub.dev" source: hosted - version: "2.2.5" + version: "2.2.7" hexcolor: dependency: "direct main" description: @@ -377,18 +393,18 @@ packages: dependency: "direct main" description: name: image_picker - sha256: "64b21d9f0e065f9ab0e4dde458076226c97382cc0c6949144cb874c62bf8e9f8" + sha256: "9978d3510af4e6a902e545ce19229b926e6de6a1828d6134d3aab2e129a4d270" url: "https://pub.dev" source: hosted - version: "0.8.7" + version: "0.8.7+5" image_picker_android: dependency: transitive description: name: image_picker_android - sha256: b81db5f5ed8a69d54d5f0932c2af8120e8c0518a037d8beee494eec671da4d4c + sha256: c2f3c66400649bd132f721c88218945d6406f693092b2f741b79ae9cdb046e59 url: "https://pub.dev" source: hosted - version: "0.8.6+5" + version: "0.8.6+16" image_picker_for_web: dependency: transitive description: @@ -401,10 +417,10 @@ packages: dependency: transitive description: name: image_picker_ios - sha256: "50e882fe0a06bf0c8f7f5bce78d30975f279213293afc9471dc35f05617c50ff" + sha256: d779210bda268a03b57e923fb1e410f32f5c5e708ad256348bcbf1f44f558fd0 url: "https://pub.dev" source: hosted - version: "0.8.7+1" + version: "0.8.7+4" image_picker_platform_interface: dependency: transitive description: @@ -465,10 +481,10 @@ packages: dependency: transitive description: name: local_auth_ios - sha256: "503a938c4edde6b244c6ee3b1e2e675ddb7e37e79d5056658dbed1997cf04785" + sha256: edc2977c5145492f3451db9507a2f2f284ee4f408950b3e16670838726761940 url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.1.3" local_auth_platform_interface: dependency: transitive description: @@ -489,10 +505,10 @@ packages: dependency: "direct main" description: name: logger - sha256: "5076f09225f91dc49289a4ccb92df2eeea9ea01cf7c26d49b3a1f04c6a49eec1" + sha256: db2ff852ed77090ba9f62d3611e4208a3d11dfa35991a81ae724c113fcb3e3f7 url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.3.0" matcher: dependency: transitive description: @@ -561,50 +577,42 @@ packages: dependency: "direct main" description: name: path_provider - sha256: "050e8e85e4b7fecdf2bb3682c1c64c4887a183720c802d323de8a5fd76d372dd" + sha256: "3087813781ab814e4157b172f1a11c46be20179fcc9bea043e0fba36bc0acaa2" url: "https://pub.dev" source: hosted - version: "2.0.11" + version: "2.0.15" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: a776c088d671b27f6e3aa8881d64b87b3e80201c64e8869b811325de7a76c15e + sha256: "2cec049d282c7f13c594b4a73976b0b4f2d7a1838a6dd5aaf7bd9719196bee86" url: "https://pub.dev" source: hosted - version: "2.0.22" - path_provider_ios: + version: "2.0.27" + path_provider_foundation: dependency: transitive description: - name: path_provider_ios - sha256: "03d639406f5343478352433f00d3c4394d52dac8df3d847869c5e2333e0bbce8" + name: path_provider_foundation + sha256: "1995d88ec2948dac43edf8fe58eb434d35d22a2940ecee1a9fefcd62beee6eb3" url: "https://pub.dev" source: hosted - version: "2.0.11" + version: "2.2.3" path_provider_linux: dependency: transitive description: name: path_provider_linux - sha256: ab0987bf95bc591da42dffb38c77398fc43309f0b9b894dcc5d6f40c4b26c379 + sha256: ffbb8cc9ed2c9ec0e4b7a541e56fd79b138e8f47d2fb86815f15358a349b3b57 url: "https://pub.dev" source: hosted - version: "2.1.7" - path_provider_macos: - dependency: transitive - description: - name: path_provider_macos - sha256: cd57cb98a30ce9d12fdd1896d9d3b0517ce689f942de6ccd2708cd39b3d18a7c - url: "https://pub.dev" - source: hosted - version: "2.0.7" + version: "2.1.11" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - sha256: f0abc8ebd7253741f05488b4813d936b4d07c6bae3e86148a09e342ee4b08e76 + sha256: "57585299a729335f1298b43245842678cb9f43a6310351b18fb577d6e33165ec" url: "https://pub.dev" source: hosted - version: "2.0.5" + version: "2.0.6" path_provider_windows: dependency: transitive description: @@ -625,26 +633,26 @@ packages: dependency: "direct main" description: name: permission_handler - sha256: "5749ebeb7ec0c3865ea17e3eb337174b87747be816dab582c551e1aff6f6bbf3" + sha256: "33c6a1253d1f95fd06fa74b65b7ba907ae9811f9d5c1d3150e51417d04b8d6a8" url: "https://pub.dev" source: hosted - version: "9.2.0" + version: "10.2.0" permission_handler_android: dependency: transitive description: name: permission_handler_android - sha256: a512e0fa8abcb0659d938ec2df93a70eb1df1fdea5fdc6d79a866bfd858a28fc + sha256: d8cc6a62ded6d0f49c6eac337e080b066ee3bce4d405bd9439a61e1f1927bfe8 url: "https://pub.dev" source: hosted - version: "9.0.2+1" + version: "10.2.1" permission_handler_apple: dependency: transitive description: name: permission_handler_apple - sha256: "9c370ef6a18b1c4b2f7f35944d644a56aa23576f23abee654cf73968de93f163" + sha256: ee96ac32f5a8e6f80756e25b25b9f8e535816c8e6665a96b6d70681f8c4f7e85 url: "https://pub.dev" source: hosted - version: "9.0.7" + version: "9.0.8" permission_handler_platform_interface: dependency: transitive description: @@ -665,10 +673,10 @@ packages: dependency: transitive description: name: petitparser - sha256: "2ebb289dc4764ec397f5cd3ca9881c6d17196130a7d646ed022a0dd9c2e25a71" + sha256: "49392a45ced973e8d94a85fdb21293fbb40ba805fc49f2965101ae748a3683b4" url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "5.1.0" platform: dependency: transitive description: @@ -681,10 +689,10 @@ packages: dependency: transitive description: name: plugin_platform_interface - sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a + sha256: "6a2128648c854906c53fa8e33986fc0247a1116122f9534dd20e3ab9e16a32bc" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.4" process: dependency: transitive description: @@ -713,58 +721,58 @@ packages: dependency: "direct main" description: name: shared_preferences - sha256: "5949029e70abe87f75cfe59d17bf5c397619c4b74a099b10116baeb34786fad9" + sha256: "16d3fb6b3692ad244a695c0183fca18cf81fd4b821664394a781de42386bf022" url: "https://pub.dev" source: hosted - version: "2.0.17" + version: "2.1.1" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - sha256: "955e9736a12ba776bdd261cf030232b30eadfcd9c79b32a3250dd4a494e8c8f7" + sha256: "6478c6bbbecfe9aced34c483171e90d7c078f5883558b30ec3163cf18402c749" url: "https://pub.dev" source: hosted - version: "2.0.15" + version: "2.1.4" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: "1ffa239043ab8baf881ec3094a3c767af9d10399b2839020b9e4d44c0bb23951" + sha256: e014107bb79d6d3297196f4f2d0db54b5d1f85b8ea8ff63b8e8b391a02700feb url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.2.2" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - sha256: f8ea038aa6da37090093974ebdcf4397010605fd2ff65c37a66f9d28394cb874 + sha256: "9d387433ca65717bbf1be88f4d5bb18f10508917a8fa2fb02e0fd0d7479a9afa" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.2.0" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - sha256: da9431745ede5ece47bc26d5d73a9d3c6936ef6945c101a5aca46f62e52c1cf3 + sha256: fb5cf25c0235df2d0640ac1b1174f6466bd311f621574997ac59018a6664548d url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.2.0" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - sha256: a4b5bc37fe1b368bbc81f953197d55e12f49d0296e7e412dfe2d2d77d6929958 + sha256: "74083203a8eae241e0de4a0d597dbedab3b8fef5563f33cf3c12d7e93c655ca5" url: "https://pub.dev" source: hosted - version: "2.0.4" + version: "2.1.0" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - sha256: "5eaf05ae77658d3521d0e993ede1af962d4b326cd2153d312df716dc250f00c9" + sha256: "5e588e2efef56916a3b229c3bfe81e6a525665a454519ca51dbcc4236a274173" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.2.0" shimmer: dependency: "direct main" description: @@ -798,18 +806,18 @@ packages: dependency: transitive description: name: sqflite - sha256: b3a8307b9519af28518e271e548594bdc435225fc77e8fb22e71a296c69281cf + sha256: b4d6710e1200e96845747e37338ea8a819a12b51689a3bcf31eff0003b37a0b9 url: "https://pub.dev" source: hosted - version: "2.0.3+1" + version: "2.2.8+4" sqflite_common: dependency: transitive description: name: sqflite_common - sha256: "4aa3b917d48f9a3161419efa4a901e33a38721bf9a7465e7e07d2d6ef8895276" + sha256: e77abf6ff961d69dfef41daccbb66b51e9983cdd5cb35bf30733598057401555 url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.4.5" stack_trace: dependency: transitive description: @@ -846,10 +854,10 @@ packages: dependency: transitive description: name: synchronized - sha256: "7b530acd9cb7c71b0019a1e7fa22c4105e675557a4400b6a401c71c5e0ade1ac" + sha256: "5fcbd27688af6082f5abd611af56ee575342c30e87541d0245f7ff99faa02c60" url: "https://pub.dev" source: hosted - version: "3.0.0+3" + version: "3.1.0" term_glyph: dependency: transitive description: @@ -870,82 +878,82 @@ packages: dependency: transitive description: name: typed_data - sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.3.2" universal_io: dependency: transitive description: name: universal_io - sha256: "79f78ddad839ee3aae3ec7c01eb4575faf0d5c860f8e5223bc9f9c17f7f03cef" + sha256: "06866290206d196064fd61df4c7aea1ffe9a4e7c4ccaa8fcded42dd41948005d" url: "https://pub.dev" source: hosted - version: "2.0.4" + version: "2.2.0" url_launcher: dependency: "direct main" description: name: url_launcher - sha256: "698fa0b4392effdc73e9e184403b627362eb5fbf904483ac9defbb1c2191d809" + sha256: eb1e00ab44303d50dd487aab67ebc575456c146c6af44422f9c13889984c00f3 url: "https://pub.dev" source: hosted - version: "6.1.8" + version: "6.1.11" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: "3e2f6dfd2c7d9cd123296cab8ef66cfc2c1a13f5845f42c7a0f365690a8a7dd1" + sha256: eed4e6a1164aa9794409325c3b707ff424d4d1c2a785e7db67f8bbda00e36e51 url: "https://pub.dev" source: hosted - version: "6.0.23" + version: "6.0.35" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: bb328b24d3bccc20bdf1024a0990ac4f869d57663660de9c936fb8c043edefe3 + sha256: "9af7ea73259886b92199f9e42c116072f05ff9bea2dcb339ab935dfc957392c2" url: "https://pub.dev" source: hosted - version: "6.0.18" + version: "6.1.4" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - sha256: "318c42cba924e18180c029be69caf0a1a710191b9ec49bb42b5998fdcccee3cc" + sha256: "207f4ddda99b95b4d4868320a352d374b0b7e05eefad95a4a26f57da413443f5" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.5" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - sha256: "41988b55570df53b3dd2a7fc90c76756a963de6a8c5f8e113330cb35992e2094" + sha256: "91ee3e75ea9dadf38036200c5d3743518f4a5eb77a8d13fda1ee5764373f185e" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.5" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface - sha256: "4eae912628763eb48fc214522e58e942fd16ce195407dbf45638239523c759a6" + sha256: "6c9ca697a5ae218ce56cece69d46128169a58aa8653c1b01d26fcd4aad8c4370" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: "44d79408ce9f07052095ef1f9a693c258d6373dc3944249374e30eff7219ccb0" + sha256: "6bb1e5d7fe53daf02a8fee85352432a40b1f868a81880e99ec7440113d5cfcab" url: "https://pub.dev" source: hosted - version: "2.0.14" + version: "2.0.17" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - sha256: "387e227c4b979034cc52afb11d66b04ed9b288ca1f45beeef39b2ea69e714fa5" + sha256: "254708f17f7c20a9c8c471f67d86d76d4a3f9c1591aad1e15292008aceb82771" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.6" uuid: dependency: transitive description: @@ -974,10 +982,10 @@ packages: dependency: transitive description: name: xdg_directories - sha256: bd512f03919aac5f1313eb8249f223bacf4927031bf60b02601f81f687689e86 + sha256: ee1505df1426458f7f60aac270645098d318a8b4766d85fde75f76f2e21807d1 url: "https://pub.dev" source: hosted - version: "0.2.0+3" + version: "1.0.0" xml: dependency: transitive description: From e8fcaaa2a3a7242d6a079a483a7d41ccd7226840 Mon Sep 17 00:00:00 2001 From: "mirza.shafique" Date: Tue, 6 Jun 2023 11:51:42 +0300 Subject: [PATCH 3/4] service days --- lib/classes/consts.dart | 2 ++ lib/models/schedule_model.dart | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index 5c922ce..688eae5 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -65,7 +65,9 @@ class ApiConsts { static String getServicesOfBranch = "${baseUrlServices}api/ServiceProviders/ServiceProviderService_Get"; static String createSchedule = "${baseUrlServices}api/ServiceProviders/BranchAppointmentSchedule_Create"; static String getSchedule = "${baseUrlServices}api/ServiceProviders/BranchAppointmentSchedule_Get"; + static String updateSchedule = "${baseUrlServices}api/ServiceProviders/BranchAppointmentSchedule_Update"; static String createGroup = "${baseUrlServices}api/ServiceProviders/BranchScheduleGroupService_Create"; + static String updateGroup = "${baseUrlServices}api/ServiceProviders/BranchScheduleGroupService_Update"; //Advertisement APIs static String vehicleTypeGet = "${baseUrlServices}api/ServiceProviders/VehicleType_Get"; diff --git a/lib/models/schedule_model.dart b/lib/models/schedule_model.dart index 642c8d8..552d704 100644 --- a/lib/models/schedule_model.dart +++ b/lib/models/schedule_model.dart @@ -50,6 +50,7 @@ class ScheduleData { final String? address; final String? latitude; final String? longitude; + final List? weeklyOffDays; final List? scheduleServices; String branchId; @@ -67,6 +68,7 @@ class ScheduleData { this.address, this.latitude, this.longitude, + this.weeklyOffDays, this.scheduleServices, this.branchId = "", }); @@ -85,6 +87,7 @@ class ScheduleData { address: json["address"], latitude: json["latitude"], longitude: json["longitude"], + weeklyOffDays: json["weeklyOffDays"] == null ? [] : List.from(json["weeklyOffDays"]!.map((x) => WeeklyOffDay.fromJson(x))), scheduleServices: json["scheduleServices"] == null ? [] : List.from(json["scheduleServices"]!.map((x) => ScheduleService.fromJson(x))), ); @@ -125,3 +128,23 @@ class ScheduleService { "providerServiceName": providerServiceName, }; } + +class WeeklyOffDay { + final int? id; + final int? dayNumber; + + WeeklyOffDay({ + this.id, + this.dayNumber, + }); + + factory WeeklyOffDay.fromJson(Map json) => WeeklyOffDay( + id: json["id"], + dayNumber: json["dayNumber"], + ); + + Map toJson() => { + "id": id, + "dayNumber": dayNumber, + }; +} From ff9b906211e9d7770d654565001b411dc5360ca8 Mon Sep 17 00:00:00 2001 From: "mirza.shafique" Date: Mon, 12 Jun 2023 14:45:46 +0300 Subject: [PATCH 4/4] classes added from provider --- lib/models/schedule_model.dart | 27 ++-- lib/models/services/item_model.dart | 100 ++++++++++++++ lib/models/subscription_model.dart | 125 ++++++++++++++++++ lib/view_models/ad_view_model.dart | 20 +-- lib/views/advertisement/ads_list.dart | 45 ++++--- lib/widgets/checkbox_with_title_desc.dart | 40 ++++++ .../common_widgets/my_service_provider.dart | 1 - lib/widgets/empty_widget.dart | 11 ++ 8 files changed, 328 insertions(+), 41 deletions(-) create mode 100644 lib/models/services/item_model.dart create mode 100644 lib/models/subscription_model.dart create mode 100644 lib/widgets/checkbox_with_title_desc.dart create mode 100644 lib/widgets/empty_widget.dart diff --git a/lib/models/schedule_model.dart b/lib/models/schedule_model.dart index 552d704..6676083 100644 --- a/lib/models/schedule_model.dart +++ b/lib/models/schedule_model.dart @@ -21,14 +21,16 @@ class Schedule { this.message, }); - factory Schedule.fromJson(Map json) => Schedule( + factory Schedule.fromJson(Map json) => + Schedule( messageStatus: json["messageStatus"], totalItemsCount: json["totalItemsCount"], data: json["data"] == null ? [] : List.from(json["data"]!.map((x) => ScheduleData.fromJson(x))), message: json["message"], ); - Map toJson() => { + Map toJson() => + { "messageStatus": messageStatus, "totalItemsCount": totalItemsCount, "data": data == null ? [] : List.from(data!.map((x) => x.toJson())), @@ -73,7 +75,8 @@ class ScheduleData { this.branchId = "", }); - factory ScheduleData.fromJson(Map json) => ScheduleData( + factory ScheduleData.fromJson(Map json) => + ScheduleData( id: json["id"], scheduleName: json["scheduleName"], serviceProviderBranchId: json["serviceProviderBranchID"], @@ -91,7 +94,8 @@ class ScheduleData { scheduleServices: json["scheduleServices"] == null ? [] : List.from(json["scheduleServices"]!.map((x) => ScheduleService.fromJson(x))), ); - Map toJson() => { + Map toJson() => + { "id": id, "scheduleName": scheduleName, "serviceProviderBranchID": serviceProviderBranchId, @@ -111,19 +115,24 @@ class ScheduleData { class ScheduleService { final int? providerServiceId; + // final int? branchScheduleGroupServiceID; final String? providerServiceName; ScheduleService({ this.providerServiceId, + // this.branchScheduleGroupServiceID, this.providerServiceName, }); - factory ScheduleService.fromJson(Map json) => ScheduleService( + factory ScheduleService.fromJson(Map json) => + ScheduleService( providerServiceId: json["providerServiceID"], + // branchScheduleGroupServiceID: json["branchScheduleGroupServiceID"], providerServiceName: json["providerServiceName"], ); - Map toJson() => { + Map toJson() => + { "providerServiceID": providerServiceId, "providerServiceName": providerServiceName, }; @@ -138,12 +147,14 @@ class WeeklyOffDay { this.dayNumber, }); - factory WeeklyOffDay.fromJson(Map json) => WeeklyOffDay( + factory WeeklyOffDay.fromJson(Map json) => + WeeklyOffDay( id: json["id"], dayNumber: json["dayNumber"], ); - Map toJson() => { + Map toJson() => + { "id": id, "dayNumber": dayNumber, }; diff --git a/lib/models/services/item_model.dart b/lib/models/services/item_model.dart new file mode 100644 index 0000000..6bfd075 --- /dev/null +++ b/lib/models/services/item_model.dart @@ -0,0 +1,100 @@ +// To parse this JSON data, do +// +// final itemModel = itemModelFromJson(jsonString); + +import 'dart:convert'; + +ItemModel itemModelFromJson(String str) => ItemModel.fromJson(json.decode(str)); + +String itemModelToJson(ItemModel data) => json.encode(data.toJson()); + +class ItemModel { + final int? messageStatus; + final int? totalItemsCount; + final List? data; + final String? message; + + ItemModel({ + this.messageStatus, + this.totalItemsCount, + this.data, + this.message, + }); + + factory ItemModel.fromJson(Map json) => ItemModel( + messageStatus: json["messageStatus"], + totalItemsCount: json["totalItemsCount"], + data: json["data"] == null ? [] : List.from(json["data"]!.map((x) => ItemData.fromJson(x))), + message: json["message"], + ); + + Map toJson() => { + "messageStatus": messageStatus, + "totalItemsCount": totalItemsCount, + "data": data == null ? [] : List.from(data!.map((x) => x.toJson())), + "message": message, + }; +} + +class ItemData { + final int? id; + final String? name; + final String? price; + final String? manufactureDate; + final String? description; + final dynamic pictureUrl; + final int? companyId; + final int? serviceProviderServiceId; + final bool? isActive; + final bool? isAllowAppointment; + final bool? isAppointmentCompanyLoc; + final bool? isAppointmentCustomerLoc; + bool? isUpdate; + + ItemData({ + this.id, + this.name, + this.price, + this.manufactureDate, + this.description, + this.pictureUrl, + this.companyId, + this.serviceProviderServiceId, + this.isActive, + this.isAllowAppointment, + this.isAppointmentCompanyLoc, + this.isAppointmentCustomerLoc, + this.isUpdate, + }); + + factory ItemData.fromJson(Map json) => ItemData( + id: json["id"], + name: json["name"], + price: json["price"].toString(), + manufactureDate: json["manufactureDate"], + description: json["description"], + pictureUrl: json["pictureUrl"], + companyId: json["companyID"], + serviceProviderServiceId: json["serviceProviderServiceID"], + isActive: json["isActive"], + isAllowAppointment: json["isAllowAppointment"], + isAppointmentCompanyLoc: json["isAppointmentCompanyLoc"], + isAppointmentCustomerLoc: json["isAppointmentCustomerLoc"], + isUpdate: false, + ); + + Map toJson() => { + "id": id, + "name": name, + "price": price, + "manufactureDate": manufactureDate, + "description": description, + "pictureUrl": pictureUrl, + "companyID": companyId, + "serviceProviderServiceID": serviceProviderServiceId, + "isActive": isActive, + "isAllowAppointment": isAllowAppointment, + "isAppointmentCompanyLoc": isAppointmentCompanyLoc, + "isAppointmentCustomerLoc": isAppointmentCustomerLoc, + }; +} diff --git a/lib/models/subscription_model.dart b/lib/models/subscription_model.dart new file mode 100644 index 0000000..d192566 --- /dev/null +++ b/lib/models/subscription_model.dart @@ -0,0 +1,125 @@ +// To parse this JSON data, do +// +// final subscription = subscriptionFromJson(jsonString); + +import 'dart:convert'; + +Subscription subscriptionFromJson(String str) => Subscription.fromJson(json.decode(str)); + +String subscriptionToJson(Subscription data) => json.encode(data.toJson()); + +class SubscriptionModel { + SubscriptionModel({ + this.messageStatus, + this.totalItemsCount, + this.data, + this.message, + }); + + int? messageStatus; + int? totalItemsCount; + List? data; + String? message; + + factory SubscriptionModel.fromJson(Map json) => SubscriptionModel( + messageStatus: json["messageStatus"], + totalItemsCount: json["totalItemsCount"], + data: json["data"] == null ? [] : List.from(json["data"]!.map((x) => Subscription.fromJson(x))), + message: json["message"], + ); + + Map toJson() => { + "messageStatus": messageStatus, + "totalItemsCount": totalItemsCount, + "data": data == null ? [] : List.from(data!.map((x) => x.toJson())), + "message": message, + }; +} + +class Subscription { + Subscription({ + this.id, + this.name, + this.description, + this.durationName, + this.durationDays, + this.price, + this.currency, + this.numberOfBranches, + this.numberOfSubUsers, + this.numberOfAds, + this.countryId, + this.countryName, + this.isSubscribed, + this.subscriptionAppliedId, + this.serviceProviderId, + this.dateStart, + this.dateEnd, + this.isExpired, + this.isActive, + }); + + int? id; + String? name; + String? description; + String? durationName; + int? durationDays; + double? price; + String? currency; + int? numberOfBranches; + int? numberOfSubUsers; + int? numberOfAds; + int? countryId; + String? countryName; + bool? isSubscribed; + int? subscriptionAppliedId; + int? serviceProviderId; + DateTime? dateStart; + DateTime? dateEnd; + bool? isExpired; + bool? isActive; + + factory Subscription.fromJson(Map json) => Subscription( + id: json["id"], + name: json["name"], + description: json["description"], + durationName: json["durationName"], + durationDays: json["durationDays"], + price: json["price"]?.toDouble(), + currency: json["currency"], + numberOfBranches: json["numberOfBranches"], + numberOfSubUsers: json["numberOfSubUsers"], + numberOfAds: json["numberOfAds"], + countryId: json["countryID"], + countryName: json["countryName"]!, + isSubscribed: json["isSubscribed"], + subscriptionAppliedId: json["subscriptionAppliedID"], + serviceProviderId: json["serviceProviderID"], + dateStart: json["dateStart"] == null ? null : DateTime.parse(json["dateStart"]), + dateEnd: json["dateEnd"] == null ? null : DateTime.parse(json["dateEnd"]), + isExpired: json["isExpired"], + isActive: json["isActive"], + ); + + Map toJson() => { + "id": id, + "name": name, + "description": description, + "durationName": durationName, + "durationDays": durationDays, + "price": price, + "currency": currency, + "numberOfBranches": numberOfBranches, + "numberOfSubUsers": numberOfSubUsers, + "numberOfAds": numberOfAds, + "countryID": countryId, + "countryName": countryName, + "isSubscribed": isSubscribed, + "subscriptionAppliedID": subscriptionAppliedId, + "serviceProviderID": serviceProviderId, + "dateStart": dateStart?.toIso8601String(), + "dateEnd": dateEnd?.toIso8601String(), + "isExpired": isExpired, + "isActive": isActive, + }; +} diff --git a/lib/view_models/ad_view_model.dart b/lib/view_models/ad_view_model.dart index faf4a97..60a12bf 100644 --- a/lib/view_models/ad_view_model.dart +++ b/lib/view_models/ad_view_model.dart @@ -96,10 +96,7 @@ class AdVM extends BaseVM { } void removeSpecialServiceCard(int index) { - String option = specialServiceCards - .elementAt(index) - .serviceSelectedId! - .selectedOption; + String option = specialServiceCards.elementAt(index).serviceSelectedId!.selectedOption; for (var value in vehicleAdsSpecialServices) { if (value.name == option) { @@ -205,18 +202,20 @@ class AdVM extends BaseVM { Future getMyAds() async { isFetchingLists = true; + setState(ViewState.busy); myAds = await adsRepo.getAllAds(isMyAds: true); final myActiveAds = myAds.where((element) => element.adPostStatus == AdPostStatus.active).toList(); myActiveAdsForHome = myActiveAds.length >= 3 ? myActiveAds.take(3).toList() : myActiveAds; isFetchingLists = true; - notifyListeners(); + setState(ViewState.idle); } Future getExploreAds() async { + setState(ViewState.busy); exploreAds = await adsRepo.getAllAds(isMyAds: false); myAdsFilteredList = exploreAds; - notifyListeners(); + setState(ViewState.idle); } Future getVehicleTypes() async { @@ -868,10 +867,7 @@ class AdVM extends BaseVM { } void removeDamagePartCard(int index) { - String option = vehicleDamageCards - .elementAt(index) - .partSelectedId! - .selectedOption; + String option = vehicleDamageCards.elementAt(index).partSelectedId!.selectedOption; for (var value in vehicleDamageParts) { if (value.partName == option) { @@ -1003,9 +999,7 @@ class AdVM extends BaseVM { Future convertFileToVehiclePostingImages({required File file}) async { List imageBytes = await file.readAsBytes(); String image = base64Encode(imageBytes); - String fileName = file.path - .split('/') - .last; + String fileName = file.path.split('/').last; VehiclePostingImages vehiclePostingImages = VehiclePostingImages( imageName: fileName, imageStr: image, diff --git a/lib/views/advertisement/ads_list.dart b/lib/views/advertisement/ads_list.dart index 73af6a9..0ae4ecf 100644 --- a/lib/views/advertisement/ads_list.dart +++ b/lib/views/advertisement/ads_list.dart @@ -10,6 +10,7 @@ import 'package:mc_common_app/utils/utils.dart'; import 'package:mc_common_app/view_models/ad_view_model.dart'; import 'package:mc_common_app/widgets/extensions/extensions_widget.dart'; import 'package:provider/provider.dart'; +import 'package:sizer/sizer.dart'; class BuildAdsList extends StatelessWidget { final List adsList; @@ -35,22 +36,26 @@ class BuildAdsList extends StatelessWidget { ], ); } - return ListView.builder( - itemCount: adsList.length, - shrinkWrap: true, - physics: scrollPhysics, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: const EdgeInsets.only(bottom: 8), - child: AdCard( - adDetails: adsList[index], - isAdsFragment: isAdsFragment, - shouldShowAdStatus: shouldShowAdStatus, - ), - ).onPress(() { + return ListView.separated( + itemCount: adsList.length, + shrinkWrap: true, + physics: scrollPhysics, + itemBuilder: (BuildContext context, int index) { + return AdCard( + adDetails: adsList[index], + isAdsFragment: isAdsFragment, + shouldShowAdStatus: shouldShowAdStatus, + ).onPress( + () { navigateWithName(context, AppRoutes.adsDetailView, arguments: adsList[index]); - }); - }); + }, + ); + }, + separatorBuilder: (BuildContext context, int index) { + return 12.height; + }, + padding: EdgeInsets.symmetric(horizontal: 21), + ); } } @@ -95,7 +100,9 @@ class AdCard extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - if (isAdsFragment && context.read().isExploreAdsTapped) ...[ + if (isAdsFragment && context + .read() + .isExploreAdsTapped) ...[ Utils.statusContainerChip(text: adDetails.statuslabel!, chipColor: Utils.getChipColorByAdStatus(adDetails.adPostStatus!)), ], if (shouldShowAdStatus) ...[ @@ -132,8 +139,8 @@ class AdCard extends StatelessWidget { ), adDetails.createdOn != null ? DateTime.parse(adDetails.createdOn!).getTimeAgo().toText( - color: MyColors.lightTextColor, - ) + color: MyColors.lightTextColor, + ) : const SizedBox(), ], ), @@ -184,6 +191,6 @@ class AdCard extends StatelessWidget { else const SizedBox(), ], - ).toWhiteContainer(width: double.infinity, allPading: 12, margin: const EdgeInsets.symmetric(horizontal: 21)); + ).toWhiteContainer(width: double.infinity, allPading: 12,); } } diff --git a/lib/widgets/checkbox_with_title_desc.dart b/lib/widgets/checkbox_with_title_desc.dart new file mode 100644 index 0000000..99088aa --- /dev/null +++ b/lib/widgets/checkbox_with_title_desc.dart @@ -0,0 +1,40 @@ +import 'package:flutter/material.dart'; +import 'package:mc_common_app/extensions/string_extensions.dart'; +import 'package:mc_common_app/theme/colors.dart'; + +class CheckBoxWithTitleDescription extends StatelessWidget { + bool isSelected; + String title, description; + Function(bool) onSelection; + + CheckBoxWithTitleDescription({required this.isSelected, required this.title, required this.description, required this.onSelection, Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return SizedBox( + width: double.infinity, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Checkbox( + value: isSelected, + onChanged: (bool? v) { + onSelection(v ?? false); + }, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + title.toText(fontSize: 14, isBold: true), + description.toText(fontSize: 12, color: MyColors.lightTextColor), + ], + ), + ), + ], + ), + ); + } +} diff --git a/lib/widgets/common_widgets/my_service_provider.dart b/lib/widgets/common_widgets/my_service_provider.dart index 8881cfb..afcb536 100644 --- a/lib/widgets/common_widgets/my_service_provider.dart +++ b/lib/widgets/common_widgets/my_service_provider.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:mc_common_app/classes/consts.dart'; import 'package:mc_common_app/extensions/int_extensions.dart'; diff --git a/lib/widgets/empty_widget.dart b/lib/widgets/empty_widget.dart new file mode 100644 index 0000000..3e4cac0 --- /dev/null +++ b/lib/widgets/empty_widget.dart @@ -0,0 +1,11 @@ +import 'package:flutter/material.dart'; +import 'package:mc_common_app/extensions/string_extensions.dart'; + +class EmptyWidget extends StatelessWidget { + const EmptyWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Center(child: "No Data Found".toText()); + } +}