diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index b700eb7..bb552e2 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,6 @@ + >>>>>> nada + + diff --git a/assets/images/1.jpg b/assets/images/1.jpg new file mode 100644 index 0000000..cf84417 Binary files /dev/null and b/assets/images/1.jpg differ diff --git a/assets/images/2.jpg b/assets/images/2.jpg new file mode 100644 index 0000000..6595cee Binary files /dev/null and b/assets/images/2.jpg differ diff --git a/assets/images/3.jpg b/assets/images/3.jpg new file mode 100644 index 0000000..8adbd7b Binary files /dev/null and b/assets/images/3.jpg differ diff --git a/assets/images/30day.png b/assets/images/30day.png new file mode 100644 index 0000000..62c674f Binary files /dev/null and b/assets/images/30day.png differ diff --git a/assets/images/4.jpg b/assets/images/4.jpg new file mode 100644 index 0000000..03e5938 Binary files /dev/null and b/assets/images/4.jpg differ diff --git a/assets/images/5.jpg b/assets/images/5.jpg new file mode 100644 index 0000000..cb0a641 Binary files /dev/null and b/assets/images/5.jpg differ diff --git a/assets/images/Group 959.png b/assets/images/Group 959.png new file mode 100644 index 0000000..48a41ad Binary files /dev/null and b/assets/images/Group 959.png differ diff --git a/assets/images/Rectangle 18.png b/assets/images/Rectangle 18.png new file mode 100644 index 0000000..ebcc344 Binary files /dev/null and b/assets/images/Rectangle 18.png differ diff --git a/assets/images/Rectangle 21.png b/assets/images/Rectangle 21.png new file mode 100644 index 0000000..b79e04d Binary files /dev/null and b/assets/images/Rectangle 21.png differ diff --git a/assets/images/Rectangle 26.png b/assets/images/Rectangle 26.png new file mode 100644 index 0000000..4a4c64b Binary files /dev/null and b/assets/images/Rectangle 26.png differ diff --git a/assets/images/Vector.png b/assets/images/Vector.png new file mode 100644 index 0000000..ad0032c Binary files /dev/null and b/assets/images/Vector.png differ diff --git a/assets/images/bronze.png b/assets/images/bronze.png new file mode 100644 index 0000000..01834e3 Binary files /dev/null and b/assets/images/bronze.png differ diff --git a/assets/images/gold.png b/assets/images/gold.png new file mode 100644 index 0000000..b34db31 Binary files /dev/null and b/assets/images/gold.png differ diff --git a/assets/images/image1.png b/assets/images/image1.png new file mode 100644 index 0000000..8a31fcc Binary files /dev/null and b/assets/images/image1.png differ diff --git a/assets/images/image2.png b/assets/images/image2.png new file mode 100644 index 0000000..d2d22e9 Binary files /dev/null and b/assets/images/image2.png differ diff --git a/assets/images/image3.png b/assets/images/image3.png new file mode 100644 index 0000000..45f5eb6 Binary files /dev/null and b/assets/images/image3.png differ diff --git a/assets/images/image4.png b/assets/images/image4.png new file mode 100644 index 0000000..3ff8375 Binary files /dev/null and b/assets/images/image4.png differ diff --git a/assets/images/img1.png b/assets/images/img1.png new file mode 100644 index 0000000..6174f4e Binary files /dev/null and b/assets/images/img1.png differ diff --git a/assets/images/img2.png b/assets/images/img2.png new file mode 100644 index 0000000..6e9300c Binary files /dev/null and b/assets/images/img2.png differ diff --git a/assets/images/img3.png b/assets/images/img3.png new file mode 100644 index 0000000..2c43257 Binary files /dev/null and b/assets/images/img3.png differ diff --git a/assets/images/img4.png b/assets/images/img4.png new file mode 100644 index 0000000..2cd1f00 Binary files /dev/null and b/assets/images/img4.png differ diff --git a/assets/images/img5.png b/assets/images/img5.png new file mode 100644 index 0000000..6b8fcc0 Binary files /dev/null and b/assets/images/img5.png differ diff --git a/assets/images/img7.png b/assets/images/img7.png new file mode 100644 index 0000000..96904fc Binary files /dev/null and b/assets/images/img7.png differ diff --git a/assets/images/img8.png b/assets/images/img8.png new file mode 100644 index 0000000..0c8e9c4 Binary files /dev/null and b/assets/images/img8.png differ diff --git a/assets/images/jop.png b/assets/images/jop.png new file mode 100644 index 0000000..46ea77a Binary files /dev/null and b/assets/images/jop.png differ diff --git a/assets/images/load.png b/assets/images/load.png new file mode 100644 index 0000000..1fe2b1f Binary files /dev/null and b/assets/images/load.png differ diff --git a/assets/images/omg6.png b/assets/images/omg6.png new file mode 100644 index 0000000..4c62cfa Binary files /dev/null and b/assets/images/omg6.png differ diff --git a/assets/images/product.png b/assets/images/product.png new file mode 100644 index 0000000..62cfc2c Binary files /dev/null and b/assets/images/product.png differ diff --git a/assets/images/silver.png b/assets/images/silver.png new file mode 100644 index 0000000..36152b0 Binary files /dev/null and b/assets/images/silver.png differ diff --git a/assets/images/star.png b/assets/images/star.png new file mode 100644 index 0000000..c499d25 Binary files /dev/null and b/assets/images/star.png differ diff --git a/lib/core/bloc_observer.dart b/lib/core/bloc_observer.dart new file mode 100644 index 0000000..e4698c4 --- /dev/null +++ b/lib/core/bloc_observer.dart @@ -0,0 +1,41 @@ +import 'dart:async'; + +import 'package:bloc/bloc.dart'; + +class SimpleBlocObserver extends BlocObserver { + @override + void onCreate(BlocBase bloc) { + super.onCreate(bloc); + print('onCreate -- bloc: ${bloc.runtimeType}'); + } + + @override + void onEvent(Bloc bloc, Object? event) { + super.onEvent(bloc, event); + print('onEvent -- bloc: ${bloc.runtimeType}, event: $event'); + } + + @override + void onChange(BlocBase bloc, Change change) { + super.onChange(bloc, change); + print('onChange -- bloc: ${bloc.runtimeType}, change: $change'); + } + + @override + void onTransition(Bloc bloc, Transition transition) { + super.onTransition(bloc, transition); + print('onTransition -- bloc: ${bloc.runtimeType}, transition: $transition'); + } + + @override + void onError(BlocBase bloc, Object error, StackTrace stackTrace) { + print('onError -- bloc: ${bloc.runtimeType}, error: $error'); + super.onError(bloc, error, stackTrace); + } + + @override + void onClose(BlocBase bloc) { + super.onClose(bloc); + print('onClose -- bloc: ${bloc.runtimeType}'); + } +} diff --git a/lib/core/color_manager/color_manager.dart b/lib/core/color_manager/color_manager.dart index cfd3eb6..239929c 100644 --- a/lib/core/color_manager/color_manager.dart +++ b/lib/core/color_manager/color_manager.dart @@ -1,4 +1,5 @@ import 'dart:ui'; + import 'package:flutter/material.dart'; class ColorManager { @@ -15,7 +16,7 @@ class ColorManager { static const Color lightGrey =Color(0xFF808080); static const Color darkBrown =Color(0xFFDC52F); - static const Color orange=Color(0xFFFDC52F); + static const Color yellow=Color(0xFFFDC52F); // static const Color grey =Color(0xFFE8E8E8); diff --git a/lib/core/data/api/api.dart b/lib/core/data/api/api.dart index 58109cf..c2cae56 100644 --- a/lib/core/data/api/api.dart +++ b/lib/core/data/api/api.dart @@ -7,12 +7,13 @@ import '../models/response.dart'; class Api{ String baseUrl='https://hegaload.com/api/'; - Future getHttp({required url, data,authToken})async{ + Future getHttp({required url, data,authToken,self})async{ try{ var response=await Dio().get(baseUrl+'$url',options: Options(headers:{ - "auth":authToken + "auth":authToken, + "self":self } ), queryParameters: data @@ -20,26 +21,25 @@ class Api{ if(response.statusCode==200){return response.data;} }on DioError catch(e){ - ResponseModel responseModel=ResponseModel.fromJson(e.response); - print('------------------------'); + ResponseModel responseModel=ResponseModel.fromJson(e.response!.data); + print('------------------------'); print(responseModel.status); print(responseModel.message); - print(e.response); + print('------------------------'); + showToast(msg: responseModel.message.toString(), state: ToastedStates.ERROR); + throw Exception(); - print(e.response!.data['message']); - showToast(msg: e.response!.data['message'].toString(), state: ToastedStates.ERROR); - } } - Future postHttp({required url, required data,authToken,queryParams })async{ + Future postHttp({required url, data,authToken,queryParams })async{ try{ var response=await Dio().post(baseUrl+'$url',data: data,queryParameters:queryParams,options: Options(headers:{ - "auth":authToken + "auth":authToken, }, ) ); @@ -52,17 +52,14 @@ class Api{ }on DioError catch(e){ -// ResponseModel responseModel=ResponseModel.fromJson(e.response!.data()); -// print('------------------------'); -// print(responseModel.status); -// print(responseModel.message); -// print('------------------------'); - print(e.response); - print(e.response!.data['message']); - showToast(msg: e.response!.data['message'].toString(), state: ToastedStates.ERROR); - throw Exception(); - + ResponseModel responseModel=ResponseModel.fromJson(e.response!.data); + print('------------------------'); + print(responseModel.status); + print(responseModel.message); + print('------------------------'); +// showToast(msg: responseModel.message.toString(), state: ToastedStates.ERROR); + throw Exception(responseModel.message); } } diff --git a/lib/core/data/models/GetProduct_model.dart b/lib/core/data/models/GetProduct_model.dart deleted file mode 100644 index 355adb1..0000000 --- a/lib/core/data/models/GetProduct_model.dart +++ /dev/null @@ -1,64 +0,0 @@ -import 'ProductType.dart'; - -class GetProductModel { - GetProductModel({ - this.id, - this.buyOrSell, - this.productName, - this.productType, - this.country, - this.state, - this.city, - this.user, - this.description, - this.price, - this.productImage, - this.status,}); - - GetProductModel.fromJson(dynamic json) { - id = json['id']; - buyOrSell = json['buy_or_sell']; - productName = json['product_name']; - productType = json['product_type'] != null ? ProductType.fromJson(json['product_type']) : null; - country = json['country']; - state = json['state']; - city = json['city']; - user = json['user']; - description = json['description']; - price = json['price']; - productImage = json['product_image']; - status = json['status']; - } - int? id; - String? buyOrSell; - String? productName; - ProductType? productType; - dynamic country; - dynamic state; - dynamic city; - dynamic user; - String? description; - String? price; - String? productImage; - int? status; - - Map toJson() { - final map = {}; - map['id'] = id; - map['buy_or_sell'] = buyOrSell; - map['product_name'] = productName; - if (productType != null) { - map['product_type'] = productType!.toJson(); - } - map['country'] = country; - map['state'] = state; - map['city'] = city; - map['user'] = user; - map['description'] = description; - map['price'] = price; - map['product_image'] = productImage; - map['status'] = status; - return map; - } - -} \ No newline at end of file diff --git a/lib/core/data/models/GetVehicle_model.dart b/lib/core/data/models/GetVehicle_model.dart deleted file mode 100644 index 4847886..0000000 --- a/lib/core/data/models/GetVehicle_model.dart +++ /dev/null @@ -1,148 +0,0 @@ -import 'OriginCountry.dart'; -import 'OriginState.dart'; -import 'OriginCity.dart'; -import 'DestinationCountry.dart'; -import 'DestinationState.dart'; -import 'DestinationCity.dart'; -import 'EquipmentTypes.dart'; -import 'Attributes.dart'; -import 'VehicleSizes.dart'; -import 'VehicleTypes.dart'; -import 'ViewdBy.dart'; - -class GetVehicleModel { - GetVehicleModel({ - this.id, - this.availabilityDate, - this.originCountry, - this.originState, - this.originCity, - this.destinationCountry, - this.destinationState, - this.destinationCity, - this.equipmentTypes, - this.attributes, - this.vehicleSizes, - this.vehicleTypes, - this.weight, - this.instructions, - this.user, - this.viewdBy, - this.createdAt, - this.updatedAt, - this.deletedAt,}); - - GetVehicleModel.fromJson(dynamic json) { - id = json['id']; - availabilityDate = json['availability_date']; - originCountry = json['origin_country'] != null ? OriginCountry.fromJson(json['origin_country']) : null; - originState = json['origin_state'] != null ? OriginState.fromJson(json['origin_state']) : null; - originCity = json['origin_city'] != null ? OriginCity.fromJson(json['origin_city']) : null; - destinationCountry = json['destination_country'] != null ? DestinationCountry.fromJson(json['destination_country']) : null; - destinationState = json['destination_state'] != null ? DestinationState.fromJson(json['destination_state']) : null; - destinationCity = json['destination_city'] != null ? DestinationCity.fromJson(json['destination_city']) : null; - if (json['equipment_types'] != null) { - equipmentTypes = []; - json['equipment_types'].forEach((v) { - equipmentTypes!.add(EquipmentTypes.fromJson(v)); - }); - } - if (json['attributes'] != null) { - attributes = []; - json['attributes'].forEach((v) { - attributes!.add(Attributes.fromJson(v)); - }); - } - if (json['vehicle_sizes'] != null) { - vehicleSizes = []; - json['vehicle_sizes'].forEach((v) { - vehicleSizes!.add(VehicleSizes.fromJson(v)); - }); - } - if (json['vehicle_types'] != null) { - vehicleTypes = []; - json['vehicle_types'].forEach((v) { - vehicleTypes!.add(VehicleTypes.fromJson(v)); - }); - } - weight = json['weight']; - instructions = json['instructions']; - if (json['viewd_by'] != null) { - viewdBy = []; - json['viewd_by'].forEach((v) { - viewdBy!.add(ViewdBy.fromJson(v)); - }); - } - createdAt = json['created_at']; - updatedAt = json['updated_at']; - deletedAt = json['deleted_at']; - } - int? id; - String? availabilityDate; - OriginCountry? originCountry; - OriginState? originState; - OriginCity? originCity; - DestinationCountry? destinationCountry; - DestinationState? destinationState; - DestinationCity? destinationCity; - List? equipmentTypes; - List? attributes; - List? vehicleSizes; - List? vehicleTypes; - String? weight; - dynamic instructions; - List? user; - List? viewdBy; - String? createdAt; - String? updatedAt; - dynamic deletedAt; - - Map toJson() { - final map = {}; - map['id'] = id; - map['availability_date'] = availabilityDate; - if (originCountry != null) { - map['origin_country'] = originCountry!.toJson(); - } - if (originState != null) { - map['origin_state'] = originState!.toJson(); - } - if (originCity != null) { - map['origin_city'] = originCity!.toJson(); - } - if (destinationCountry != null) { - map['destination_country'] = destinationCountry!.toJson(); - } - if (destinationState != null) { - map['destination_state'] = destinationState!.toJson(); - } - if (destinationCity != null) { - map['destination_city'] = destinationCity!.toJson(); - } - if (equipmentTypes != null) { - map['equipment_types'] = equipmentTypes!.map((v) => v.toJson()).toList(); - } - if (attributes != null) { - map['attributes'] = attributes!.map((v) => v.toJson()).toList(); - } - if (vehicleSizes != null) { - map['vehicle_sizes'] = vehicleSizes!.map((v) => v.toJson()).toList(); - } - if (vehicleTypes != null) { - map['vehicle_types'] = vehicleTypes!.map((v) => v.toJson()).toList(); - } - map['weight'] = weight; - map['instructions'] = instructions; - if (user != null) { - map['user'] = user!.map((v) => v.toJson()).toList(); - } - if (viewdBy != null) { - map['viewd_by'] = viewdBy!.map((v) => v.toJson()).toList(); - } - map['created_at'] = createdAt; - map['updated_at'] = updatedAt; - map['deleted_at'] = deletedAt; - return map; - } - -} \ No newline at end of file diff --git a/lib/core/data/models/blogs.dart b/lib/core/data/models/blogs/blogs.dart similarity index 100% rename from lib/core/data/models/blogs.dart rename to lib/core/data/models/blogs/blogs.dart diff --git a/lib/core/data/models/GetJop_model.dart b/lib/core/data/models/jobs/GetJop_model.dart similarity index 55% rename from lib/core/data/models/GetJop_model.dart rename to lib/core/data/models/jobs/GetJop_model.dart index 1f3004d..8a50bf3 100644 --- a/lib/core/data/models/GetJop_model.dart +++ b/lib/core/data/models/jobs/GetJop_model.dart @@ -1,40 +1,53 @@ +import 'package:hoga_load/core/data/models/jobs/jopTpe.dart'; import 'package:hoga_load/core/data/models/state.dart'; -import 'Country.dart'; -import 'City.dart'; -import 'User.dart'; +import '../master/City.dart'; +import '../master/Country.dart'; +import '../vehicle/user.dart'; import 'category.dart'; -import 'jopTpe.dart'; class GetJopModel { GetJopModel({ - this.id, - this.title, - this.description, - this.category, - this.jobType, - this.country, - this.state, - this.city, - this.user, - this.salary, - this.noOfPosts, - this.shiftTime, - this.status,}); + this.id, + this.title, + this.description, + this.category, + this.jobType, + this.country2, + this.state2, + this.city2, + this.country, + this.jopCategortId, + this.jopTypeId, + this.state, + this.city, + this.user, + this.salary, + this.salaryInt, + this.noOfPosts, + this.shiftTime, + this.shiftTimeInt, + this.status, + }); GetJopModel.fromJson(dynamic json) { id = json['id']; title = json['title']; description = json['description']; - category = json['category'] != null ? Category.fromJson(json['category']) : null; - jobType = json['job_type'] != null ? JobType.fromJson(json['job_type']) : null; - country = json['country'] != null ? Country.fromJson(json['country']) : null; + category = + json['category'] != null ? Category.fromJson(json['category']) : null; + jobType = + json['job_type'] != null ? JobType.fromJson(json['job_type']) : null; + country = + json['country'] != null ? Country.fromJson(json['country']) : null; state = json['state'] != null ? State.fromJson(json['state']) : null; city = json['city'] != null ? City.fromJson(json['city']) : null; user = (json['user'] != null ? User.fromJson(json['user']) : null)!; salary = json['salary']; + salaryInt = json['salary']; noOfPosts = json['no_of_posts']; shiftTime = json['shift_time']; + shiftTimeInt = json['shift_time']; status = json['status']; } int? id; @@ -42,6 +55,13 @@ class GetJopModel { String? description; Category? category; JobType? jobType; + int? country2; + int? state2; + int? city2; + int? jopTypeId; + int? salaryInt; + int? shiftTimeInt; + int? jopCategortId; Country? country; State? state; City? city; @@ -56,12 +76,15 @@ class GetJopModel { map['id'] = id; map['title'] = title; map['description'] = description; + if (category != null) { map['category'] = category!.toJson(); } if (jobType != null) { map['job_type'] = jobType!.toJson(); } + map['job_type'] = jopTypeId; + map['category'] = jopCategortId; if (country != null) { map['country'] = country!.toJson(); } @@ -73,12 +96,16 @@ class GetJopModel { } if (user != null) { map['user'] = user!.toJson(); + map['country'] = country2; + map['state'] = state2; + map['city'] = city2; } + map['salary'] = salaryInt; + map['shift_time'] = shiftTimeInt; map['salary'] = salary; map['no_of_posts'] = noOfPosts; map['shift_time'] = shiftTime; map['status'] = status; return map; } - -} \ No newline at end of file +} diff --git a/lib/core/data/models/category.dart b/lib/core/data/models/jobs/category.dart similarity index 100% rename from lib/core/data/models/category.dart rename to lib/core/data/models/jobs/category.dart diff --git a/lib/core/data/models/jopTpe.dart b/lib/core/data/models/jobs/jopTpe.dart similarity index 100% rename from lib/core/data/models/jopTpe.dart rename to lib/core/data/models/jobs/jopTpe.dart diff --git a/lib/core/data/models/GetLoads_model.dart b/lib/core/data/models/loads/GetLoads_model.dart similarity index 57% rename from lib/core/data/models/GetLoads_model.dart rename to lib/core/data/models/loads/GetLoads_model.dart index ab4d3a1..313f5bb 100644 --- a/lib/core/data/models/GetLoads_model.dart +++ b/lib/core/data/models/loads/GetLoads_model.dart @@ -1,42 +1,71 @@ -import 'OriginCountry.dart'; -import 'OriginState.dart'; -import 'DestinationCountry.dart'; -import 'DestinationState.dart'; -import 'DestinationCity.dart'; -import 'EquipmentTypes.dart'; -import 'Attributes.dart'; -import 'VehicleSizes.dart'; -import 'VehicleTypes.dart'; -import 'ViewdBy.dart'; +import 'package:hoga_load/core/data/models/master/OriginCity.dart'; + +import '../master/DestinationCity.dart'; +import '../master/DestinationCountry.dart'; +import '../master/DestinationState.dart'; +import '../master/EquipmentTypes.dart'; +import '../master/OriginCountry.dart'; +import '../master/OriginState.dart'; +import '../vehicle/Attributes.dart'; +import '../vehicle/VehicleSizes.dart'; +import '../vehicle/VehicleTypes.dart'; +import '../vehicle/ViewdBy.dart'; +import '../vehicle/user.dart'; class GetLoadsModel { GetLoadsModel({ - this.id, - this.availabilityDate, - this.originCountry, - this.originState, - this.originCity, - this.destinationCountry, - this.destinationState, - this.destinationCity, - this.equipmentTypes, - this.attributes, - this.vehicleSizes, - this.vehicleTypes, - this.weight, - this.instructions, - this.user, - this.viewdBy,}); + this.id, + this.availabilityDate, + this.originCountry, + this.originState, + this.originCity, + this.destinationCountry, + this.destinationState, + this.destinationCity, + this.equipmentTypes, + this.attributes, +<<<<<<< HEAD + this.vehicleSizes, + this.vehicleTypes, +======= + this.attributes2, + this.vehicleSizes, + this.vehicleTypes, + this.vehicleTypes2, +>>>>>>> nada + this.equipmentTypes2, + this.vehicleSizes2, + this.weight, + this.instructions, + this.user, + this.viewdBy, + }); GetLoadsModel.fromJson(dynamic json) { id = json['id']; availabilityDate = json['availability_date']; - originCountry = json['origin_country'] != null ? OriginCountry.fromJson(json['origin_country']) : null; - originState = json['origin_state'] != null ? OriginState.fromJson(json['origin_state']) : null; + originCountry = json['origin_country'] != null + ? OriginCountry.fromJson(json['origin_country']) + : null; + originState = json['origin_state'] != null + ? OriginState.fromJson(json['origin_state']) + : null; +<<<<<<< HEAD originCity = json['origin_city']; - destinationCountry = json['destination_country'] != null ? DestinationCountry.fromJson(json['destination_country']) : null; - destinationState = json['destination_state'] != null ? DestinationState.fromJson(json['destination_state']) : null; - destinationCity = json['destination_city'] != null ? DestinationCity.fromJson(json['destination_city']) : null; +======= + originCity = json['origin_city'] != null + ? OriginCity.fromJson(json['origin_city']) + : null; +>>>>>>> nada + destinationCountry = json['destination_country'] != null + ? DestinationCountry.fromJson(json['destination_country']) + : null; + destinationState = json['destination_state'] != null + ? DestinationState.fromJson(json['destination_state']) + : null; + destinationCity = json['destination_city'] != null + ? DestinationCity.fromJson(json['destination_city']) + : null; if (json['equipment_types'] != null) { equipmentTypes = []; json['equipment_types'].forEach((v) { @@ -63,7 +92,7 @@ class GetLoadsModel { } weight = json['weight']; instructions = json['instructions']; - + user = (json['user'] != null ? User.fromJson(json['user']) : null)!; if (json['viewd_by'] != null) { viewdBy = []; json['viewd_by'].forEach((v) { @@ -75,7 +104,7 @@ class GetLoadsModel { String? availabilityDate; OriginCountry? originCountry; OriginState? originState; - dynamic originCity; + OriginCity? originCity; DestinationCountry? destinationCountry; DestinationState? destinationState; DestinationCity? destinationCity; @@ -83,10 +112,15 @@ class GetLoadsModel { List? attributes; List? vehicleSizes; List? vehicleTypes; + List? equipmentTypes2 = []; + List? vehicleSizes2 = []; String? weight; dynamic instructions; - List? user; + User? user; List? viewdBy; + List?vehicleTypes2=[]; + List?attributes2=[]; + Map toJson() { final map = {}; @@ -123,12 +157,12 @@ class GetLoadsModel { map['weight'] = weight; map['instructions'] = instructions; if (user != null) { - map['user'] = user!.map((v) => v.toJson()).toList(); + map['user'] = user!.toJson(); } + map['user'] = user; if (viewdBy != null) { map['viewd_by'] = viewdBy!.map((v) => v.toJson()).toList(); } return map; } - -} \ No newline at end of file +} diff --git a/lib/core/data/models/City.dart b/lib/core/data/models/master/City.dart similarity index 100% rename from lib/core/data/models/City.dart rename to lib/core/data/models/master/City.dart diff --git a/lib/core/data/models/Country.dart b/lib/core/data/models/master/Country.dart similarity index 100% rename from lib/core/data/models/Country.dart rename to lib/core/data/models/master/Country.dart diff --git a/lib/core/data/models/DestinationCity.dart b/lib/core/data/models/master/DestinationCity.dart similarity index 100% rename from lib/core/data/models/DestinationCity.dart rename to lib/core/data/models/master/DestinationCity.dart diff --git a/lib/core/data/models/DestinationCountry.dart b/lib/core/data/models/master/DestinationCountry.dart similarity index 100% rename from lib/core/data/models/DestinationCountry.dart rename to lib/core/data/models/master/DestinationCountry.dart diff --git a/lib/core/data/models/DestinationState.dart b/lib/core/data/models/master/DestinationState.dart similarity index 100% rename from lib/core/data/models/DestinationState.dart rename to lib/core/data/models/master/DestinationState.dart diff --git a/lib/core/data/models/EquipmentTypes.dart b/lib/core/data/models/master/EquipmentTypes.dart similarity index 100% rename from lib/core/data/models/EquipmentTypes.dart rename to lib/core/data/models/master/EquipmentTypes.dart diff --git a/lib/core/data/models/OriginCity.dart b/lib/core/data/models/master/OriginCity.dart similarity index 100% rename from lib/core/data/models/OriginCity.dart rename to lib/core/data/models/master/OriginCity.dart diff --git a/lib/core/data/models/OriginCountry.dart b/lib/core/data/models/master/OriginCountry.dart similarity index 100% rename from lib/core/data/models/OriginCountry.dart rename to lib/core/data/models/master/OriginCountry.dart diff --git a/lib/core/data/models/OriginState.dart b/lib/core/data/models/master/OriginState.dart similarity index 100% rename from lib/core/data/models/OriginState.dart rename to lib/core/data/models/master/OriginState.dart diff --git a/lib/core/data/models/plans/plans_model.dart b/lib/core/data/models/plans/plans_model.dart new file mode 100644 index 0000000..0c13189 --- /dev/null +++ b/lib/core/data/models/plans/plans_model.dart @@ -0,0 +1,72 @@ +class PlansModel { + PlansModel({ + this.id, + this.stripeId, + this.title, + this.slug, + this.image, + this.description, + this.totalNumberOfLoads, + this.totalNumberOfVehicles, + this.totalNumberOfProducts, + this.totalNumberOfJobs, + this.basePrice, + this.price, + this.stripePriceId, + this.isBestSelling, + }); + + PlansModel.fromJson(dynamic json) { + id = json['id']; + stripeId = json['stripe_id']; + title = json['title']; + slug = json['slug']; + image = json['image']; + description = json['description']; + totalNumberOfLoads = json['total_number_of_loads']; + totalNumberOfVehicles = json['total_number_of_vehicles']; + totalNumberOfProducts = json['total_number_of_products']; + totalNumberOfJobs = json['total_number_of_jobs']; + basePrice = json['base_price']; + price = json['price']; + stripePriceId = json['stripe_price_id']; + isBestSelling = json['is_best_selling']; + + } + int? id; + String? stripeId; + String? title; + String? slug; + String? image; + dynamic description; + int? totalNumberOfLoads; + int? totalNumberOfVehicles; + int? totalNumberOfProducts; + int? totalNumberOfJobs; + String? basePrice; + String? price; + String? stripePriceId; + int? isBestSelling; + + + Map toJson() { + final map = {}; + map['id'] = id; + map['stripe_id'] = stripeId; + map['title'] = title; + map['slug'] = slug; + map['image'] = image; + map['description'] = description; + map['total_number_of_loads'] = totalNumberOfLoads; + map['total_number_of_vehicles'] = totalNumberOfVehicles; + map['total_number_of_products'] = totalNumberOfProducts; + map['total_number_of_jobs'] = totalNumberOfJobs; + map['base_price'] = basePrice; + map['price'] = price; + map['stripe_price_id'] = stripePriceId; + map['is_best_selling'] = isBestSelling; + + return map; + } + +} \ No newline at end of file diff --git a/lib/core/data/models/product/GetProduct_model.dart b/lib/core/data/models/product/GetProduct_model.dart new file mode 100644 index 0000000..c154d7a --- /dev/null +++ b/lib/core/data/models/product/GetProduct_model.dart @@ -0,0 +1,80 @@ +import 'package:hoga_load/core/data/models/master/OriginCity.dart'; +import 'package:hoga_load/core/data/models/master/OriginCountry.dart'; +import 'package:hoga_load/core/data/models/master/OriginState.dart'; +import 'package:hoga_load/core/data/models/vehicle/Addvehicle_model.dart'; +import 'package:hoga_load/core/data/models/vehicle/user.dart'; + +import '../ProductType.dart'; + +class GetProductModel { + GetProductModel({ + this.id, + this.buyOrSell, + this.productName, + this.productType, + this.country, + this.state, + this.city, + this.countryPost, + this.statePost, + this.cityPost, + this.user, + this.description, + this.price, + this.priceInt, + this.search, + this.productTypeId, + this.productImage, + this.status,}); + + + GetProductModel.fromJson(dynamic json) { + id = json['id']; + buyOrSell = json['buy_or_sell']; + productName = json['product_name']; + productType = json['product_type'] != null ? ProductType.fromJson(json['product_type']) : null; + country = json['country']!= null ? ProductType.fromJson(json['country']) : null; + state = json['state']!= null ? AddVehicle.fromJson(json['state']) : null; + city = json['city']!= null ? AddVehicle.fromJson(json['city']) : null; + user = json['user']!= null ? User.fromJson(json['user']) : null; + + description = json['description']; + price = json['price']; + productImage = json['product_image']; + status = json['status']; + } + int? id; + String? buyOrSell; + String? productName; + ProductType? productType; + ProductType? country; + AddVehicle? state; + AddVehicle? city; + int? countryPost; + int? statePost; + int? cityPost; + User? user; + String? description; + String? price; + String? productImage; + int? status; + int? productTypeId; + int? priceInt; + String? search; + + Map toJson() { + final map = {}; + map['buy_or_sell'] = buyOrSell; + map['product_name'] = productName; + map['product_type'] = productTypeId; + map['country'] = countryPost; + map['state'] = statePost; + map['city'] = cityPost; + map['description'] = description; + map['price'] = priceInt; + map['product_image'] = productImage; + map['search'] = search; + + return map; + } +} diff --git a/lib/core/data/models/response.dart b/lib/core/data/models/response.dart index a43fe40..1ea3bc9 100644 --- a/lib/core/data/models/response.dart +++ b/lib/core/data/models/response.dart @@ -1,4 +1,4 @@ -import 'user.dart'; +import 'vehicle/user.dart'; class ResponseModel { ResponseModel({ @@ -15,7 +15,7 @@ class ResponseModel { message!.add(v); }); } - record = json['record'] != null ? User.fromJson(json['record']) : null; + //record = json['record'] != null ? User.fromJson(json['record']) : null; } String? status; List? message; diff --git a/lib/core/data/models/Addvehicle_model.dart b/lib/core/data/models/vehicle/Addvehicle_model.dart similarity index 100% rename from lib/core/data/models/Addvehicle_model.dart rename to lib/core/data/models/vehicle/Addvehicle_model.dart diff --git a/lib/core/data/models/Attributes.dart b/lib/core/data/models/vehicle/Attributes.dart similarity index 100% rename from lib/core/data/models/Attributes.dart rename to lib/core/data/models/vehicle/Attributes.dart diff --git a/lib/core/data/models/VehicleSizes.dart b/lib/core/data/models/vehicle/VehicleSizes.dart similarity index 100% rename from lib/core/data/models/VehicleSizes.dart rename to lib/core/data/models/vehicle/VehicleSizes.dart diff --git a/lib/core/data/models/VehicleTypes.dart b/lib/core/data/models/vehicle/VehicleTypes.dart similarity index 100% rename from lib/core/data/models/VehicleTypes.dart rename to lib/core/data/models/vehicle/VehicleTypes.dart diff --git a/lib/core/data/models/ViewdBy.dart b/lib/core/data/models/vehicle/ViewdBy.dart similarity index 100% rename from lib/core/data/models/ViewdBy.dart rename to lib/core/data/models/vehicle/ViewdBy.dart diff --git a/lib/core/data/models/user.dart b/lib/core/data/models/vehicle/user.dart similarity index 77% rename from lib/core/data/models/user.dart rename to lib/core/data/models/vehicle/user.dart index 203d393..b85875d 100644 --- a/lib/core/data/models/user.dart +++ b/lib/core/data/models/vehicle/user.dart @@ -1,13 +1,14 @@ class User { User({ this.password, - this.firstName, - this.lastName, - this.email, - this.contactNumber, - this.address, - this.profilePicture, - this.id,}); + this.firstName, + this.lastName, + this.email, + this.contactNumber, + this.username, + this.address, + this.profilePicture, + this.id,}); User.fromJson(dynamic json) { firstName = json['first_name']??''; @@ -16,6 +17,7 @@ class User { contactNumber = json['contact_number']??''; address = json['address']??''; profilePicture = json['profile_picture']??''; + username = json['username']??''; id = json['id']; } String? firstName; @@ -26,6 +28,7 @@ class User { dynamic profilePicture; int? id; String?password; + String? username; Map toJson() { final map = {}; @@ -37,6 +40,7 @@ class User { map['profile_picture'] = profilePicture; map['id'] = id; map['password']=password; + map['username']=username; return map; } diff --git a/lib/core/data/models/vehicles.dart b/lib/core/data/models/vehicle/vehicles.dart similarity index 73% rename from lib/core/data/models/vehicles.dart rename to lib/core/data/models/vehicle/vehicles.dart index 515fba6..c5f17eb 100644 --- a/lib/core/data/models/vehicles.dart +++ b/lib/core/data/models/vehicle/vehicles.dart @@ -1,11 +1,13 @@ -import 'OriginCountry.dart'; -import 'OriginState.dart'; -import 'OriginCity.dart'; -import 'DestinationCountry.dart'; -import 'DestinationState.dart'; -import 'DestinationCity.dart'; -import 'EquipmentTypes.dart'; -import 'Attributes.dart'; +import 'package:hoga_load/core/data/models/vehicle/Attributes.dart'; +import 'package:hoga_load/core/data/models/vehicle/user.dart'; + +import '../master/DestinationCity.dart'; +import '../master/DestinationCountry.dart'; +import '../master/DestinationState.dart'; +import '../master/EquipmentTypes.dart'; +import '../master/OriginCity.dart'; +import '../master/OriginCountry.dart'; +import '../master/OriginState.dart'; import 'VehicleSizes.dart'; import 'VehicleTypes.dart'; import 'ViewdBy.dart'; @@ -23,13 +25,15 @@ class Vehicles { this.equipmentTypes, this.equipmentTypes2, this.attributes, + this.attributes2, this.vehicleSizes, this.vehicleSizes2, - this.vehicleTypes, + this.vehicleTypes2, this.weight, this.instructions, this.viewdBy, + this.user, this.createdAt, this.updatedAt, this.deletedAt,}); @@ -68,19 +72,19 @@ class Vehicles { }); } weight = json['weight']; -// instructions = json['instructions']; -// -// -// -// if (json['viewd_by'] != null) { -// viewdBy = []; -// json['viewd_by'].forEach((v) { -// viewdBy!.add(ViewdBy.fromJson(v)); -// }); -// } -// createdAt = json['created_at']; -// updatedAt = json['updated_at']; -// deletedAt = json['deleted_at']; + instructions = json['instructions']; + + user = (json['user'] != null ? User.fromJson(json['user']) : null)!; + + if (json['viewd_by'] != null) { + viewdBy = []; + json['viewd_by'].forEach((v) { + viewdBy!.add(ViewdBy.fromJson(v)); + }); + } + createdAt = json['created_at']; + updatedAt = json['updated_at']; + deletedAt = json['deleted_at']; } int? id; String? availabilityDate; @@ -96,7 +100,14 @@ class Vehicles { List? vehicleTypes; List? equipmentTypes2=[]; List? vehicleSizes2=[]; +<<<<<<< HEAD +======= + List? attributes2=[]; + List? vehicleTypes2=[]; + +>>>>>>> nada + User? user; String? weight; dynamic instructions; List? viewdBy; @@ -109,22 +120,22 @@ class Vehicles { map['id'] = id; map['availability_date'] = availabilityDate; if (originCountry != null) { - map['origin_country'] = originCountry!.toJson(); + map['origin_country'] = originCountry!.id!; } if (originState != null) { - map['origin_state'] = originState!.toJson(); + map['origin_state'] = originState!.id; } if (originCity != null) { - map['origin_city'] = originCity!.toJson(); + map['origin_city'] = originCity!.id; } if (destinationCountry != null) { - map['destination_country'] = destinationCountry!.toJson(); + map['destination_country'] = destinationCountry!.id; } if (destinationState != null) { - map['destination_state'] = destinationState!.toJson(); + map['destination_state'] = destinationState!.id; } if (destinationCity != null) { - map['destination_city'] = destinationCity!.toJson(); + map['destination_city'] = destinationCity!.id; } if (equipmentTypes != null) { map['equipment_types'] = equipmentTypes!.map((v) => v.toJson()).toList(); @@ -140,7 +151,15 @@ class Vehicles { } map['weight'] = weight; map['instructions'] = instructions; +<<<<<<< HEAD +======= + +>>>>>>> nada + if (user != null) { + map['user'] = user!.toJson(); + } + map['user'] = user; if (viewdBy != null) { map['viewd_by'] = viewdBy!.map((v) => v.toJson()).toList(); } diff --git a/lib/core/data/models/vehicle_model.dart b/lib/core/data/models/vehicle_model.dart deleted file mode 100644 index 4214c2d..0000000 --- a/lib/core/data/models/vehicle_model.dart +++ /dev/null @@ -1,65 +0,0 @@ -class VehicleModel { - VehicleModel({ - this.date, - this.originCountry, - this.originState, - this.originCity, - this.destinationCountry, - this.destinationState, - this.destinationCity, - this.equipmentTypes, - this.vehicleAttributes, - this.vehicleTypes, - this.vehicleSizes, - this.weight, - this.instructions, - }); - - VehicleModel.fromJson(dynamic json) { - date = json['availability_date']??''; - originCountry = json['origin_country']??''; - originState = json['origin_state']??''; - originCity = json['origin_city']??''; - destinationCountry = json['destination_country']??''; - destinationState = json['destination_state']??''; - destinationCity = json['destination_city']; - equipmentTypes = json['equipment_types']??''; - vehicleAttributes = json['vehicle_attributes']??''; - vehicleTypes = json['vehicle_types']??''; - vehicleSizes = json['vehicle_sizes']; - weight = json['weight']; - instructions = json['instructions']; - } - String? date; - String? originCountry; - String? originState; - String? originCity; - String? destinationCountry; - String? destinationState; - String? destinationCity; - var equipmentTypes; - var vehicleAttributes; - var vehicleTypes; - var vehicleSizes; - String? weight; - String? instructions; - - Map toJson() { - final map = {}; - map['availability_date'] = date; - map['origin_country'] = originCountry; - map['origin_state'] = originState; - map['origin_city'] = originCity; - map['destination_country'] = destinationCountry; - map['destination_state'] = destinationState; - map['destination_city'] = destinationState; - map['equipment_types']=equipmentTypes; - map['vehicle_attributes'] = vehicleAttributes; - map['vehicle_types'] = vehicleTypes; - map['vehicle_sizes'] = vehicleSizes; - map['weight'] = weight; - map['instructions']=instructions; - return map; - } - -} \ No newline at end of file diff --git a/lib/core/data/repository/add_vehicle_repo.dart b/lib/core/data/repository/add_vehicle_repo.dart deleted file mode 100644 index 5c03298..0000000 --- a/lib/core/data/repository/add_vehicle_repo.dart +++ /dev/null @@ -1,143 +0,0 @@ -import 'package:hoga_load/core/data/models/GetJop_model.dart'; -import 'package:hoga_load/core/data/models/GetProduct_model.dart'; - -import '../api/api.dart'; -import '../models/Addvehicle_model.dart'; -import '../models/GetLoads_model.dart'; -import '../models/GetVehicle_model.dart'; -import '../models/Packages.dart'; -import '../models/vehicles.dart'; - -class VehicleRepo{ - - static Future< List > getData(url)async{ - var response= await Api().getHttp(url: url); - - ListattributesList=[]; - for(int i =0;i> getVehicle(url)async{ - var response= await Api().getHttp(url: url); - - ListvehiclesList=[]; - for(int i =0;i> getVehicles()async { - var response= await Api().getHttp(url: 'vehicles'); - - ListblogsList=[]; - for(int i =0;i> getLoads(url)async{ - var response= await Api().getHttp(url: url); - - ListloadsList=[]; - for(int i =0;i> getProducts(url)async{ - var response= await Api().getHttp(url: url); - - ListproductsList=[]; - for(int i =0;i> getJop(url)async{ - var response= await Api().getHttp(url: url); - - ListproductsList=[]; - for(int i =0;i> getPackage()async{ - var response= await Api().getHttp(url: 'advertisement-packages'); - - ListpackageList=[]; - for(int i =0;i> getBlogs(token)async{ diff --git a/lib/core/data/repository/jobs_repo.dart b/lib/core/data/repository/jobs_repo.dart new file mode 100644 index 0000000..e69de29 diff --git a/lib/core/data/repository/load_repo.dart b/lib/core/data/repository/load_repo.dart new file mode 100644 index 0000000..6f6325e --- /dev/null +++ b/lib/core/data/repository/load_repo.dart @@ -0,0 +1,173 @@ +import 'package:hoga_load/core/data/models/loads/GetLoads_model.dart'; +import 'package:hoga_load/features/loads/cubit/getLoad_cubit.dart'; + +import '../../../features/vehicles/get_vehicles/cubit/vehicle_cubit.dart'; +import '../../keys/keys.dart'; +import '../../master_cubit/getDataForm_cubit.dart'; +import '../api/api.dart'; +import '../local/cacheHelper.dart'; + +class LoadsRepo{ + static Future> getLoads(self) async { + String token= await CacheHelper.getString(SharedKeys.token); + var response = await Api().getHttp(url: 'loads',authToken: token,self: self); + + List loadsList = []; + for (int i = 0; i < response['records'].length; i++) { + GetLoadsModel blogModel = GetLoadsModel.fromJson(response['records'][i]); + + for (var element in blogModel.equipmentTypes!) { + blogModel.equipmentTypes2!.add(element.title!); + print('${element.title}'); + print(blogModel.equipmentTypes2); + } + for (var element in blogModel.vehicleSizes!) { + blogModel.vehicleSizes2!.add(element.title!); + print('${element.title}'); + print(blogModel.vehicleSizes2); + } + for(var element in blogModel.vehicleTypes!){ + blogModel.vehicleTypes2!.add(element.title!); + + + } + for(var element in blogModel.attributes!){ + blogModel.attributes2!.add(element.title!); + print('oooooo${element.title}'); + print( blogModel.equipmentTypes2); + + } + loadsList.add(blogModel); + } + + return loadsList; + } + + static Future> searchLoads( + {search, + equipmentSize, + attributes, + vehicleSize, + vehicleType, + context}) async { + String token = await CacheHelper.getString(SharedKeys.token); + print("repooo"); + print("equipment_types" + equipmentSize); + print("vehicle_attributes" + attributes); + print("vehicleSize" + vehicleSize); + print("vehicleType" + vehicleType); + print("origin_country_id" + + DataFormCubit.get(context).countryOriginID.toString()); + print("origin_country_id" + + DataFormCubit.get(context).stateOriginID.toString()); + print("origin_country_id" + + DataFormCubit.get(context).cityOriginID.toString()); + print("origin_country_id" + + DataFormCubit.get(context).countryDestinationID.toString()); + print("origin_country_id" + + DataFormCubit.get(context).stateDestinationID.toString()); + + var response = + await Api().getHttp(url: 'loads', authToken: token, data: { + "search": search, + "equipment_types": equipmentSize, + "vehicle_attributes": attributes, + "vehicle_sizes": vehicleSize, + "vehicle_types": vehicleType, + "origin_country_id": DataFormCubit.get(context).countryOriginID, + "origin_state_id": DataFormCubit.get(context).stateOriginID, + "origin_city_id": DataFormCubit.get(context).cityOriginID, + "destination_country_id": DataFormCubit.get(context).countryDestinationID, + "destination_state_id": DataFormCubit.get(context).stateDestinationID, + "destination_city_id": DataFormCubit.get(context).cityDestinationID, + }); + + List searchList = []; + + for (int i = 0; i < response['records'].length; i++) { + GetLoadsModel blogModel = GetLoadsModel.fromJson(response['records'][i]); + + for (var element in blogModel.equipmentTypes!) { + blogModel.equipmentTypes2!.add(element.title!); + print('oooooo${element.title}'); + print(blogModel.equipmentTypes2); + } + for (var element in blogModel.vehicleSizes!) { + blogModel.vehicleSizes2!.add(element.title!); + print('oooooo${element.title}'); + print(blogModel.vehicleSizes2); + } + searchList.add(blogModel); + } + + print(response.length); + print(searchList.length); + + return searchList; + } + + + static deleteLoads(vehicleId)async{ + String token=await CacheHelper.getString(SharedKeys.token); + return await Api().getHttp(url: "loads/delete",authToken:token,data: {"id":vehicleId} ); + + } + static editLoads({context,vehicleId})async{ + print("repooo"); + print("equipment_types"+DataFormCubit.get(context).dateTime.toString()); + print("vehicle_attributes"+VehiclesCubit.get(context).attributes.toString()); + print("vehicleSize"+VehiclesCubit.get(context).vehcleSize.toString()); + print("vehicleType"+VehiclesCubit.get(context).vehcleType.toString()); + print("origin_country_id"+DataFormCubit.get(context).countryOriginID.toString()); + print("origin_country_id"+DataFormCubit.get(context).stateOriginID.toString()); + print("origin_country_id"+DataFormCubit.get(context).cityOriginID.toString()); + print("origin_country_id"+DataFormCubit.get(context).countryDestinationID.toString()); + print("origin_country_id"+DataFormCubit.get(context).stateDestinationID.toString()); + String token=await CacheHelper.getString(SharedKeys.token); +// return await Api().getHttp(url: "loads/update",authToken:token,data:{ +// "id":vehicleId, +// "availability_date":DataFormCubit.get(context).dateTime.toString(), +// "equipment_types":VehiclesCubit.get(context).equipmentType.toString().replaceAll(",","-").replaceAll("[","").replaceAll("]","").replaceAll(" ",""), +// "vehicle_attributes":VehiclesCubit.get(context).attributes.toString().replaceAll(",","-").replaceAll("[","").replaceAll("]","").replaceAll(" ",""), +// "vehicle_sizes": VehiclesCubit.get(context).vehcleSize.toString().replaceAll(",","-").replaceAll("[","").replaceAll("]","").replaceAll(" ",""), +// "vehicle_types": VehiclesCubit.get(context).vehcleType.toString().replaceAll(",","-").replaceAll("[","").replaceAll("]","").replaceAll(" ",""), +// "origin_country":DataFormCubit.get(context).countryOriginID, +// "origin_state":DataFormCubit.get(context).stateOriginID, +// "origin_city":DataFormCubit.get(context).cityOriginID, +// "destination_country":DataFormCubit.get(context).countryDestinationID, +// "destination_state":DataFormCubit.get(context).stateDestinationID, +// "destination_city":DataFormCubit.get(context).cityDestinationID, +// "weight":VehiclesCubit.get(context).weightController, +// "instructions":VehiclesCubit.get(context).instructionsController, +// } + // ); + + } + static addLoads({context})async{ + String token=await CacheHelper.getString(SharedKeys.token); + return await Api().postHttp(url: "loads/add",authToken:token, + data: { + "availability_date":DataFormCubit.get(context).dateTime.toString(), + "equipment_types":VehiclesCubit.get(context).equipmentType.toString().replaceAll(",","-").replaceAll("[","").replaceAll("]","").replaceAll(" ",""), + "vehicle_attributes":VehiclesCubit.get(context).attributes.toString().replaceAll(",","-").replaceAll("[","").replaceAll("]","").replaceAll(" ",""), + "vehicle_sizes": VehiclesCubit.get(context).vehcleSize.toString().replaceAll(",","-").replaceAll("[","").replaceAll("]","").replaceAll(" ",""), + "vehicle_types": VehiclesCubit.get(context).vehcleType.toString().replaceAll(",","-").replaceAll("[","").replaceAll("]","").replaceAll(" ",""), + "origin_country":DataFormCubit.get(context).countryOriginID, + "origin_state":DataFormCubit.get(context).stateOriginID, + "origin_city":DataFormCubit.get(context).cityOriginID, + "destination_country":DataFormCubit.get(context).countryDestinationID, + "destination_state":DataFormCubit.get(context).stateDestinationID, + "destination_city":DataFormCubit.get(context).cityDestinationID, + "weight":LoadsCubit.get(context).weightController, + "instructions":LoadsCubit.get(context).instructionsController, + } ); + + } + static addLoadsTest({context})async{ + String token=await CacheHelper.getString(SharedKeys.token); + return await Api().postHttp(url: "loads/add",authToken:token); + + } + + +} \ No newline at end of file diff --git a/lib/core/data/repository/master_repo.dart b/lib/core/data/repository/master_repo.dart new file mode 100644 index 0000000..aeb6124 --- /dev/null +++ b/lib/core/data/repository/master_repo.dart @@ -0,0 +1,84 @@ +import '../api/api.dart'; +import '../models/vehicle/Addvehicle_model.dart'; + +class MasterRepo{ + + + static Future< List > getCountry(url)async{ + var response= await Api().getHttp(url: url); + Listlist=[]; + for(int i =0;i> getCity(url,state)async{ + var response= await Api().getHttp(url: url); + Listlist=[]; + print("city"); + for(int i =0;i> getState(url,country)async{ + var response= await Api().getHttp(url: url,data: {"country":"$country"}); + Listlist=[]; + for(int i =0;i> getData(url)async{ + var response= await Api().getHttp(url: url); + + ListattributesList=[]; + for(int i =0;i> getJop(url)async{ + var response= await Api().getHttp(url: url); + + ListattributesList=[]; + for(int i =0;i> getPackage()async{ + var response= await Api().getHttp(url: 'advertisement-packages'); + + ListpackageList=[]; + for(int i =0;i> getPlans()async{ + var response= await Api().getHttp(url: 'subscription-plans'); + + ListplansList=[]; + for(int i =0;i> getJop(url,self,{GetJopModel? productModel}) async { + String token= await CacheHelper.getString(SharedKeys.token); + var response = await Api().getHttp(url: url,authToken: token,self: self ); + + List productsList = []; + for (int i = 0; i < response['records'].length; i++) { + GetJopModel blogModel = + GetJopModel.fromJson(response['records'][i]); + productsList.add(blogModel); + } + return productsList; + } + + static Future> getProducts(url,self,{GetProductModel? productModel}) async { + String token= await CacheHelper.getString(SharedKeys.token); + var response = await Api().getHttp(url: url,authToken: token,self: self ); + + List productsList = []; + for (int i = 0; i < response['records'].length; i++) { + GetProductModel blogModel = + GetProductModel.fromJson(response['records'][i]); + productsList.add(blogModel); + } + return productsList; + } + static Future> searchProduct(url,self,{GetProductModel? productModel}) async { + String token= await CacheHelper.getString(SharedKeys.token); + var response = await Api().getHttp(url: url,authToken: token,self: self,data:productModel!.toJson() ); + + List productsList = []; + for (int i = 0; i < response['records'].length; i++) { + GetProductModel blogModel = + GetProductModel.fromJson(response['records'][i]); + productsList.add(blogModel); + } + return productsList; + } + + + static addProduct({context,GetProductModel? productModel})async{ + String token=await CacheHelper.getString(SharedKeys.token); + return await Api().postHttp(url: "products/add",authToken:token, + data:productModel!.toJson() ); + + } + + static addProductTest({context})async{ + String token=await CacheHelper.getString(SharedKeys.token); + return await Api().postHttp(url: "products/add",authToken:token); + + } + static delete(productId)async{ + String token=await CacheHelper.getString(SharedKeys.token); + return await Api().getHttp(url: "products/delete",authToken:token, + data: {"id":productId} ); + + } + static editVehicle(GetProductModel? productModel)async{ + + String token=await CacheHelper.getString(SharedKeys.token); + return await Api().postHttp(url: "products/update",authToken:token, data:productModel!.toJson()); + + } + static deleteJop(productId)async{ + String token=await CacheHelper.getString(SharedKeys.token); + return await Api().getHttp(url: "jobs/delete",authToken:token, + data: {"id":productId} ); + + } + static editJop(GetJopModel? productModel)async{ + + String token=await CacheHelper.getString(SharedKeys.token); + return await Api().postHttp(url: "jobs/update",authToken:token, data:productModel!.toJson()); + + } + + + static addJop({context,GetJopModel? jopModel})async{ + String token=await CacheHelper.getString(SharedKeys.token); + return await Api().postHttp(url: "jobs/add",authToken:token, + data:jopModel!.toJson() ); + + } +} \ No newline at end of file diff --git a/lib/core/data/repository/vehicle_repo.dart b/lib/core/data/repository/vehicle_repo.dart new file mode 100644 index 0000000..8254233 --- /dev/null +++ b/lib/core/data/repository/vehicle_repo.dart @@ -0,0 +1,412 @@ +import 'package:hoga_load/core/data/local/cacheHelper.dart'; +import 'package:hoga_load/core/keys/keys.dart'; +import 'package:hoga_load/core/master_cubit/getDataForm_cubit.dart'; +import '../../../features/vehicles/get_vehicles/cubit/vehicle_cubit.dart'; +import '../api/api.dart'; +import '../models/Packages.dart'; +import '../models/jobs/GetJop_model.dart'; +import '../models/loads/GetLoads_model.dart'; +import '../models/product/GetProduct_model.dart'; +import '../models/vehicle/Addvehicle_model.dart'; +<<<<<<< HEAD +import '../models/vehicle/GetVehicle_model.dart'; +======= +>>>>>>> nada +import '../models/vehicle/user.dart'; +import '../models/vehicle/vehicles.dart'; + +class VehicleRepo { + static Future> getData(url) async { + var response = await Api().getHttp(url: url); + + List attributesList = []; + for (int i = 0; i < response['records'].length; i++) { + AddVehicle blogModel = AddVehicle.fromJson(response['records'][i]); + attributesList.add(blogModel); + } + return attributesList; + } + + static Future> getProfile(url) async { + String token= await CacheHelper.getString(SharedKeys.token); + var response = await Api().getHttp( + url: url, authToken: token); + + List getProfileList = []; + for (int i = 0; i < response['records'].length; i++) { + User blogModel = User.fromJson(response['records'][i]); + getProfileList.add(blogModel); + print('firstname...............'); + print(blogModel.firstName); + } +<<<<<<< HEAD + + return getProfileList; + } +======= +>>>>>>> nada + + static Future> getVehicles() async { + String token= await CacheHelper.getString(SharedKeys.token); + var response = await Api().getHttp(url: 'vehicles',authToken: token); + +<<<<<<< HEAD +======= + return getProfileList; + } + + static Future< List > getVehicles(self)async { + String token=await CacheHelper.getString(SharedKeys.token); + print(token); + print(self); + var response= await Api().getHttp(url: 'vehicles',authToken: token,self: self); + +>>>>>>> nada + List blogsList = []; + for (int i = 0; i < response['records'].length; i++) { + Vehicles blogModel = Vehicles.fromJson(response['records'][i]); + + for (var element in blogModel.equipmentTypes!) { + blogModel.equipmentTypes2!.add(element.title!); + print('oooooo${element.title}'); + print(blogModel.equipmentTypes2); +<<<<<<< HEAD + } + for (var element in blogModel.vehicleSizes!) { + blogModel.vehicleSizes2!.add(element.title!); + print('oooooo${element.title}'); + print(blogModel.vehicleSizes2); + } +======= + } + for (var element in blogModel.vehicleSizes!) { + blogModel.vehicleSizes2!.add(element.title!); + print('oooooo${element.title}'); + print(blogModel.vehicleSizes2); + } + for(var element in blogModel.vehicleTypes!){ + blogModel.vehicleTypes2!.add(element.title!); + + + } + for(var element in blogModel.attributes!){ + blogModel.attributes2!.add(element.title!); + print('oooooo${element.title}'); + print( blogModel.equipmentTypes2); + + } +>>>>>>> nada + blogsList.add(blogModel); + } + + print(response.length); + print(blogsList.length); + + return blogsList; + } + +<<<<<<< HEAD + static Future> getLoads(url) async { + String token= await CacheHelper.getString(SharedKeys.token); + var response = await Api().getHttp(url: url,authToken: token); + + List loadsList = []; + for (int i = 0; i < response['records'].length; i++) { + GetLoadsModel blogModel = GetLoadsModel.fromJson(response['records'][i]); +======= + + + static Future> getJop(url) async { + String token= await CacheHelper.getString(SharedKeys.token); + var response = await Api().getHttp(url: url,authToken: token); + + List productsList = []; + for (int i = 0; i < response['records'].length; i++) { + GetJopModel blogModel = GetJopModel.fromJson(response['records'][i]); + productsList.add(blogModel); + } + return productsList; + } + + static Future> getPackage() async { + String token= await CacheHelper.getString(SharedKeys.token); + var response = await Api().getHttp(url: 'advertisement-packages',authToken: token); + + List packageList = []; + for (int i = 0; i < response['records'].length; i++) { + Packages blogModel = Packages.fromJson(response['records'][i]); + packageList.add(blogModel); + } + print(response.length); + print(packageList.length); + + return packageList; + } + + + static Future> searchVehicles( + {search, + equipmentSize, + attributes, + vehicleSize, + vehicleType, + context}) async { + String token = await CacheHelper.getString(SharedKeys.token); + print("repooo"); + print("equipment_types" + equipmentSize); + print("vehicle_attributes" + attributes); + print("vehicleSize" + vehicleSize); + print("vehicleType" + vehicleType); + print("origin_country_id" + + DataFormCubit.get(context).countryOriginID.toString()); + print("origin_country_id" + + DataFormCubit.get(context).stateOriginID.toString()); + print("origin_country_id" + + DataFormCubit.get(context).cityOriginID.toString()); + print("origin_country_id" + + DataFormCubit.get(context).countryDestinationID.toString()); + print("origin_country_id" + + DataFormCubit.get(context).stateDestinationID.toString()); + + var response = + await Api().getHttp(url: 'vehicles', authToken: token, data: { + "search": search, + "equipment_types": equipmentSize, + "vehicle_attributes": attributes, + "vehicle_sizes": vehicleSize, + "vehicle_types": vehicleType, + "origin_country_id": DataFormCubit.get(context).countryOriginID, + "origin_state_id": DataFormCubit.get(context).stateOriginID, + "origin_city_id": DataFormCubit.get(context).cityOriginID, + "destination_country_id": DataFormCubit.get(context).countryDestinationID, + "destination_state_id": DataFormCubit.get(context).stateDestinationID, + "destination_city_id": DataFormCubit.get(context).cityDestinationID, + }); + + List searchList = []; + + for (int i = 0; i < response['records'].length; i++) { + Vehicles blogModel = Vehicles.fromJson(response['records'][i]); +>>>>>>> nada + + for (var element in blogModel.equipmentTypes!) { + blogModel.equipmentTypes2!.add(element.title!); + print('oooooo${element.title}'); + print(blogModel.equipmentTypes2); + } + for (var element in blogModel.vehicleSizes!) { + blogModel.vehicleSizes2!.add(element.title!); + print('oooooo${element.title}'); + print(blogModel.vehicleSizes2); +<<<<<<< HEAD + } + loadsList.add(blogModel); + } + + return loadsList; + } + + static Future> getProducts(url) async { + String token= await CacheHelper.getString(SharedKeys.token); + var response = await Api().getHttp(url: url,authToken: token); + + List productsList = []; + for (int i = 0; i < response['records'].length; i++) { + GetProductModel blogModel = + GetProductModel.fromJson(response['records'][i]); + productsList.add(blogModel); + } + return productsList; + } + + static Future> getJop(url) async { + String token= await CacheHelper.getString(SharedKeys.token); + var response = await Api().getHttp(url: url,authToken: token); + + List productsList = []; + for (int i = 0; i < response['records'].length; i++) { + GetJopModel blogModel = GetJopModel.fromJson(response['records'][i]); + productsList.add(blogModel); + } + return productsList; + } + + static Future> getPackage() async { + String token= await CacheHelper.getString(SharedKeys.token); + var response = await Api().getHttp(url: 'advertisement-packages',authToken: token); + + List packageList = []; + for (int i = 0; i < response['records'].length; i++) { + Packages blogModel = Packages.fromJson(response['records'][i]); + packageList.add(blogModel); + } + print(response.length); + print(packageList.length); + + return packageList; + } + + static Future> searchVehicles( + {search, + equipmentSize, + attributes, + vehicleSize, + vehicleType, + context}) async { + String token = await CacheHelper.getString(SharedKeys.token); + print("repooo"); + print("equipment_types" + equipmentSize); + print("vehicle_attributes" + attributes); + print("vehicleSize" + vehicleSize); + print("vehicleType" + vehicleType); + print("origin_country_id" + + DataFormCubit.get(context).countryOriginID.toString()); + print("origin_country_id" + + DataFormCubit.get(context).stateOriginID.toString()); + print("origin_country_id" + + DataFormCubit.get(context).cityOriginID.toString()); + print("origin_country_id" + + DataFormCubit.get(context).countryDestinationID.toString()); + print("origin_country_id" + + DataFormCubit.get(context).stateDestinationID.toString()); + + var response = + await Api().getHttp(url: 'vehicles', authToken: token, data: { + "search": search, + "equipment_types": equipmentSize, + "vehicle_attributes": attributes, + "vehicle_sizes": vehicleSize, + "vehicle_types": vehicleType, + "origin_country_id": DataFormCubit.get(context).countryOriginID, + "origin_state_id": DataFormCubit.get(context).stateOriginID, + "origin_city_id": DataFormCubit.get(context).cityOriginID, + "destination_country_id": DataFormCubit.get(context).countryDestinationID, + "destination_state_id": DataFormCubit.get(context).stateDestinationID, + "destination_city_id": DataFormCubit.get(context).cityDestinationID, + }); + + List searchList = []; + + for (int i = 0; i < response['records'].length; i++) { + Vehicles blogModel = Vehicles.fromJson(response['records'][i]); + + for (var element in blogModel.equipmentTypes!) { + blogModel.equipmentTypes2!.add(element.title!); + print('oooooo${element.title}'); + print(blogModel.equipmentTypes2); + } + for (var element in blogModel.vehicleSizes!) { + blogModel.vehicleSizes2!.add(element.title!); + print('oooooo${element.title}'); + print(blogModel.vehicleSizes2); +======= +>>>>>>> nada + } + searchList.add(blogModel); + } + + print(response.length); + print(searchList.length); + + return searchList; +<<<<<<< HEAD + } +} +======= + } + + + static deleteVehicle(vehicleId)async{ + String token=await CacheHelper.getString(SharedKeys.token); + return await Api().getHttp(url: "vehicles/delete",authToken:token,data: {"id":vehicleId} ); + + } + static editVehicle({context,vehicleId})async{ + print("repooo"); + print("equipment_types"+DataFormCubit.get(context).dateTime.toString()); + print("vehicle_attributes"+VehiclesCubit.get(context).attributes.toString()); + print("vehicleSize"+VehiclesCubit.get(context).vehcleSize.toString()); + print("vehicleType"+VehiclesCubit.get(context).vehcleType.toString()); + print("origin_country_id"+DataFormCubit.get(context).countryOriginID.toString()); + print("origin_country_id"+DataFormCubit.get(context).stateOriginID.toString()); + print("origin_country_id"+DataFormCubit.get(context).cityOriginID.toString()); + print("origin_country_id"+DataFormCubit.get(context).countryDestinationID.toString()); + print("origin_country_id"+DataFormCubit.get(context).stateDestinationID.toString()); + String token=await CacheHelper.getString(SharedKeys.token); +// return await Api().getHttp(url: "vehicles/update",authToken:token,data:{ +// "id":vehicleId, +// "availability_date":DataFormCubit.get(context).dateTime.toString(), +// "equipment_types":VehiclesCubit.get(context).equipmentType.toString().replaceAll(",","-").replaceAll("[","").replaceAll("]","").replaceAll(" ",""), +// "vehicle_attributes":VehiclesCubit.get(context).attributes.toString().replaceAll(",","-").replaceAll("[","").replaceAll("]","").replaceAll(" ",""), +// "vehicle_sizes": VehiclesCubit.get(context).vehcleSize.toString().replaceAll(",","-").replaceAll("[","").replaceAll("]","").replaceAll(" ",""), +// "vehicle_types": VehiclesCubit.get(context).vehcleType.toString().replaceAll(",","-").replaceAll("[","").replaceAll("]","").replaceAll(" ",""), +// "origin_country":DataFormCubit.get(context).countryOriginID, +// "origin_state":DataFormCubit.get(context).stateOriginID, +// "origin_city":DataFormCubit.get(context).cityOriginID, +// "destination_country":DataFormCubit.get(context).countryDestinationID, +// "destination_state":DataFormCubit.get(context).stateDestinationID, +// "destination_city":DataFormCubit.get(context).cityDestinationID, +// "weight":VehiclesCubit.get(context).weightController, +// "instructions":VehiclesCubit.get(context).instructionsController, +// } + // ); + + } + static addVehicle({context})async{ + String token=await CacheHelper.getString(SharedKeys.token); + return await Api().postHttp(url: "vehicles/add",authToken:token, + data: { + "availability_date":DataFormCubit.get(context).dateTime.toString(), + "equipment_types":VehiclesCubit.get(context).equipmentType.toString().replaceAll(",","-").replaceAll("[","").replaceAll("]","").replaceAll(" ",""), + "vehicle_attributes":VehiclesCubit.get(context).attributes.toString().replaceAll(",","-").replaceAll("[","").replaceAll("]","").replaceAll(" ",""), + "vehicle_sizes": VehiclesCubit.get(context).vehcleSize.toString().replaceAll(",","-").replaceAll("[","").replaceAll("]","").replaceAll(" ",""), + "vehicle_types": VehiclesCubit.get(context).vehcleType.toString().replaceAll(",","-").replaceAll("[","").replaceAll("]","").replaceAll(" ",""), + "origin_country":DataFormCubit.get(context).countryOriginID, + "origin_state":DataFormCubit.get(context).stateOriginID, + "origin_city":DataFormCubit.get(context).cityOriginID, + "destination_country":DataFormCubit.get(context).countryDestinationID, + "destination_state":DataFormCubit.get(context).stateDestinationID, + "destination_city":DataFormCubit.get(context).cityDestinationID, + "weight":VehiclesCubit.get(context).weightController, + "instructions":VehiclesCubit.get(context).instructionsController, + } ); + + } + static addVehicleTest({context})async{ + String token=await CacheHelper.getString(SharedKeys.token); + return await Api().postHttp(url: "vehicles/add",authToken:token); + + } + + static addJop({context})async{ + String token=await CacheHelper.getString(SharedKeys.token); + return await Api().postHttp(url: "jobs/add",authToken:token, + data: { + "availability_date":DataFormCubit.get(context).dateTime.toString(), + "equipment_types":VehiclesCubit.get(context).equipmentType.toString().replaceAll(",","-").replaceAll("[","").replaceAll("]","").replaceAll(" ",""), + "vehicle_attributes":VehiclesCubit.get(context).attributes.toString().replaceAll(",","-").replaceAll("[","").replaceAll("]","").replaceAll(" ",""), + "vehicle_sizes": VehiclesCubit.get(context).vehcleSize.toString().replaceAll(",","-").replaceAll("[","").replaceAll("]","").replaceAll(" ",""), + "vehicle_types": VehiclesCubit.get(context).vehcleType.toString().replaceAll(",","-").replaceAll("[","").replaceAll("]","").replaceAll(" ",""), + "origin_country":DataFormCubit.get(context).countryOriginID, + "origin_state":DataFormCubit.get(context).stateOriginID, + "origin_city":DataFormCubit.get(context).cityOriginID, + "destination_country":DataFormCubit.get(context).countryDestinationID, + "destination_state":DataFormCubit.get(context).stateDestinationID, + "destination_city":DataFormCubit.get(context).cityDestinationID, + "weight":VehiclesCubit.get(context).weightController, + "instructions":VehiclesCubit.get(context).instructionsController, + } ); + + } + + static addJopTest({context})async{ + String token=await CacheHelper.getString(SharedKeys.token); + return await Api().postHttp(url: "jobs/add",authToken:token); + + } + + + +} + +>>>>>>> nada diff --git a/lib/core/dialoges/delete_dialoge.dart b/lib/core/dialoges/delete_dialoge.dart new file mode 100644 index 0000000..17ecc95 --- /dev/null +++ b/lib/core/dialoges/delete_dialoge.dart @@ -0,0 +1,38 @@ + +import 'package:flutter/material.dart'; +import 'package:hoga_load/features/auth/units/customer_button.dart'; +import 'package:hoga_load/widgets/widgets/custom_text.dart'; + +import '../../features/auth/domain/auth_cubit.dart'; + + +class DeleteEditDialog extends StatelessWidget { + DeleteEditDialog({super.key,this.function,this.btnText}); + Function? function; + String? btnText; + + @override + Widget build(BuildContext context) { + return + AlertDialog( + title: Center(child: CustomText(text: 'HegaLoad',)), + content: Text(('Warning! Are you sure to ' '${btnText!.toLowerCase()}'' this record?'),), + actions: [ + Row( + children: [ + Expanded( + child: CustomButton(text: 'Cancel', function: (){ + Navigator.pop(context); + },color: Colors.white,), + ), + + Expanded(child: CustomButton(text: btnText, function: function)), + + ], + ), + + ], + ); + + } +} diff --git a/lib/core/keys/keys.dart b/lib/core/keys/keys.dart index 530a594..3deed71 100644 --- a/lib/core/keys/keys.dart +++ b/lib/core/keys/keys.dart @@ -14,4 +14,12 @@ quantity, id, + } + + enum MasterKeys{ + equipmentTypes, + attributes, + vehicleSize, + vehicleTypes, + } \ No newline at end of file diff --git a/lib/core/master_cubit/getDataForm_cubit.dart b/lib/core/master_cubit/getDataForm_cubit.dart new file mode 100644 index 0000000..c656556 --- /dev/null +++ b/lib/core/master_cubit/getDataForm_cubit.dart @@ -0,0 +1,200 @@ +import 'dart:ffi'; + +import 'package:bloc/bloc.dart'; +import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:hoga_load/core/data/models/jobs/GetJop_model.dart'; +import 'package:hoga_load/core/data/repository/master_repo.dart'; +import '../data/models/vehicle/Addvehicle_model.dart'; +import 'getDataForm_state.dart'; + +class DataFormCubit extends Cubit { + DataFormCubit() : super(DataFormStatesLoading()); + + static DataFormCubit get(context) => BlocProvider.of(context); + Connectivity connectivity = Connectivity(); + List countryList = []; + List stateList = []; + List cityList = []; + List productList = []; + List jopTypeList=[]; + List jopCategoryList=[]; + + String countryOriginID='' ; + String stateOriginID='' ; + String cityOriginID='' ; + String countryDestinationID='' ; + String stateDestinationID='' ; + String cityDestinationID='' ; + String dateTime =''; + + String countryJop='' ; + String stateJop='' ; + String cityJop='' ; + String jopCategory =''; + String jopType =''; + String salary =''; + String noOfPost =''; + String shiftTIme =''; + String jopTitle =''; + + + getCountry() { + emit(GetCountryLoading()); + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + } else { + MasterRepo.getCountry('masters/countries') + .then((value) => { + print('..................................'), + print(value), + countryList = value, + emit(GetCountrySuccess(value)) + }) + .onError((error, stackTrace) => + {emit(GetCityFailed(error.toString())), print(error)}); + } + }); + } + + getCity(state) { + emit(GetCityLoading()); + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + } else { + MasterRepo.getCity("masters/cities",state) + .then((value) => { + print('..................................'), + print(value), + cityList = value, + emit(GetCitySuccess(value)) + }) + .onError((error, stackTrace) => + {emit(GetCityFailed(error.toString())), print(error)}); + } + }); + } + + getJopCategory() { + emit(GetJopCategoryLoading()); + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + } else { + MasterRepo.getJop('masters/job-categories') + .then((value) => { + print('................success..................'), + print(value), + jopCategoryList = value, + emit(GetJopCategorySuccess(value)) + }) + .onError((error, stackTrace) => + {emit(GetJopCategoryFailed(error.toString())), print(error)}); + } + }); + } + + getJopType() { + emit(GetJopTypeLoading()); + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + } else { + MasterRepo.getJop('masters/job-types',) + .then((value) => { + print('................success..................'), + print(value), + jopTypeList = value, + emit(GetJopTypeSuccess(value)) + }) + .onError((error, stackTrace) => + {emit(GetJopTypeFailed(error.toString())), print(error)}); + } + }); + } + + + getDestintionCity(state) { + emit(GetDestintionCityLoading()); + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + } else { + MasterRepo.getCity('masters/cities',state) + .then((value) => { + print('..................................'), + print(value), + cityList = value, + emit(GetDestintionCitySuccess(value)) + }) + .onError((error, stackTrace) => + {emit(GetDestintionCityFailed(error.toString())), print(error)}); + } + }); + } + + getState(country) { + print("getstate"); + print(country); + emit(GetStateLoading()); + //loadOriginState=false; + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + } else { + MasterRepo.getState('masters/states',country) + .then((value) => { + print('..................................'), + print(value), + stateList = value, + emit(GetStateSuccess(value)) + }) + .onError((error, stackTrace) => + {emit(GetStateFailed(error.toString())), print(error)}); + } + }); + } + getDestintionState(country) { + print("getstate"); + print(country); + emit(GetDestintionStateLoading()); + //loadOriginState=false; + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + } else { + MasterRepo.getState('masters/states',country) + .then((value) => { + print('..................................'), + print(value), + stateList = value, + emit(GetDestintionStateSuccess(value)) + }) + .onError((error, stackTrace) => + {emit(GetDestintionStateFailed(error.toString())), print(error)}); + } + }); + } + + + getProduct() { + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + } else { + MasterRepo.getData('masters/product-types') + .then((value) => { + print('..................................'), + print(value), + productList = value, + emit(GetProductTypeSuccess(value)) + }) + .onError((error, stackTrace) => + {emit(GetProductTypeFailed(error.toString())), print(error)}); + } + }); + } + +} \ No newline at end of file diff --git a/lib/core/master_cubit/getDataForm_state.dart b/lib/core/master_cubit/getDataForm_state.dart new file mode 100644 index 0000000..ad650e8 --- /dev/null +++ b/lib/core/master_cubit/getDataForm_state.dart @@ -0,0 +1,112 @@ +import '../data/models/vehicle/Addvehicle_model.dart'; + +abstract class AddDataFormStates{} + +class GetCountryLoading extends AddDataFormStates{} +class DataFormStatesLoading extends AddDataFormStates{} + +class GetCountrySuccess extends AddDataFormStates{ + ListaddCountry=[]; + GetCountrySuccess(this.addCountry); +} +class GetCountryFailed extends AddDataFormStates{ +} +class GetCityLoading extends AddDataFormStates{} +class GetJopCategoryLoading extends AddDataFormStates{} +class GetJopTypeLoading extends AddDataFormStates{} + + +class GetStateLoading extends AddDataFormStates{} + +class GetStateSuccess extends AddDataFormStates{ + + ListaddState=[]; + GetStateSuccess(this.addState); +} + +class GetStateFailed extends AddDataFormStates{ + + final String msg; + GetStateFailed(this.msg); +} + +class GetDestintionStateLoading extends AddDataFormStates{} + +class GetDestintionStateSuccess extends AddDataFormStates{ + + ListaddState=[]; + GetDestintionStateSuccess(this.addState); +} + +class GetDestintionStateFailed extends AddDataFormStates{ + + final String msg; + GetDestintionStateFailed(this.msg); +} + +class GetDestintionCityLoading extends AddDataFormStates{} + +class GetDestintionCitySuccess extends AddDataFormStates{ + + ListaddState=[]; + GetDestintionCitySuccess(this.addState); +} + +class GetDestintionCityFailed extends AddDataFormStates{ + + final String msg; + GetDestintionCityFailed(this.msg); +} + +class GetCitySuccess extends AddDataFormStates{ + + ListequipmentList=[]; + GetCitySuccess(this.equipmentList); +} + +class GetCityFailed extends AddDataFormStates{ + + final String msg; + GetCityFailed(this.msg); +} + +class GetJopCategorySuccess extends AddDataFormStates{ + + ListequipmentList=[]; + GetJopCategorySuccess(this.equipmentList); +} + +class GetJopCategoryFailed extends AddDataFormStates{ + + final String msg; + GetJopCategoryFailed(this.msg); +} +class GetJopTypeSuccess extends AddDataFormStates{ + + ListequipmentList=[]; + GetJopTypeSuccess(this.equipmentList); +} + +class GetJopTypeFailed extends AddDataFormStates{ + + final String msg; + GetJopTypeFailed(this.msg); +} + +class NetworkFailed extends AddDataFormStates { + + final String msg; + + NetworkFailed(this.msg); +} +class GetProductTypeSuccess extends AddDataFormStates{ + + ListequipmentList=[]; + GetProductTypeSuccess(this.equipmentList); +} + +class GetProductTypeFailed extends AddDataFormStates{ + + final String msg; + GetProductTypeFailed(this.msg); +} \ No newline at end of file diff --git a/lib/core/widgets/custom_no_container.dart b/lib/core/widgets/custom_no_container.dart index f9ce766..e93ff86 100644 --- a/lib/core/widgets/custom_no_container.dart +++ b/lib/core/widgets/custom_no_container.dart @@ -4,8 +4,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import '../../widgets/widgets/custom_text.dart'; class CustomNoContainer extends StatelessWidget { String? text; - - CustomNoContainer({ required this.text}); + bool isUpgradeMember; + CustomNoContainer({ required this.text,this.isUpgradeMember=false}); @override Widget build(BuildContext context) { @@ -20,7 +20,8 @@ class CustomNoContainer extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 15), child: CustomText( align: TextAlign.center, - text: 'There is no $text uploaded by you.', + text:isUpgradeMember?"** You do not have a valid subscription plan to post a vehicle detail. Please click below to subscribe.": + 'There is no $text uploaded by you.', fontSize: 16.sp, textHeight: 1.5, fontWeight: FontWeight.w500, diff --git a/lib/features/about/units/our_values.dart b/lib/features/about/units/our_values.dart index ed50779..f2fd6ef 100644 --- a/lib/features/about/units/our_values.dart +++ b/lib/features/about/units/our_values.dart @@ -1,12 +1,13 @@ part of '../view.dart'; + class Values extends StatelessWidget { const Values({super.key}); @override Widget build(BuildContext context) { return Padding( - padding: EdgeInsets.symmetric(horizontal: 15.w), - child: Column(children:[ + padding: EdgeInsets.symmetric(horizontal: 15.w), + child: Column(children: [ Padding( padding: EdgeInsets.only(top: 38.h), child: CustomText( @@ -25,24 +26,25 @@ class Values extends StatelessWidget { fontWeight: FontWeight.w600, ), ), - ValueContainer(image: 'assets/images/Rectangle 9.png',title: 'Post Loads and Vehicles',desc: - 'User can post loads and vehicles from one location to another and contact other users directly.', - ), - ValueContainer(image: 'assets/images/Rectangle 9 (1).png',title: 'List items for Sale & Purchase', - desc: 'Different items related to logistics can be posted with it\'s details for sale or purchase.', - + ValueContainer( + image: 'assets/images/Rectangle 9.png', + title: 'Post Loads and Vehicles', + desc: + 'User can post loads and vehicles from one location to another and contact other users directly.', ), - ValueContainer(image: 'assets/images/Rectangle 9 (2).png',title: 'Publish your Job Openings', - desc: 'All available jobs can be published with specific role and designation.', - + ValueContainer( + image: 'assets/images/Rectangle 9 (1).png', + title: 'List items for Sale & Purchase', + desc: + 'Different items related to logistics can be posted with it\'s details for sale or purchase.', + ), + ValueContainer( + image: 'assets/images/Rectangle 9 (2).png', + title: 'Publish your Job Openings', + desc: + 'All available jobs can be published with specific role and designation.', ), - - - - ]), ); } } - - diff --git a/lib/features/about/units/value_container.dart b/lib/features/about/units/value_container.dart index a80c775..f19b378 100644 --- a/lib/features/about/units/value_container.dart +++ b/lib/features/about/units/value_container.dart @@ -42,7 +42,7 @@ class ValueContainer extends StatelessWidget { text: title, fontSize: 16.sp, color: const Color(0xFF012970), - fontWeight: FontWeight.w700, + fontWeight: FontWeight.w400, ), )), ], @@ -55,7 +55,7 @@ class ValueContainer extends StatelessWidget { color: const Color(0xFF6C6C6C), text:desc!, fontSize: 14.sp, - fontWeight: FontWeight.w500, + fontWeight: FontWeight.w700, ), ), ], diff --git a/lib/features/about/view.dart b/lib/features/about/view.dart index dee491f..0a94f54 100644 --- a/lib/features/about/view.dart +++ b/lib/features/about/view.dart @@ -4,14 +4,15 @@ import 'package:hoga_load/core/app_images/app_images.dart'; import 'package:hoga_load/core/color_manager/color_manager.dart'; import 'package:hoga_load/features/about/units/value_container.dart'; import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; -import 'units/small_container.dart'; import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; import 'package:hoga_load/widgets/widgets/custom_text.dart'; +import 'units/small_container.dart'; + part 'units/body.dart'; part 'units/contact.dart'; -part 'units/video.dart'; part 'units/our_values.dart'; +part 'units/video.dart'; class AboutUsView extends StatelessWidget { const AboutUsView({Key? key}) : super(key: key); diff --git a/lib/features/add_product/units/form.dart b/lib/features/add_product/units/form.dart deleted file mode 100644 index a64ce5b..0000000 --- a/lib/features/add_product/units/form.dart +++ /dev/null @@ -1,354 +0,0 @@ -part of '../view.dart'; - -class Form extends StatefulWidget { - const Form({Key? key}) : super(key: key); - - @override - State
createState() => _FormState(); -} - -class _FormState extends State { - var country = ''; - - var state = ''; - - var city = ''; - var product = ''; - - @override - Widget build(BuildContext context) { - return CustomCard( - widget: Column( - children: [ - Padding( - padding: EdgeInsets.symmetric(vertical: 16.h), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - const Icon( - Icons.arrow_back_sharp, - ), - Expanded( - child: CustomText( - text: 'ADD PRODUCT', - fontSize: 18.sp, - fontWeight: FontWeight.w700, - ), - ) - ], - ), - ), - SizedBox( - width: 1.sw, - child: const Divider( - thickness: 1, - ), - ), - CustomTextField( - height: 64.h, - lines: 1, - name: 'Product for', - hintText: 'Buy', - ), - CustomTextField( - // name: '', - height: 64.h, - lines: 1, - hintText: 'Name of the Product', - color: Colors.grey, - ), - CustomTextField( - height: 64.h, - readOnly: true, - name: 'Country', - hintText: - country == '' ? 'Select a Country' : country, - suffixIcon: InkWell( - onTap: () { - showModalBottomSheet( - context: context, - builder: (context) { - return ListView.builder( - itemCount: - DataFormCubit.get(context).countryList.length, - itemBuilder: (context, index) => Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( - onTap: () { - setState(() { - country = - DataFormCubit.get(context) - .countryList[index] - .title!; - Navigator.of(context).pop(); - }); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: DataFormCubit.get(context) - .countryList[index] - .title == - null - ? const Center( - child: CircularProgressIndicator( - color: Colors.green, - ), - ) - : Text( - DataFormCubit.get(context) - .countryList[index] - .title!, - style: TextStyle( - color: Colors.black, - fontSize: 20.sp), - ), - ), - ), - ], - )); - }, - ); - }, - child: Icon( - Icons.expand_more, - size: 30.sp, - color: ColorManager.blackColor, - ), - )), - CustomTextField( - height: 64.h, - readOnly: true, - name: 'state', - hintText: state == '' ? 'Select a state' : state, - suffixIcon: InkWell( - onTap: () { - showModalBottomSheet( - context: context, - builder: (context) { - return ListView.builder( - itemCount: - DataFormCubit.get(context).stateList.length, - itemBuilder: (context, index) => Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( - onTap: () { - setState(() { - state = DataFormCubit.get(context) - .stateList[index] - .title!; - Navigator.of(context).pop(); - }); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: DataFormCubit.get(context) - .stateList[index] - .title == - null - ? const Center( - child: CircularProgressIndicator( - color: Colors.green, - ), - ) - : Text( - DataFormCubit.get(context) - .stateList[index] - .title!, - style: TextStyle( - color: Colors.black, - fontSize: 20.sp), - ), - ), - ), - ], - )); - }, - ); - }, - child: Icon( - Icons.expand_more, - size: 30.sp, - color: ColorManager.blackColor, - ), - )), - CustomTextField( - height: 64.h, - readOnly: true, - name: 'City', - hintText: city == '' ? 'Select a city' : city, - suffixIcon: InkWell( - onTap: () { - showModalBottomSheet( - context: context, - builder: (context) { - return ListView.builder( - itemCount: DataFormCubit.get(context).cityList.length, - itemBuilder: (context, index) => Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( - onTap: () { - setState(() { - city = DataFormCubit.get(context) - .cityList[index] - .title!; - Navigator.of(context).pop(); - }); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: DataFormCubit.get(context) - .cityList[index] - .title == - null - ? const Center( - child: CircularProgressIndicator( - color: Colors.green, - ), - ) - : Text( - DataFormCubit.get(context) - .cityList[index] - .title!, - style: TextStyle( - color: Colors.black, - fontSize: 20.sp), - ), - ), - ), - ], - )); - }, - ); - }, - child: Icon( - Icons.expand_more, - size: 30.sp, - color: ColorManager.blackColor, - ), - )), - - - CustomTextField( - height: 64.h, - readOnly: true, - name: 'Product Type', - hintText: product == '' ? 'Select a product type' : product, - suffixIcon: InkWell( - onTap: () { - showModalBottomSheet( - context: context, - builder: (context) { - return ListView.builder( - itemCount: DataFormCubit.get(context).productList.length, - itemBuilder: (context, index) => Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( - onTap: () { - setState(() { - product = DataFormCubit.get(context) - .productList[index] - .title!; - Navigator.of(context).pop(); - }); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: DataFormCubit.get(context) - .productList[index] - .title == - null - ? const Center( - child: CircularProgressIndicator( - color: Colors.green, - ), - ) - : Text( - DataFormCubit.get(context) - .productList[index] - .title!, - style: TextStyle( - color: Colors.black, - fontSize: 20.sp), - ), - ), - ), - ], - )); - }, - ); - }, - child: Icon( - Icons.expand_more, - size: 30.sp, - color: ColorManager.blackColor, - ), - )), - - CustomTextField( - height: 64.h, - hintText: 'Price (CAD)', - ), - Padding( - padding: EdgeInsets.symmetric(vertical: 5.h, horizontal: 14.w), - child: Container( - height: 64.h, - width: 1.sw, - decoration: BoxDecoration( - border: Border.all(color: ColorManager.greyColor), - color: ColorManager.whiteColor, - borderRadius: BorderRadius.circular(12.r)), - child: Row( - children: [ - Container( - height: 64.h, - width: 106.w, - decoration: BoxDecoration( - color: Colors.grey[100], - borderRadius: BorderRadius.circular(12.r)), - child: Center( - child: Text( - 'Choose File', - style: TextStyle( - color: const Color(0xFF757575), - fontWeight: FontWeight.w400, - fontSize: 14.sp), - ), - ), - ), - Center( - child: Text( - ' No File chosen', - style: TextStyle( - color: const Color(0xFF757575), - fontWeight: FontWeight.w400, - fontSize: 14.sp), - ), - ) - ], - ), - ), - ), - SizedBox( - width: 322.w, - child: const Divider( - thickness: 1, - ), - ), - CustomTextField( - height: 147.h, - lines: 6, - ), - Padding( - padding: EdgeInsets.only(top: 50.sp, bottom: 15.sp), - child: CustomButton( - text: 'Add new product', color: ColorManager.orange), - ), - ], - ), - ); - } -} diff --git a/lib/features/add_vehicle/cubit/getDataForm_cubit.dart b/lib/features/add_vehicle/cubit/getDataForm_cubit.dart deleted file mode 100644 index 4a00647..0000000 --- a/lib/features/add_vehicle/cubit/getDataForm_cubit.dart +++ /dev/null @@ -1,91 +0,0 @@ -import 'package:bloc/bloc.dart'; -import 'package:connectivity_plus/connectivity_plus.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:hoga_load/core/data/repository/add_vehicle_repo.dart'; - -import '../../../core/data/models/Addvehicle_model.dart'; -import 'getVehicle_states.dart'; - -class DataFormCubit extends Cubit { - DataFormCubit() : super(AddVehicleLoading()); - - static DataFormCubit get(context) => BlocProvider.of(context); - Connectivity connectivity = Connectivity(); - List countryList = []; - List stateList = []; - List cityList = []; - List productList = []; - - getCountry() { - connectivity.checkConnectivity().then((value) async { - if (ConnectivityResult.none == value) { - emit(NetworkFailed("Check your internet connection and try again")); - } else { - VehicleRepo.getData('masters/countries') - .then((value) => { - print('..................................'), - print(value), - countryList = value, - emit(GetEquipmentSuccess(value)) - }) - .onError((error, stackTrace) => - {emit(GetEquipmentFailed(error.toString())), print(error)}); - } - }); - } - - getCity() { - connectivity.checkConnectivity().then((value) async { - if (ConnectivityResult.none == value) { - emit(NetworkFailed("Check your internet connection and try again")); - } else { - VehicleRepo.getData('masters/cities') - .then((value) => { - print('..................................'), - print(value), - cityList = value, - emit(GetAttributesSuccess(value)) - }) - .onError((error, stackTrace) => - {emit(GetAttributesFailed(error.toString())), print(error)}); - } - }); - } - - getState() { - connectivity.checkConnectivity().then((value) async { - if (ConnectivityResult.none == value) { - emit(NetworkFailed("Check your internet connection and try again")); - } else { - VehicleRepo.getData('masters/states') - .then((value) => { - print('..................................'), - print(value), - stateList = value, - emit(GetVehicleSizeSuccess(value)) - }) - .onError((error, stackTrace) => - {emit(GetVehicleSizeFailed(error.toString())), print(error)}); - } - }); - } - - getProduct() { - connectivity.checkConnectivity().then((value) async { - if (ConnectivityResult.none == value) { - emit(NetworkFailed("Check your internet connection and try again")); - } else { - VehicleRepo.getData('masters/product-types') - .then((value) => { - print('..................................'), - print(value), - productList = value, - emit(GetVehicleSizeSuccess(value)) - }) - .onError((error, stackTrace) => - {emit(GetVehicleSizeFailed(error.toString())), print(error)}); - } - }); - } - -} \ No newline at end of file diff --git a/lib/features/add_vehicle/cubit/getDataForm_state.dart b/lib/features/add_vehicle/cubit/getDataForm_state.dart deleted file mode 100644 index d64a932..0000000 --- a/lib/features/add_vehicle/cubit/getDataForm_state.dart +++ /dev/null @@ -1,47 +0,0 @@ -import '../../../core/data/models/Addvehicle_model.dart'; - -abstract class AddDataFormStates{} - -class GetCountryLoading extends AddDataFormStates{} - -class GetCountrySuccess extends AddDataFormStates{ - ListaddCountry=[]; - GetCountrySuccess(this.addCountry); -} -class GetCountryFailed extends AddDataFormStates{ -} - -class GetStateLoading extends AddDataFormStates{} - -class GetStateSuccess extends AddDataFormStates{ - - ListaddState=[]; - GetStateSuccess(this.addState); -} - -class GetStateFailed extends AddDataFormStates{ - - final String msg; - GetStateFailed(this.msg); -} - - - -class GetCitySuccess extends AddDataFormStates{ - - ListequipmentList=[]; - GetCitySuccess(this.equipmentList); -} - -class GetCityFailed extends AddDataFormStates{ - - final String msg; - GetCityFailed(this.msg); -} - -class NetworkFailed extends AddDataFormStates { - - final String msg; - - NetworkFailed(this.msg); -} \ No newline at end of file diff --git a/lib/features/add_vehicle/cubit/getVehicle_cubit.dart b/lib/features/add_vehicle/cubit/getVehicle_cubit.dart index 22e1c48..64c45fb 100644 --- a/lib/features/add_vehicle/cubit/getVehicle_cubit.dart +++ b/lib/features/add_vehicle/cubit/getVehicle_cubit.dart @@ -1,13 +1,16 @@ import 'package:bloc/bloc.dart'; import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:hoga_load/core/data/repository/add_vehicle_repo.dart'; +import 'package:hoga_load/core/data/models/master/EquipmentTypes.dart'; +import 'package:hoga_load/core/data/models/vehicle/VehicleSizes.dart'; +import 'package:hoga_load/core/data/models/vehicle/VehicleTypes.dart'; +import 'package:hoga_load/core/data/repository/vehicle_repo.dart'; +import 'package:hoga_load/core/keys/keys.dart'; +import '../../../core/master_cubit/getDataForm_cubit.dart'; -import '../../../core/data/api/api.dart'; -import '../../../core/data/local/cacheHelper.dart'; -import '../../../core/data/models/Addvehicle_model.dart'; -import '../../../core/data/models/vehicles.dart'; -import '../../../core/keys/keys.dart'; +import '../../../core/data/models/vehicle/Addvehicle_model.dart'; +import '../../../core/data/models/vehicle/Attributes.dart'; +import '../../../core/data/models/vehicle/vehicles.dart'; import 'getVehicle_states.dart'; class VehiclesCubit extends Cubit { @@ -22,6 +25,14 @@ class VehiclesCubit extends Cubit { ListsearchList=[]; ListvehicleList=[]; + //checkBoxlist + List equipmentType=[]; + List attributes=[]; + List vehcleType=[]; + List vehcleSize=[]; + + + getAttributesCubit() { @@ -41,9 +52,6 @@ class VehiclesCubit extends Cubit { } }); } - - - getEquipmentsCubit() { connectivity.checkConnectivity().then((value) async { if (ConnectivityResult.none == value) { @@ -61,7 +69,6 @@ class VehiclesCubit extends Cubit { } }); } - getVehicleSizesCubit() { connectivity.checkConnectivity().then((value) async { if (ConnectivityResult.none == value) { @@ -79,7 +86,6 @@ class VehiclesCubit extends Cubit { } }); } - getVehicleTypesCubit() { connectivity.checkConnectivity().then((value) async { if (ConnectivityResult.none == value) { @@ -97,7 +103,6 @@ class VehiclesCubit extends Cubit { } }); } - getVehicleCubit(){ connectivity.checkConnectivity().then((value)async{ if(ConnectivityResult.none == value){ @@ -117,56 +122,145 @@ class VehiclesCubit extends Cubit { }); } + searchVehicles(context,{val,equipmentSize2,attributes2,vehicleSize2,vehicleType2}) { + searchList.clear(); + print("cubit"); + print(equipmentSize2); + print(vehicleSize2); - searchVehicles(val,context) { - searchList.clear(); - VehiclesCubit.get(context).vehicleList.forEach((i) { - if(i.weight!.toLowerCase().contains(val)||i.weight!.contains(val)){ - searchList.add(i); - } - else if(i.availabilityDate!.toLowerCase().contains(val)||i.availabilityDate!.contains(val)){ - searchList.add(i); - - }else if(i.vehicleSizes2.toString().toLowerCase().contains(val)||i.vehicleSizes2.toString().contains(val)){ - searchList.add(i); - - }else if(i.id!.toString().contains(val)){ - searchList.add(i); - }else if(i.originState!.title!.toString().toLowerCase().contains(val)||i.originState!.title!.toString().contains(val)){ - searchList.add(i); - - }else if(i.originCountry!.title!.contains(val)||i.originCountry!.title!.toString().contains(val)){ - searchList.add(i); - - }else if(i.originCity!.title!.contains(val)||i.originCity!.title!.toString().toLowerCase().contains(val)){ - searchList.add(i); + connectivity.checkConnectivity().then((value)async{ + if(ConnectivityResult.none == value){ + emit(NetworkFailed("Check your internet connection and try again")); + }else{ + VehicleRepo.searchVehicles(search: val,equipmentSize: equipmentSize2,vehicleSize: vehicleSize2, + attributes: attributes2,vehicleType: vehicleType2,context: context).then((value) => { + print('..................................'), + print(value), + print("value2"), - }else if(i.equipmentTypes2.toString().contains(val)||i.equipmentTypes2.toString().toLowerCase().contains(val)){ - searchList.add(i); + if(value.isNotEmpty){ + print("value"), + print('..................................'), + print(value), + searchList=value, + emit(GetSearchSuccess(searchList)), + equipmentType.clear(), + attributes.clear(), + vehcleType.clear(), + vehcleSize.clear(), + DataFormCubit.get(context).cityOriginID='', + DataFormCubit.get(context).countryOriginID='', + DataFormCubit.get(context).countryDestinationID='', + DataFormCubit.get(context).stateDestinationID='', + DataFormCubit.get(context).stateOriginID='', + DataFormCubit.get(context).cityDestinationID='', - }else if(i.destinationCountry!.title!.contains(val)||i.destinationCountry!.title!.toString().contains(val)){ - searchList.add(i); + }else{ + emit(GetSearchFailed('Nothing found try again')), + equipmentType.clear(), + attributes.clear(), + vehcleType.clear(), + vehcleSize.clear(), + DataFormCubit.get(context).cityOriginID='', + DataFormCubit.get(context).countryOriginID='', + DataFormCubit.get(context).countryDestinationID='', + DataFormCubit.get(context).stateDestinationID='', + DataFormCubit.get(context).stateOriginID='', + DataFormCubit.get(context).cityDestinationID='', + } - }else if(i.destinationState!.title!.contains(val)||i.destinationState!.title!.toLowerCase().contains(val)){ - searchList.add(i); + }).onError((error, stackTrace) => { + emit(GetSearchFailed(error.toString())), + equipmentType.clear(), + attributes.clear(), + vehcleType.clear(), + vehcleSize.clear(), + DataFormCubit.get(context).cityOriginID='', + DataFormCubit.get(context).countryOriginID='', + DataFormCubit.get(context).countryDestinationID='', + DataFormCubit.get(context).stateDestinationID='', + DataFormCubit.get(context).stateOriginID='', + DataFormCubit.get(context).cityDestinationID='', + print(error) - }else if(i.destinationCity!.title!.contains(val)||i.destinationCity!.title!.toLowerCase().contains(val)){ - searchList.add(i); + }); + } - }else{ - null; + }); +// searchList.clear(); +// VehiclesCubit.get(context).vehicleList.forEach((i) { +// if(i.weight!.toLowerCase().contains(val)||i.weight!.contains(val)){ +// searchList.add(i); +// } +// else if(i.availabilityDate!.toLowerCase().contains(val)||i.availabilityDate!.contains(val)){ +// searchList.add(i); +// +// }else if(i.vehicleSizes2.toString().toLowerCase().contains(val)||i.vehicleSizes2.toString().contains(val)){ +// searchList.add(i); +// +// }else if(i.id!.toString().contains(val)){ +// searchList.add(i); +// +// }else if(i.originState!.title!.toString().toLowerCase().contains(val)||i.originState!.title!.toString().contains(val)){ +// searchList.add(i); +// +// }else if(i.originCountry!.title!.contains(val)||i.originCountry!.title!.toString().contains(val)){ +// searchList.add(i); +// +// }else if(i.originCity!.title!.contains(val)||i.originCity!.title!.toString().toLowerCase().contains(val)){ +// searchList.add(i); +// +// }else if(i.equipmentTypes2.toString().contains(val)||i.equipmentTypes2.toString().toLowerCase().contains(val)){ +// searchList.add(i); +// +// }else if(i.destinationCountry!.title!.contains(val)||i.destinationCountry!.title!.toString().contains(val)){ +// searchList.add(i); +// +// }else if(i.destinationState!.title!.contains(val)||i.destinationState!.title!.toLowerCase().contains(val)){ +// searchList.add(i); +// +// }else if(i.destinationCity!.title!.contains(val)||i.destinationCity!.title!.toLowerCase().contains(val)){ +// searchList.add(i); +// +// }else{ +// null; +// +// } +// +// +// if(searchList!=null||searchList.length!=0){ +// emit(GetSearchSuccess(searchList)); +// +// }else{ +// emit(GetSearchFailed('list is empty')); +// +// } +// }); + } - } + changeCheckBox(boxKey,index,val){ - if(searchList!=null||searchList.length!=0){ - emit(GetSearchSuccess(searchList)); + if(boxKey==MasterKeys.vehicleSize.name){ + val?vehcleSize.add(vehicleSizeList[index].id):vehcleSize.remove(vehicleSizeList[index].id); + } + if(boxKey==MasterKeys.vehicleTypes.name){ + val?vehcleType.add(vehiclesTypeList[index].id):vehcleType.remove(vehiclesTypeList[index].id); + } + if(boxKey==MasterKeys.attributes.name){ + val?attributes.add(attributesList[index].id):attributes.remove(attributesList[index].id); + } + if(boxKey==MasterKeys.equipmentTypes.name){ + val?equipmentType.add(equipmentList[index].id):equipmentType.remove(equipmentList[index].id); + } + // emit(ChangeBox()); - }else{ - emit(GetSearchFailed('list is empty')); + print(vehcleSize); + print(attributes); + print(equipmentType); + print(vehcleType); - } - }); + print('+++++++++++++++++++++++++++++++++++'); } } diff --git a/lib/features/add_vehicle/cubit/getVehicle_states.dart b/lib/features/add_vehicle/cubit/getVehicle_states.dart deleted file mode 100644 index f639677..0000000 --- a/lib/features/add_vehicle/cubit/getVehicle_states.dart +++ /dev/null @@ -1,96 +0,0 @@ -import '../../../core/data/models/Addvehicle_model.dart'; -import '../../../core/data/models/vehicles.dart'; - - - -abstract class AddVehicleStates{} - -class VehicleLoading extends AddVehicleStates{} - -class AddSuccess extends AddVehicleStates{ -} -class AddFailed extends AddVehicleStates{ -} - -class AddVehicleLoading extends AddVehicleStates{} - -class GetAttributesSuccess extends AddVehicleStates{ - - ListattributesList=[]; - GetAttributesSuccess(this.attributesList); -} - -class GetAttributesFailed extends AddVehicleStates{ - - final String msg; - GetAttributesFailed(this.msg); -} - - - -class GetEquipmentSuccess extends AddVehicleStates{ - - ListequipmentList=[]; - GetEquipmentSuccess(this.equipmentList); -} - -class GetEquipmentFailed extends AddVehicleStates{ - - final String msg; - GetEquipmentFailed(this.msg); -} - - - -class GetVehicleSizeSuccess extends AddVehicleStates{ - - ListvehicleSizeList=[]; - GetVehicleSizeSuccess(this.vehicleSizeList); -} - -class GetVehicleSizeFailed extends AddVehicleStates{ - - final String msg; - GetVehicleSizeFailed(this.msg); -} - - -class GetVehiclesTypeSuccess extends AddVehicleStates{ - - ListvehiclesTypeList=[]; - GetVehiclesTypeSuccess(this.vehiclesTypeList); -} - -class GetVehiclesTypeFailed extends AddVehicleStates{ - - final String msg; - GetVehiclesTypeFailed(this.msg); -} -class GetVehicleSuccess extends AddVehicleStates{ - - ListvehicleList=[]; - GetVehicleSuccess(this.vehicleList); -} - -class GetVehicleFailed extends AddVehicleStates{ - - final String msg; - GetVehicleFailed(this.msg); -} -class GetSearchSuccess extends AddVehicleStates{ - - ListvehicleList=[]; - GetSearchSuccess(this.vehicleList); -} - -class GetSearchFailed extends AddVehicleStates{ - - final String msg; - GetSearchFailed(this.msg); -} - -class NetworkFailed extends AddVehicleStates{ - - final String msg; - NetworkFailed(this.msg); -} \ No newline at end of file diff --git a/lib/features/add_vehicle/units/form.dart b/lib/features/add_vehicle/units/form.dart deleted file mode 100644 index b7ed7df..0000000 --- a/lib/features/add_vehicle/units/form.dart +++ /dev/null @@ -1,424 +0,0 @@ -part of '../view.dart'; - -class FormInfo extends StatefulWidget { - const FormInfo({Key? key}) : super(key: key); - - @override - State createState() => _FormInfoState(); -} - -class _FormInfoState extends State { - var countryOrigin = ''; - var stateOrigin = ''; - var cityOrigin = ''; - var countryDestination = ''; - var stateDestination = ''; - var cityDestination = ''; - var day = ''; - var month = ''; - var year = ''; - String date = ''; - DateTime dateTime = DateTime.now(); - @override - Widget build(BuildContext context) { - return CustomCard( - widget: Column( - children: [ - Padding( - padding: EdgeInsets.symmetric(vertical: 17.h, horizontal: 14.w), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - const Icon(Icons.arrow_back_sharp), - Expanded( - child: CustomText( - text: 'ADD VEHICLE', - fontSize: 18.sp, - fontWeight: FontWeight.w700, - ), - ) - ], - ), - ), - SizedBox( - width: 1.sw, - child: const Divider( - thickness: 1, - ), - ), - CustomTextField( - height: 64.h, - readOnly: true, - name: 'Availability Date', - hintText: - date == '' ? 'dd-mm-yy' : date, - suffixIcon: InkWell( - onTap: () async { - DateTime? newDate = await showDatePicker( - context: context, - firstDate: DateTime(2000), - lastDate: DateTime(2100), - initialDate: dateTime); - if (newDate == null) return; - day = newDate.day.toString(); - month = newDate.month.toString(); - year = newDate.year.toString(); - - date = '$day/$month/$year'; - setState(() { - dateTime = newDate; - }); - }, - child: const Icon(Icons.date_range_outlined)), - ), - CustomTextField( - height: 64.h, - readOnly: true, - name: 'Original Country', - hintText: - countryOrigin == '' ? 'Select a Country' : countryOrigin, - suffixIcon: InkWell( - onTap: () { - showModalBottomSheet( - context: context, - builder: (context) { - return ListView.builder( - itemCount: - DataFormCubit.get(context).countryList.length, - itemBuilder: (context, index) => Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( - onTap: () { - setState(() { - countryOrigin = - DataFormCubit.get(context) - .countryList[index] - .title!; - Navigator.of(context).pop(); - }); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child:DataFormCubit.get(context).countryList[index].title==null?const Center(child: CircularProgressIndicator(color: Colors.green,),): Text( - DataFormCubit.get(context) - .countryList[index] - .title!, - style: TextStyle( - color: Colors.black, - fontSize: 20.sp), - ), - ), - ), - ], - )); - }, - ); - }, - child: Icon( - Icons.expand_more, - size: 30.sp, - color: ColorManager.blackColor, - ), - )), - CustomTextField( - height: 64.h, - readOnly: true, - name: 'Original State', - hintText: stateOrigin == '' ? 'Select a state' : stateOrigin, - suffixIcon: InkWell( - onTap: () { - showModalBottomSheet( - context: context, - builder: (context) { - return ListView.builder( - itemCount: - DataFormCubit.get(context).stateList.length, - itemBuilder: (context, index) => Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( - onTap: () { - setState(() { - stateOrigin = DataFormCubit.get(context) - .stateList[index] - .title!; - Navigator.of(context).pop(); - }); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: DataFormCubit.get(context) - .stateList[index] - .title == - null - ? const Center( - child: CircularProgressIndicator( - color: Colors.green, - ), - ) - : Text( - DataFormCubit.get(context) - .stateList[index] - .title!, - style: TextStyle( - color: Colors.black, - fontSize: 20.sp), - ), - ), - ), - ], - )); - }, - ); - }, - child: Icon( - Icons.expand_more, - size: 30.sp, - color: ColorManager.blackColor, - ), - )), - CustomTextField( - height: 64.h, - readOnly: true, - name: 'Original City', - hintText: cityOrigin == '' ? 'Select a city' : cityOrigin, - suffixIcon: InkWell( - onTap: () { - showModalBottomSheet( - context: context, - builder: (context) { - return ListView.builder( - itemCount: DataFormCubit.get(context).cityList.length, - itemBuilder: (context, index) => Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( - onTap: () { - setState(() { - cityOrigin = DataFormCubit.get(context) - .cityList[index] - .title!; - Navigator.of(context).pop(); - }); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: DataFormCubit.get(context) - .cityList[index] - .title == - null - ? const Center( - child: CircularProgressIndicator( - color: Colors.green, - ), - ) - : Text( - DataFormCubit.get(context) - .cityList[index] - .title!, - style: TextStyle( - color: Colors.black, - fontSize: 20.sp), - ), - ), - ), - ], - )); - }, - ); - }, - child: Icon( - Icons.expand_more, - size: 30.sp, - color: ColorManager.blackColor, - ), - )), - CustomTextField( - height: 64.h, - readOnly: true, - name: 'Destination Country', - hintText: countryDestination == '' - ? 'Select a country' - : countryDestination, - suffixIcon: InkWell( - onTap: () { - showModalBottomSheet( - context: context, - builder: (context) { - return ListView.builder( - itemCount: - DataFormCubit.get(context).countryList.length, - itemBuilder: (context, index) => Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( - onTap: () { - setState(() { - countryDestination = - DataFormCubit.get(context) - .countryList[index] - .title!; - Navigator.of(context).pop(); - }); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: DataFormCubit.get(context) - .countryList[index] - .title == - null - ? const Center( - child: CircularProgressIndicator( - color: Colors.green, - ), - ) - : Text( - DataFormCubit.get(context) - .countryList[index] - .title!, - style: TextStyle( - color: Colors.black, - fontSize: 20.sp), - ), - ), - ), - ], - )); - }, - ); - }, - child: Icon( - Icons.expand_more, - size: 30.sp, - color: ColorManager.blackColor, - ), - )), - CustomTextField( - height: 64.h, - readOnly: true, - name: 'Destination State', - hintText: - stateDestination == '' ? 'Select a state' : stateDestination, - suffixIcon: InkWell( - onTap: () { - showModalBottomSheet( - context: context, - builder: (context) { - return ListView.builder( - itemCount: - DataFormCubit.get(context).stateList.length, - itemBuilder: (context, index) => Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( - onTap: () { - setState(() { - stateDestination = - DataFormCubit.get(context) - .stateList[index] - .title!; - Navigator.of(context).pop(); - }); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: DataFormCubit.get(context) - .stateList[index] - .title == - null - ? const Center( - child: CircularProgressIndicator( - color: Colors.green, - ), - ) - : Text( - DataFormCubit.get(context) - .stateList[index] - .title!, - style: TextStyle( - color: Colors.black, - fontSize: 20.sp), - ), - ), - ), - ], - )); - }, - ); - }, - child: Icon( - Icons.expand_more, - size: 30.sp, - color: ColorManager.blackColor, - ), - )), - CustomTextField( - height: 64.h, - name: 'Destination City', - hintText: - cityDestination == '' ? 'Select a city' : cityDestination, - readOnly: true, - suffixIcon: InkWell( - onTap: () { - showModalBottomSheet( - context: context, - builder: (ctx) { - return ListView.builder( - itemCount: DataFormCubit.get(context).cityList.length, - itemBuilder: (context, index) => Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( - onTap: () { - setState(() { - cityDestination = - DataFormCubit.get(context) - .cityList[index] - .title!; - Navigator.of(context).pop(); - }); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: DataFormCubit.get(context) - .cityList[index] - .title == - null - ? const Center( - child: CircularProgressIndicator( - color: Colors.green, - ), - ) - : Text( - DataFormCubit.get(context) - .cityList[index] - .title!, - style: TextStyle( - color: Colors.black, - fontSize: 20.sp), - ), - ), - ), - ], - )); - }, - ); - }, - child: Icon( - Icons.expand_more, - size: 30.sp, - color: ColorManager.blackColor, - ), - )), - SizedBox( - width: 1.sw, - child: const Divider( - thickness: 1, - ), - ), - ], - ), - ); - } -} diff --git a/lib/features/add_vehicle/units/vehicles_size.dart b/lib/features/add_vehicle/units/vehicles_size.dart deleted file mode 100644 index ccf760a..0000000 --- a/lib/features/add_vehicle/units/vehicles_size.dart +++ /dev/null @@ -1,48 +0,0 @@ -part of '../view.dart'; - -class VehiclesSize extends StatelessWidget { - bool value4 = false; - - VehiclesSize({super.key}); - @override - Widget build(BuildContext context) { - return Column(children: [ - SizedBox( - width: 1.sw, - child: const Divider( - thickness: 1, - ), - ), - Column( - children: [ - Row( - children: [ - CustomText( - text: ' VEHICLE SIZES', - fontSize: 14.sp, - fontWeight: FontWeight.w600, - ) - ], - ), - SizedBox( - height: 14.h, - ), - SizedBox( - child: GridView.builder( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, childAspectRatio: 5), - itemCount: VehiclesCubit.get(context).vehicleSizeList.length, - itemBuilder: (BuildContext context, int index) { - return CustomCheckBox( - value: value4, - text: VehiclesCubit.get(context).vehicleSizeList[index].title); - }, - ), - ), - ], - ) - ]); - } -} diff --git a/lib/features/advertisements/units/upload_load.dart b/lib/features/advertisements/units/upload_load.dart deleted file mode 100644 index 15bef25..0000000 --- a/lib/features/advertisements/units/upload_load.dart +++ /dev/null @@ -1,26 +0,0 @@ -part of '../view.dart'; - -class UploadedLoad extends StatelessWidget { - const UploadedLoad({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return - CustomCard( - widget: Padding( - padding: EdgeInsets.symmetric(horizontal: 11.sp), - child: Column( - children: [ - SizedBox(height: 18.h,), - CustomCardTitle(text: 'UPLOADED LOADS',), - CustomNoContainer(text: 'advertisements'), - const Spacer(), - const Button() - - - ], - ), - ), - ); - } -} diff --git a/lib/features/advertisements/view.dart b/lib/features/advertisements/view.dart deleted file mode 100644 index d39a346..0000000 --- a/lib/features/advertisements/view.dart +++ /dev/null @@ -1,30 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:hoga_load/core/app_images/app_images.dart'; -import 'package:hoga_load/core/color_manager/color_manager.dart'; -import 'package:hoga_load/core/widgets/custom_card.dart'; -import 'package:hoga_load/core/widgets/custom_card_title.dart'; -import 'package:hoga_load/core/widgets/custom_no_container.dart'; -import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; -import 'package:hoga_load/widgets/widgets/custom_button.dart'; -import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; -part 'units/upload_load.dart'; -part 'units/button.dart'; -class AdvertisementView extends StatelessWidget { - const AdvertisementView({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return CustomScaffold( - body: SafeArea( - child: Column( - children: [ - CustomAppbar(title: 'Advertisements'), - const Expanded(child: UploadedLoad()), - - ], - ), - ), - ); - } -} diff --git a/lib/features/auth/domain/auth_cubit.dart b/lib/features/auth/domain/auth_cubit.dart index 6d0134d..4ef42ab 100644 --- a/lib/features/auth/domain/auth_cubit.dart +++ b/lib/features/auth/domain/auth_cubit.dart @@ -1,11 +1,13 @@ import 'dart:io'; + import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:hoga_load/core/data/local/cacheHelper.dart'; import 'package:hoga_load/core/keys/keys.dart'; import 'package:image_picker/image_picker.dart'; + import '../../../core/data/api/api.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; import '../../../core/dialoges/toast.dart'; import 'auth_states.dart'; @@ -18,6 +20,8 @@ class AuthCubit extends Cubit { signIn(loginModel) { var response = Api().postHttp(url: 'login', data: loginModel.toJson()); + print(response); + print('login response'); emit(SignInLoading()); response.then((value) => { diff --git a/lib/features/auth/login.dart b/lib/features/auth/login.dart index 166ed45..d8e504f 100644 --- a/lib/features/auth/login.dart +++ b/lib/features/auth/login.dart @@ -9,6 +9,7 @@ import 'package:hoga_load/features/auth/units/customer_text_field.dart'; import 'package:hoga_load/features/auth/units/logo.dart'; import 'package:hoga_load/features/home/view.dart'; import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; + import '../../../../core/widgets/custom_card.dart'; import '../../core/data/models/login_model.dart'; import '../../core/validator/validator.dart'; @@ -77,12 +78,12 @@ class Login extends StatelessWidget { function: () { if (formKey.currentState!.validate()) { AuthCubit.get(context).signIn(LoginModel( - password: passwordController.text, - userName: emailController.text)); + password: passwordController.text.trim(), + userName: emailController.text.trim())); } }, text: 'Login', - color: ColorManager.orange, + color: ColorManager.yellow, ), ), NoAccount(), diff --git a/lib/features/auth/sign_up.dart b/lib/features/auth/sign_up.dart index 6616f84..38a245f 100644 --- a/lib/features/auth/sign_up.dart +++ b/lib/features/auth/sign_up.dart @@ -6,7 +6,8 @@ import 'package:hoga_load/features/auth/units/custom_have_account.dart'; import 'package:hoga_load/features/auth/units/customer_text_field.dart'; import 'package:hoga_load/features/auth/units/profile_image.dart'; import 'package:hoga_load/features/home/view.dart'; -import '../../core/data/models/user.dart'; + +import '../../core/data/models/vehicle/user.dart'; import '../../core/validator/validator.dart'; import '../../core/widgets/custom_card.dart'; import '../../widgets/widgets/custom_appbar.dart'; @@ -101,17 +102,17 @@ class SignUp extends StatelessWidget { function: () { if(formKey.currentState!.validate()){ AuthCubit.get(context).signUp(User( - firstName: firstNameController!.text, - lastName: lastNameController!.text, - email: emailController!.text, - contactNumber: phoneController!.text, - password: passwordController!.text, - address:addressController!.text )); + firstName: firstNameController!.text.trim(), + lastName: lastNameController!.text.trim(), + email: emailController!.text.trim(), + contactNumber: phoneController!.text.trim(), + password: passwordController!.text.trim(), + address:addressController!.text.trim() )); } }, - text: 'Sign Up', color: ColorManager.orange, + text: 'Sign Up', color: ColorManager.yellow, ), const SizedBox(height: 12,), diff --git a/lib/features/auth/units/cant_login.dart b/lib/features/auth/units/cant_login.dart index 5c819fc..4f7d17d 100644 --- a/lib/features/auth/units/cant_login.dart +++ b/lib/features/auth/units/cant_login.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:hoga_load/core/color_manager/color_manager.dart'; import 'package:hoga_load/core/router/router.dart'; -import 'package:hoga_load/features/auth/domain/auth_cubit.dart'; import 'package:hoga_load/features/auth/units/recover_page.dart'; import 'package:hoga_load/widgets/widgets/custom_text.dart'; class NotLogged extends StatelessWidget { @@ -15,7 +14,7 @@ class NotLogged extends StatelessWidget { onTap: (){ MagicRouter.navigateTo(RecoverPage()); }, - child: CustomText(text: 'Can\'t log in ?',color: ColorManager.orange, + child: CustomText(text: 'Can\'t log in ?',color: ColorManager.yellow, textDecoration: TextDecoration.underline,fontWeight: FontWeight.normal,), ), ); diff --git a/lib/features/auth/units/card_title.dart b/lib/features/auth/units/card_title.dart index 295f0ec..6d34b41 100644 --- a/lib/features/auth/units/card_title.dart +++ b/lib/features/auth/units/card_title.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; + import '../../../core/color_manager/color_manager.dart'; import '../../../widgets/widgets/custom_text.dart'; class TitleText extends StatelessWidget { diff --git a/lib/features/auth/units/custom_have_account.dart b/lib/features/auth/units/custom_have_account.dart index 3756713..f0a5bef 100644 --- a/lib/features/auth/units/custom_have_account.dart +++ b/lib/features/auth/units/custom_have_account.dart @@ -1,9 +1,10 @@ import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:hoga_load/core/router/router.dart'; import 'package:hoga_load/features/auth/login.dart'; + import '../../../core/color_manager/color_manager.dart'; import '../../../widgets/widgets/custom_text.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; class HaveAccount extends StatelessWidget { @override Widget build(BuildContext context) { @@ -14,7 +15,7 @@ class HaveAccount extends StatelessWidget { children: [ CustomText(text: 'Do you have account?',fontWeight: FontWeight.bold,fontSize: 14.sp,color: ColorManager.greyColor, ), InkWell(onTap: (){MagicRouter.navigateTo(Login());}, - child: CustomText(text: ' Login',fontWeight: FontWeight.bold,fontSize: 14.sp,color: ColorManager.orange, )), + child: CustomText(text: ' Login',fontWeight: FontWeight.bold,fontSize: 14.sp,color: ColorManager.yellow, )), ], ), diff --git a/lib/features/auth/units/custom_no_account.dart b/lib/features/auth/units/custom_no_account.dart index d80886e..21677e9 100644 --- a/lib/features/auth/units/custom_no_account.dart +++ b/lib/features/auth/units/custom_no_account.dart @@ -15,7 +15,7 @@ class NoAccount extends StatelessWidget { children: [ CustomText(text: 'You don\'t have account?',fontWeight: FontWeight.bold,fontSize: 14,color: ColorManager.greyColor, ), InkWell(onTap: (){MagicRouter.navigateTo(SignUp());}, - child: CustomText(text: ' Sign Up',fontWeight: FontWeight.bold,fontSize: 14,color: ColorManager.orange, )), + child: CustomText(text: ' Sign Up',fontWeight: FontWeight.bold,fontSize: 14,color: ColorManager.yellow, )), ], ), diff --git a/lib/features/auth/units/customer_button.dart b/lib/features/auth/units/customer_button.dart index 873b168..34e0725 100644 --- a/lib/features/auth/units/customer_button.dart +++ b/lib/features/auth/units/customer_button.dart @@ -5,8 +5,9 @@ import '../../../widgets/widgets/custom_text.dart'; class CustomButton extends StatelessWidget { String? text; var function; + Color? color; - CustomButton({required this.text,required this.function, super.key}); + CustomButton({required this.text,required this.function,this.color, super.key}); @override Widget build(BuildContext context) { @@ -18,7 +19,7 @@ class CustomButton extends StatelessWidget { width: double.infinity, height: 48, decoration: BoxDecoration( - color: ColorManager.orange, + color: color??ColorManager.yellow, borderRadius: BorderRadius.circular(10), ), diff --git a/lib/features/auth/units/customer_text_field.dart b/lib/features/auth/units/customer_text_field.dart index f328bd6..61a3607 100644 --- a/lib/features/auth/units/customer_text_field.dart +++ b/lib/features/auth/units/customer_text_field.dart @@ -24,7 +24,7 @@ class CustomTextFormField extends StatelessWidget { keyboardType: keyBoardType, decoration: InputDecoration( focusedBorder:OutlineInputBorder( - borderSide: const BorderSide(color: ColorManager.orange,width: 1), + borderSide: const BorderSide(color: ColorManager.yellow,width: 1), borderRadius: BorderRadius.circular(12), diff --git a/lib/features/auth/units/profile_image.dart b/lib/features/auth/units/profile_image.dart index 0d6c4b9..2f95b81 100644 --- a/lib/features/auth/units/profile_image.dart +++ b/lib/features/auth/units/profile_image.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; + import '../../../core/color_manager/color_manager.dart'; import '../../../core/dialoges/pick_image.dart'; import '../../../widgets/widgets/custom_text.dart'; diff --git a/lib/features/auth/units/recover_page.dart b/lib/features/auth/units/recover_page.dart index ee950bc..22fb6d2 100644 --- a/lib/features/auth/units/recover_page.dart +++ b/lib/features/auth/units/recover_page.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:hoga_load/core/dialoges/toast.dart'; import 'package:hoga_load/core/router/router.dart'; import 'package:hoga_load/features/auth/units/customer_text_field.dart'; @@ -10,7 +9,6 @@ import '../../../core/widgets/custom_card.dart'; import '../../../widgets/widgets/custom_appbar.dart'; import '../../../widgets/widgets/custom_button.dart'; import '../../../widgets/widgets/custom_scaffold.dart'; -import '../../home/view.dart'; import '../domain/auth_cubit.dart'; import '../domain/auth_states.dart'; import '../login.dart'; @@ -75,7 +73,7 @@ class RecoverPage extends StatelessWidget { } }, text: 'Send Link', - color: ColorManager.orange, + color: ColorManager.yellow, ), ), ], diff --git a/lib/features/blogs/bloc/blog_cubit.dart b/lib/features/blogs/bloc/blog_cubit.dart index fa0e9d2..a670871 100644 --- a/lib/features/blogs/bloc/blog_cubit.dart +++ b/lib/features/blogs/bloc/blog_cubit.dart @@ -1,8 +1,7 @@ import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:hoga_load/core/data/models/blogs.dart'; -import '../../../core/data/models/vehicles.dart'; +import '../../../core/data/models/blogs/blogs.dart'; import '../../../core/data/repository/blog_repo.dart'; import 'blog_states.dart'; diff --git a/lib/features/blogs/bloc/blog_states.dart b/lib/features/blogs/bloc/blog_states.dart index e9430d8..6c608b2 100644 --- a/lib/features/blogs/bloc/blog_states.dart +++ b/lib/features/blogs/bloc/blog_states.dart @@ -1,6 +1,6 @@ -import '../../../core/data/models/blogs.dart'; +import '../../../core/data/models/blogs/blogs.dart'; abstract class BlogsState{} diff --git a/lib/features/blogs/blog_details.dart b/lib/features/blogs/blog_details.dart index 30f3e96..3f75150 100644 --- a/lib/features/blogs/blog_details.dart +++ b/lib/features/blogs/blog_details.dart @@ -1,9 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:hoga_load/core/color_manager/color_manager.dart'; -import 'package:hoga_load/core/data/models/blogs.dart'; import 'package:hoga_load/widgets/widgets/custom_container_blog.dart'; import 'package:hoga_load/widgets/widgets/custom_text.dart'; + +import '../../core/data/models/blogs/blogs.dart'; class BlogDetails extends StatelessWidget { final Blogs? blogs; const BlogDetails({super.key,this.blogs}); diff --git a/lib/features/blogs/view.dart b/lib/features/blogs/view.dart index a15eda1..f1fb319 100644 --- a/lib/features/blogs/view.dart +++ b/lib/features/blogs/view.dart @@ -8,7 +8,6 @@ import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; import '../../core/app_images/app_images.dart'; import '../../core/color_manager/color_manager.dart'; -import '../../widgets/widgets/custom_row.dart'; import '../../widgets/widgets/custom_text.dart'; import 'bloc/blog_cubit.dart'; import 'bloc/blog_states.dart'; diff --git a/lib/features/change_password/cubit/changePass_cubit.dart b/lib/features/change_password/cubit/changePass_cubit.dart index 1ee244c..6a7c134 100644 --- a/lib/features/change_password/cubit/changePass_cubit.dart +++ b/lib/features/change_password/cubit/changePass_cubit.dart @@ -1,6 +1,7 @@ import 'package:connectivity_plus/connectivity_plus.dart'; -import '../../../core/data/api/api.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; + +import '../../../core/data/api/api.dart'; import '../../../core/data/local/cacheHelper.dart'; import '../../../core/dialoges/toast.dart'; import '../../../core/keys/keys.dart'; diff --git a/lib/features/change_password/units/form.dart b/lib/features/change_password/units/form.dart index 94eceaf..bab508e 100644 --- a/lib/features/change_password/units/form.dart +++ b/lib/features/change_password/units/form.dart @@ -11,119 +11,116 @@ class form extends StatelessWidget { return BlocConsumer( listener: (context, state) {}, builder: (context, state) { - return SafeArea( - child: Container( - height: 540.h, - width: 345.w, - decoration: BoxDecoration( - color: ColorManager.whiteColor, - borderRadius: BorderRadius.circular(12.r)), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Center( - child: Padding( - padding: EdgeInsets.only(top: 15.h), - child: CustomText( - text: 'CHANGE PASSWORD', - fontSize: 18.sp, - fontWeight: FontWeight.w700, + return Container( + width: 1.sw, + decoration: BoxDecoration( + color: ColorManager.whiteColor, + borderRadius: BorderRadius.circular(12.r)), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Center( + child: Padding( + padding: EdgeInsets.only(top: 15.h), + child: CustomText( + text: 'CHANGE PASSWORD', + fontSize: 18.sp, + fontWeight: FontWeight.w700, + ), + )), + ], + ), + SizedBox( + width: 322.w, + child: const Divider( + thickness: 1, + )), + SizedBox( + height: 43.h, + ), + Form( + key: formKey, + child: Column( + children: [ + Padding( + padding: EdgeInsets.only(bottom: 6.h), + child: CustomTextField( + height: .07.sh, + color: Colors.grey[400], + hintText: 'Enter your current password', + controller: currentPassController, + validate: Validator.validatePassword, + ), ), - )), - ], - ), - SizedBox( - width: 322.w, - child: const Divider( - thickness: 1, - )), - SizedBox( - height: 43.h, - ), - Form( - key: formKey, - child: Column( - children: [ - Padding( - padding: EdgeInsets.only(bottom: 6.h), - child: CustomTextField( - height: .07.sh, - color: Colors.grey[400], - hintText: 'Enter your current password', - controller: currentPassController, - validate: Validator.validatePassword, - ), + Padding( + padding: EdgeInsets.only(bottom: 6.h), + child: CustomTextField( + height: .07.sh, + color: Colors.grey[400], + hintText: 'Enter your new password', + controller: newPassController, + validate: Validator.validatePassword, ), - Padding( - padding: EdgeInsets.only(bottom: 6.h), - child: CustomTextField( - height: .07.sh, - color: Colors.grey[400], - hintText: 'Enter your new password', - controller: newPassController, - validate: Validator.validatePassword, - ), + ), + Padding( + padding: EdgeInsets.only(bottom: 6.h), + child: CustomTextField( + height: .07.sh, + color: Colors.grey[400], + hintText: 'Enter again to confirm the password.', + controller: confirmPassController, + validate: Validator.validatePassword, ), - Padding( - padding: EdgeInsets.only(bottom: 6.h), - child: CustomTextField( - height: .07.sh, - color: Colors.grey[400], - hintText: 'Enter again to confirm the password.', - controller: confirmPassController, - validate: Validator.validatePassword, - ), + ), + ], + )), + if (state is ChangeLoading) + const Center( + child: CircularProgressIndicator( + color: ColorManager.primaryColor), + ) + else + CustomButton( + function: () { + if (formKey.currentState!.validate()) { + ChangePassCubit.get(context).changePass(ChangePassModel( + confirmPass: confirmPassController!.text.trim(), + currentPass: currentPassController!.text.trim(), + newPass: newPassController!.text.trim(), ), - ], - )), - if (state is ChangeLoading) - const Center( - child: CircularProgressIndicator( - color: ColorManager.primaryColor), - ) - else - CustomButton( - function: () { - if (formKey.currentState!.validate()) { - ChangePassCubit.get(context).changePass(ChangePassModel( - confirmPass: confirmPassController!.text.trim(), - currentPass: currentPassController!.text.trim(), - newPass: newPassController!.text.trim(), - ), - ); - print( CacheHelper.getString(SharedKeys.token)); - } - }, - text: 'CHANGE PASSWORD', - colortext: Colors.white, - color: ColorManager.primaryColor), - Padding( - padding: EdgeInsets.only(left: 11.w, right: 14.w, top: 17.h), - child: CustomText( - color: const Color(0xFF666666), - align: TextAlign.start, - text: - '* Please enter a strong password, a strong password contains at least one special character, one capital letter and a digit.', - fontSize: 14.sp, - fontWeight: FontWeight.w600, - ), + ); + print( CacheHelper.getString(SharedKeys.token)); + } + }, + text: 'CHANGE PASSWORD', + colortext: Colors.white, + color: ColorManager.primaryColor), + Padding( + padding: EdgeInsets.only(left: 11.w, right: 14.w, top: 17.h), + child: CustomText( + color: const Color(0xFF666666), + align: TextAlign.start, + text: + '* Please enter a strong password, a strong password contains at least one special character, one capital letter and a digit.', + fontSize: 14.sp, + fontWeight: FontWeight.w600, ), - Padding( - padding: EdgeInsets.only(left: 11.w, right: 14.w, top: 17.h), - child: CustomText( - color: const Color(0xFF666666), - align: TextAlign.start, - text: - '** Do not share your account details or password with anyone else. Our executive never asks for your sensitive details like passwords.', - fontSize: 14.sp, - fontWeight: FontWeight.w600, - ), + ), + Padding( + padding: EdgeInsets.only(left: 11.w, right: 14.w, top: 17.h), + child: CustomText( + color: const Color(0xFF666666), + align: TextAlign.start, + text: + '** Do not share your account details or password with anyone else. Our executive never asks for your sensitive details like passwords.', + fontSize: 14.sp, + fontWeight: FontWeight.w600, ), - ], - ), + ), + ], ), ); }, diff --git a/lib/features/contactus/units/form.dart b/lib/features/contactus/units/form.dart index 09fa18f..0277e33 100644 --- a/lib/features/contactus/units/form.dart +++ b/lib/features/contactus/units/form.dart @@ -32,7 +32,11 @@ class Form extends StatelessWidget { color: const Color(0xFF757575), ), CustomButton( - text: 'Update Profile', color: ColorManager.orange, +<<<<<<< HEAD + text: 'Send Message', color: ColorManager.orange, +======= + text: 'Send Message', color: ColorManager.yellow, +>>>>>>> nada ), diff --git a/lib/features/contactus/view.dart b/lib/features/contactus/view.dart index dfea7c2..6d1261b 100644 --- a/lib/features/contactus/view.dart +++ b/lib/features/contactus/view.dart @@ -4,13 +4,14 @@ import 'package:hoga_load/core/app_images/app_images.dart'; import 'package:hoga_load/core/color_manager/color_manager.dart'; import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; import 'package:hoga_load/widgets/widgets/custom_button.dart'; -import '../about/units/small_container.dart'; import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; import 'package:hoga_load/widgets/widgets/custom_text_field.dart'; import '../../core/widgets/custom_card.dart'; -part 'units/form.dart'; +import '../about/units/small_container.dart'; + part 'units/contact.dart'; +part 'units/form.dart'; class ContactUsView extends StatelessWidget { const ContactUsView({Key? key}) : super(key: key); diff --git a/lib/features/dashboard/cubit/UpdateProfile_state.dart b/lib/features/dashboard/cubit/UpdateProfile_state.dart index fdf8eee..574e07c 100644 --- a/lib/features/dashboard/cubit/UpdateProfile_state.dart +++ b/lib/features/dashboard/cubit/UpdateProfile_state.dart @@ -1,3 +1,5 @@ +import '../../../core/data/models/vehicle/user.dart'; + abstract class UpdateProfileStates{ } class UpdateLoading extends UpdateProfileStates{} @@ -6,6 +8,19 @@ class UpdateProfileLoading extends UpdateProfileStates{} class UpdateProfileSuccess extends UpdateProfileStates{} class UpdateProfileFailed extends UpdateProfileStates{} +class GetProfileSuccess extends UpdateProfileStates{ + ListprofileList=[]; + GetProfileSuccess(this.profileList); +} +class GetProfileFailed extends UpdateProfileStates{ + final String msg; + GetProfileFailed(this.msg); +} +class FailedNetwork extends UpdateProfileStates{ + + final String msg; + FailedNetwork(this.msg); +} diff --git a/lib/features/dashboard/cubit/updateProfile_cubit.dart b/lib/features/dashboard/cubit/updateProfile_cubit.dart index 5e8553a..f73270b 100644 --- a/lib/features/dashboard/cubit/updateProfile_cubit.dart +++ b/lib/features/dashboard/cubit/updateProfile_cubit.dart @@ -1,9 +1,13 @@ import 'package:connectivity_plus/connectivity_plus.dart'; -import '../../../core/data/api/api.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; + +import '../../../core/data/api/api.dart'; import '../../../core/data/local/cacheHelper.dart'; +import '../../../core/data/models/vehicle/user.dart'; +import '../../../core/data/repository/vehicle_repo.dart'; import '../../../core/dialoges/toast.dart'; import '../../../core/keys/keys.dart'; +import '../../../core/master_cubit/getDataForm_state.dart'; import 'UpdateProfile_state.dart'; class UpdateProfileCubit extends Cubit { @@ -11,6 +15,7 @@ class UpdateProfileCubit extends Cubit { static UpdateProfileCubit get(context) => BlocProvider.of(context); Connectivity connectivity = Connectivity(); + List? profileList = []; updateProfile(updateProfileModel,) async { var token = await CacheHelper.getString(SharedKeys.token); @@ -33,4 +38,22 @@ class UpdateProfileCubit extends Cubit { print(error), }); } + + getVehicleTypesCubit() { + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(FailedNetwork("Check your internet connection and try again")); + } else { + VehicleRepo.getProfile('profile') + .then((value) => { + print('..................................'), + print(value), + profileList = value, + emit(GetProfileSuccess(value)) + }) + .onError((error, stackTrace) => + {emit(GetProfileFailed(error.toString())), print(error)}); + } + }); + } } diff --git a/lib/features/dashboard/units/form.dart b/lib/features/dashboard/units/form.dart index 6c5c8b5..45d0bc6 100644 --- a/lib/features/dashboard/units/form.dart +++ b/lib/features/dashboard/units/form.dart @@ -11,7 +11,7 @@ class FormView extends StatelessWidget { TextEditingController? phoneController = TextEditingController(); @override Widget build(BuildContext context) { - return BlocConsumer( + return BlocConsumer( builder: (context, state) { return CustomCard( widget: Padding( @@ -21,7 +21,7 @@ class FormView extends StatelessWidget { child: Column( children: [ CustomTextField( - hintText: 'Satinder', + hintText: UpdateProfileCubit.get(context).profileList!.toString(), controller: firstnameController, validate: Validator.validateName, ), @@ -66,29 +66,32 @@ class FormView extends StatelessWidget { color: ColorManager.primaryColor), ) else - Padding( - padding: const EdgeInsets.only(top: 17, bottom: 27), - child: CustomButton( - function: (){ - if (formKey.currentState!.validate()) { - UpdateProfileCubit.get(context).updateProfile(UpdateProfile( - firstName: firstnameController!.text.trim(), - lastName: lastnameController!.text.trim(), - username: usernameController!.text.trim(), - phone: phoneController!.text.trim(), - email: emailController!.text.trim(), - address: addressController!.text.trim(), - ), - - ); - print( CacheHelper.getString(SharedKeys.token)); - - } - }, - text: 'Update Profile', - color: ColorManager.orange, - ), - ) + Padding( + padding: const EdgeInsets.only(top: 17, bottom: 27), + child: CustomButton( + function: () { + if (formKey.currentState!.validate()) { + UpdateProfileCubit.get(context).updateProfile( + UpdateProfile( + firstName: firstnameController!.text.trim(), + lastName: lastnameController!.text.trim(), + username: usernameController!.text.trim(), + phone: phoneController!.text.trim(), + email: emailController!.text.trim(), + address: addressController!.text.trim(), + ), + ); + print(CacheHelper.getString(SharedKeys.token)); + } + }, + text: 'Update Profile', +<<<<<<< HEAD + color: ColorManager.orange, +======= + color: ColorManager.yellow, +>>>>>>> nada + ), + ) ], ), ), diff --git a/lib/features/dashboard/view.dart b/lib/features/dashboard/view.dart index 368a82b..315e1dd 100644 --- a/lib/features/dashboard/view.dart +++ b/lib/features/dashboard/view.dart @@ -3,7 +3,6 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:hoga_load/core/color_manager/color_manager.dart'; import 'package:hoga_load/core/data/models/UpdateProfile_model.dart'; - import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; import 'package:hoga_load/widgets/widgets/custom_button.dart'; import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; @@ -15,6 +14,7 @@ import '../../core/validator/validator.dart'; import '../../core/widgets/custom_card.dart'; import 'cubit/UpdateProfile_state.dart'; import 'cubit/updateProfile_cubit.dart'; + part 'units/form.dart'; class DashboardView extends StatelessWidget { const DashboardView({Key? key}) : super(key: key); diff --git a/lib/features/home/controller.dart b/lib/features/home/controller.dart index 61da83d..6bbf2dc 100644 --- a/lib/features/home/controller.dart +++ b/lib/features/home/controller.dart @@ -1,12 +1,16 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:hoga_load/features/home/states.dart'; import 'package:hoga_load/features/home/units/homescreen.dart'; import 'package:hoga_load/features/jobs/view.dart'; -import 'package:hoga_load/features/loads/view.dart'; +import 'package:hoga_load/features/loads/cubit/getLoad_cubit.dart'; +import '../loads/get_loads/view.dart'; +import 'package:hoga_load/features/search_product/cubit/getProduct_cubit.dart'; import 'package:hoga_load/features/search_product/view.dart'; -import 'package:hoga_load/features/vehicles/view.dart'; +import '../vehicles/get_vehicles/cubit/vehicle_cubit.dart'; +import '../vehicles/get_vehicles/view.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; +import '../jobs/cubit/getJop_cubit.dart'; class HomeCubit extends Cubit { HomeCubit() : super(HomeLayoutLoading()); @@ -23,8 +27,13 @@ class HomeCubit extends Cubit { const JobsView() ]; - void changeBottom(int index) { + void changeBottom(int index,context) { currentIndex = index; + if(currentIndex==3)VehiclesCubit.get(context).getVehicleCubit(self: 0); + if(currentIndex==2)LoadsCubit.get(context).getLoad(); + if(currentIndex==1)ProductsCubit.get(context).getProduct(); + if(currentIndex==4)JopCubit.get(context).getJop(); + debugPrint(index.toString()); emit(ChangeBottomNavState()); } diff --git a/lib/features/home/units/drawer.dart b/lib/features/home/units/drawer.dart index 1f8b923..68df886 100644 --- a/lib/features/home/units/drawer.dart +++ b/lib/features/home/units/drawer.dart @@ -7,7 +7,7 @@ class OnDrawer extends StatelessWidget { Widget build(BuildContext context) { return Drawer( child: SingleChildScrollView( - physics: BouncingScrollPhysics(), + physics: const BouncingScrollPhysics(), child: Column( children: [ SizedBox(height: 15.h,), @@ -36,14 +36,13 @@ class OnDrawer extends StatelessWidget { navigatename: const Home(), ), CustomRowDrawer( - text: 'Dashboard', - icon: Icons.dashboard, - navigatename: const DashboardView(), - ), - CustomRowDrawer( +<<<<<<< HEAD text: 'Advertisement', +======= + text: 'UploadLoads', +>>>>>>> nada icon: Icons.railway_alert_outlined, - navigatename: const AdvertisementView(), + navigatename: const UploadedLoadsView(), ), CustomRowDrawer( text: 'Packages', @@ -91,21 +90,7 @@ class OnDrawer extends StatelessWidget { icon: Icons.update, navigatename: const AddUpdateCardView(), ), - CustomRowDrawer( - text: 'AddProducts', - icon: Icons.add, - navigatename: const AddProductsView(), - ), - CustomRowDrawer( - text: 'AddLoads', - icon: Icons.add, - navigatename: const AddLoadsView(), - ), - CustomRowDrawer( - text: 'AddVehicles', - icon: Icons.add, - navigatename: const AddVehiclesView(), - ), + CustomRowDrawer( text: 'AboutUs', icon: Icons.info_outline, diff --git a/lib/features/home/units/homebage/blog.dart b/lib/features/home/units/homebage/blog.dart new file mode 100644 index 0000000..0d41ee5 --- /dev/null +++ b/lib/features/home/units/homebage/blog.dart @@ -0,0 +1,38 @@ + +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import '../../../../widgets/widgets/custom_container_blog.dart'; +import '../../../../widgets/widgets/custom_text.dart'; +import '../../../blogs/bloc/blog_cubit.dart'; +import '../../../blogs/bloc/blog_states.dart'; + +class blog extends StatelessWidget { + const blog({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return BlocConsumer( + listener: (BuildContext context, state) { + print(BlogsCubit.get(context).blogList.length); + }, + builder: (BuildContext context, Object? state) { + if (state is GetSearchFailed) { + return Center(child: CustomText(text: state.msg)); + } + else { + return Container( + height: (BlogsCubit.get(context).blogList.length *166.h*2.25).h, + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + itemCount: BlogsCubit.get(context).blogList.length, + itemBuilder: (context, index) { + return CustomContainerBlog(BlogsCubit.get(context).blogList[index]); + }), + ); + } + } + ); + } +} \ No newline at end of file diff --git a/lib/features/home/units/homebage/body.dart b/lib/features/home/units/homebage/body.dart new file mode 100644 index 0000000..268f63a --- /dev/null +++ b/lib/features/home/units/homebage/body.dart @@ -0,0 +1,113 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import '../../../../core/color_manager/color_manager.dart'; +import '../../../../widgets/widgets/custom_text.dart'; + +class body extends StatelessWidget { + const body({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Container( + height: 249.h, + decoration: const BoxDecoration( + color: ColorManager.whiteColor, + image: DecorationImage( + image: AssetImage('assets/images/Rectangle 18.png')), + ), + child: Center( + child: Padding( + padding: EdgeInsets.only(left: 15.r, right: 15.r), + child: Container( + height: 135.h, + decoration: const BoxDecoration( + color: Color.fromRGBO(0, 0, 0, 0.7), + ), + child: Padding( + padding: EdgeInsets.all(10.r), + child: Container( + height: 115.h, + decoration: BoxDecoration( + border: Border.all(color: const Color(0xFFFDC52F))), + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.only(left: .5.r, right: .5.r), + child: CustomText( + align: TextAlign.center, + text: + 'Manage your Loads and Vehicles on single place', + fontSize: 19.sp, + fontWeight: FontWeight.w400, + color: const Color(0xFFFFFFFF), + ), + ), + Padding( + padding: EdgeInsets.only(left: 23.r, right: 23.r), + child: CustomText( + align: TextAlign.center, + text: + 'Find users available with list of Vehicles or Loads they need to move from one place to another', + fontSize: 12.sp, + fontWeight: FontWeight.w700, + color: const Color(0xFFFFFFFF), + ), + ), + ], + ), + ), + ), + ), + ), + )), + ), + Padding( + padding: EdgeInsets.only(left: 15.w), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + CustomText( + align: TextAlign.start, + text: 'WHO WE ARE', + fontSize: 14.sp, + fontWeight: FontWeight.w700, + color: const Color(0xFFFDC52F), + ), + ], + ), + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 8.h), + child: CustomText( + align: TextAlign.start, + text: + 'We are Logistics integrators with seamless communication between Load uploaders and carrier owners for their smooth transition of loads.', + fontSize: 16.sp, + fontWeight: FontWeight.w400, + color: const Color(0xFF000000), + ), + ), + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: CustomText( + align: TextAlign.start, + text: + 'We have been regularly updating system towards building a world class solution of Loads, Vehicles, Market and Jobs for an accessible solution towards communication and transparent upload machanism. Every user is given access to platform for their easy communication towards making logistics better.', + fontSize: 14.sp, + fontWeight: FontWeight.w700, + color: const Color(0xFF6C6C6C), + ), + ), + SizedBox( + height: 22.h, + ), + ], + ); + } +} diff --git a/lib/features/home/units/homebage/bottom.dart b/lib/features/home/units/homebage/bottom.dart new file mode 100644 index 0000000..d2e6c74 --- /dev/null +++ b/lib/features/home/units/homebage/bottom.dart @@ -0,0 +1,429 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:hoga_load/core/color_manager/color_manager.dart'; +import 'package:hoga_load/features/home/units/homebage/buttonContainer.dart'; +<<<<<<< HEAD +import 'package:hoga_load/features/home/units/homebage/vehicle_container.dart'; +import 'package:hoga_load/widgets/widgets/custom_text.dart'; + +import 'buy_container.dart'; +import 'features_container.dart'; +======= +import 'package:hoga_load/features/home/units/homebage/swiper1.dart'; +import 'package:hoga_load/features/home/units/homebage/swiper2.dart'; +import 'package:hoga_load/features/home/units/homebage/vehicle_container.dart'; +import 'package:hoga_load/widgets/widgets/custom_text.dart'; + +import '../../../blogs/view.dart'; +import '../../../plans/view.dart'; +import 'blog.dart'; +import 'expandable.dart'; +import 'features_container.dart'; +import 'listview.dart'; +>>>>>>> nada + +class Bottom extends StatelessWidget { + const Bottom({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 15.w), + child: Column(children: [ + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: CustomText( + text: 'OUR BUSINESS USP', + align: TextAlign.center, + fontSize: 14.sp, + fontWeight: FontWeight.w700, + color: const Color(0xFFFDC52F), + ), + ), + SizedBox( + height: 8.h, + ), + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: CustomText( + text: 'LIST OF FEATURES WE PROVIDE IN HEGALOAD PORTAL', + align: TextAlign.center, + fontSize: 16.sp, + fontWeight: FontWeight.w600, + color: const Color(0xFF000000), + ), + ), + SizedBox( + height: 8.h, + ), + Container( + height: 190.h, + width: 1.sw, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12.r), + image: const DecorationImage( + image: AssetImage('assets/images/Rectangle 21.png'), + fit: BoxFit.cover)), + ), + FeaturesContainer(' Faster Communication'), + FeaturesContainer(' Quick item for Sale'), + FeaturesContainer(' Instant Technical Support'), + FeaturesContainer(' Easy access to Jobs'), + FeaturesContainer(' Coverage in Canada & US'), + FeaturesContainer(' Coverage in Canada & US'), + SizedBox( + height: 50.h, + ), + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: CustomText( + text: 'How We Can Help You In Day To Day Logistics Activity', + align: TextAlign.center, + fontSize: 16.sp, + fontWeight: FontWeight.w600, + color: const Color(0xFF000000), + ), + ), + SizedBox( + height: 25.h, + ), + Row( +<<<<<<< HEAD + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + ButtonContainer(ColorManager.primaryColor, 'LOADS & VEHICLES'), + ButtonContainer(const Color(0xFFA9A9A9), 'JOBS'), +======= + children: [ + Expanded( + child: ButtonContainer( + ColorManager.primaryColor, 'LOADS & VEHICLES')), + SizedBox( + width: 4.w, + ), + ButtonContainer(const Color(0xFFA9A9A9), 'JOBS'), + SizedBox( + width: 4.w, + ), +>>>>>>> nada + ButtonContainer(const Color(0xFFA9A9A9), 'PRODUCTS'), + ], + ), + SizedBox( + height: 25.h, + ), + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: CustomText( + text: + 'Loads and Vehicle management allows you to connect with other users who are either booking a load or moving from one location to another.', + color: const Color(0xFF535353), + align: TextAlign.start, + fontSize: 14.sp, + fontWeight: FontWeight.w600, + ), + ), + SizedBox( + height: 9.h, + ), + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: Row( + children: [ + const Image(image: AssetImage('assets/images/Vector.png')), + CustomText( + text: ' List and search of Loads', + color: ColorManager.primaryColor, + fontSize: 14.sp, + fontWeight: FontWeight.w700, + ), + ], + ), + ), + SizedBox( + height: 9.h, + ), + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: CustomText( + text: + 'Items according to the type, size, durability and convenience can be uploaded in our system and matching vehicle owners can connect with you directly.', + color: const Color(0xFF535353), + align: TextAlign.start, + fontSize: 14.sp, + fontWeight: FontWeight.w600, + ), + ), + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: Row( + children: [ + const Image(image: AssetImage('assets/images/Vector.png')), + CustomText( + text: ' List and search of Vehicles', + color: ColorManager.primaryColor, + fontSize: 14.sp, + fontWeight: FontWeight.w700, + ), + ], + ), + ), + SizedBox( + height: 9.h, + ), + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: CustomText( + text: + 'Vehicle owners can list their available vehicle movement according to vehicle type, vehicle size, attributes and type of containers to get contacted from load providers.', + color: const Color(0xFF535353), + align: TextAlign.start, + fontSize: 14.sp, + fontWeight: FontWeight.w600, + ), + ), + SizedBox( + height: 25.h, + ), + Container( + decoration: BoxDecoration(borderRadius: BorderRadius.circular(15.r)), + child: + const Image(image: AssetImage('assets/images/Rectangle 26.png')), + ), + SizedBox( + height: 50.h, + ), + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: CustomText( + text: 'SERVICES', + align: TextAlign.center, + fontSize: 14.sp, + fontWeight: FontWeight.w700, + color: const Color(0xFFFDC52F), + ), + ), + SizedBox( + height: 8.h, + ), + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: CustomText( + text: 'SERVICES WE PROVIDE FOR YOUR DAILY LOGISTICS NEEDS', + align: TextAlign.center, + fontSize: 16.sp, + fontWeight: FontWeight.w600, + color: const Color(0xFF000000), + ), + ), +<<<<<<< HEAD + +======= +>>>>>>> nada + VehicleContainer( + 'assets/images/load.png', + 'Loads', + 'Go through our available list of loads.', + 'Read More', + const Color(0xFF2DB6FA)), + VehicleContainer( + 'assets/images/load.png', + 'Vehicles', + 'Choose your desired vehicle from our system.', + 'Read More', + const Color(0xFFF68C09)), + VehicleContainer( + 'assets/images/product.png', + 'Products', + 'Checkout available item for sale and purchase.', + 'Read More', + const Color(0xFF08DA4E)), +<<<<<<< HEAD + VehicleContainer( + 'assets/images/jop.png', + 'Jobs', + 'Upload your jobs here.', + 'Read More', + const Color(0xFFE9222C)), + +======= + VehicleContainer('assets/images/jop.png', 'Jobs', + 'Upload your jobs here.', 'Read More', const Color(0xFFE9222C)), + PlanBody(), +>>>>>>> nada + SizedBox( + height: 30.h, + ), + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: CustomText( +<<<<<<< HEAD + text: 'SUBSCRIPTION PLANS', +======= + text: 'F.A.Q', + align: TextAlign.center, + fontSize: 14.sp, + fontWeight: FontWeight.w700, + color: const Color(0xFFFDC52F), + ), + ), + SizedBox( + height: 8.h, + ), + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w, bottom: 15.h), + child: CustomText( + text: 'FREQUENTLY ASKED QUESTIONS', + align: TextAlign.center, + fontSize: 16.sp, + fontWeight: FontWeight.w600, + color: const Color(0xFF000000), + ), + ), + Expandable('What is Hegaload used for? ', + 'Hegaload connects you to qualified carriers and puts you in the driver\'s seat to select your carrier of choice.'), + Expandable('How do I request a booking? ', + 'Our booking system is a simplified process. You can place a listing online on our portal.'), + Expandable('How would I know my fare charges & bill amount?', + 'You can directly contact users with their contact information for booking.'), + Expandable( + 'Who will contact me for my booking or placing a listing on website ?', + 'Users with similar requirements will find you through the search parameters and contact you directly through your contact details.'), + Expandable( + 'Do you provide Parcel, bike, courier or car transport service?', + 'We as a portal do not provide any transportation services. We are logistics listing application where a user can directly post a requirements and contact user.'), + Expandable('How do I cancel my Subscription? ', + 'You can cancel your booking from user dashboard anytime.'), + SizedBox( + height: 30.h, + ), + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: CustomText( + text: 'TESTIMONIALS', +>>>>>>> nada + align: TextAlign.center, + fontSize: 14.sp, + fontWeight: FontWeight.w700, + color: const Color(0xFFFDC52F), + ), + ), + SizedBox( + height: 8.h, + ), + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: CustomText( +<<<<<<< HEAD + text: 'CHECK OUR PRICING POLICY', + align: TextAlign.center, + fontSize: 16.sp, + fontWeight: FontWeight.w700, + color: const Color(0xFF000000), + ), + ), + BuyContainer('Free Trial 30 Days','30 Load Postings \n30 Truck Posts \n5 Buy-Sell Posts \n2 Career Posts','0','assets/images/30day.png'), + BuyContainer('Bronze Plan','100 Load Postings \n100 Truck Posts \n10 Buy-Sell Posts \n5 Career Posts','35','assets/images/bronze.png'), + BuyContainer('Silver Plan','300 Load Postings \n300 Truck Posts \n30 Buy-Sell Posts \n20 Career Posts','35','assets/images/silver.png'), + BuyContainer('Gold Plan','600 Load Postings \n600 Truck Posts \n100 Buy-Sell Posts \n60 Career Posts','75','assets/images/gold.png'), +======= + text: 'WHAT THEY ARE SAYING ABOUT US', + align: TextAlign.center, + fontSize: 16.sp, + fontWeight: FontWeight.w600, + color: const Color(0xFF000000), + ), + ), + const swiper1(), + SizedBox( + height: 30.h, + ), + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: CustomText( + text: 'TEAM', + align: TextAlign.center, + fontSize: 14.sp, + fontWeight: FontWeight.w700, + color: const Color(0xFFFDC52F), + ), + ), + SizedBox( + height: 8.h, + ), + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: CustomText( + text: 'OUR HARD WORKING TEAM', + align: TextAlign.center, + fontSize: 16.sp, + fontWeight: FontWeight.w600, + color: const Color(0xFF000000), + ), + ), + const listView(), + + SizedBox( + height: 30.h, + ), + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: CustomText( + text: 'OUR CLIENTS', + align: TextAlign.center, + fontSize: 14.sp, + fontWeight: FontWeight.w700, + color: const Color(0xFFFDC52F), + ), + ), + SizedBox( + height: 8.h, + ), + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: CustomText( + text: 'OUR ASSOCIATE PARTNERS', + align: TextAlign.center, + fontSize: 16.sp, + fontWeight: FontWeight.w600, + color: const Color(0xFF000000), + ), + ), + swiper2(), + + SizedBox( + height: 30.h, + ), + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: CustomText( + text: 'BLOG', + align: TextAlign.center, + fontSize: 14.sp, + fontWeight: FontWeight.w700, + color: const Color(0xFFFDC52F), + ), + ), + SizedBox( + height: 8.h, + ), + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: CustomText( + text: 'RECENT POSTS FORM OUR BLOG', + align: TextAlign.center, + fontSize: 16.sp, + fontWeight: FontWeight.w600, + color: const Color(0xFF000000), + ), + ), + SizedBox( + height: 8.h, + ), + + const blog() +>>>>>>> nada + ]), + ); + } +} diff --git a/lib/features/home/units/homebage/buttonContainer.dart b/lib/features/home/units/homebage/buttonContainer.dart new file mode 100644 index 0000000..3348809 --- /dev/null +++ b/lib/features/home/units/homebage/buttonContainer.dart @@ -0,0 +1,35 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import '../../../../widgets/widgets/custom_text.dart'; +class ButtonContainer extends StatelessWidget { + ButtonContainer(this.color,this.text, {super.key}) ; +Color color; +String text; + @override + Widget build(BuildContext context) { + return Container( + height: 35.h, + + decoration: BoxDecoration( + color:color, + borderRadius: BorderRadius.circular(7.r)), + child: Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.all(9.r), + child: CustomText( + text: text, + fontSize: 14.sp, + fontWeight: FontWeight.w700, + color: const Color(0xFFFFFFFF), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/features/home/units/homebage/buy_container.dart b/lib/features/home/units/homebage/buy_container.dart new file mode 100644 index 0000000..f81c788 --- /dev/null +++ b/lib/features/home/units/homebage/buy_container.dart @@ -0,0 +1,213 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:hoga_load/widgets/widgets/custom_text.dart'; + +import '../../../../core/color_manager/color_manager.dart'; +<<<<<<< HEAD + +class BuyContainer extends StatelessWidget { + BuyContainer(this.text, this.desc, this.number,this.image, {super.key}); + String text; + String desc; + String number; + var image; + + @override + Widget build(BuildContext context) { + return Padding( + padding: EdgeInsets.only(top: 36.h), + child: Container( + height: 550.h, + decoration: BoxDecoration( + color: ColorManager.whiteColor, + borderRadius: BorderRadius.circular(12.r)), + child: Column( + children: [ + Padding( + padding: EdgeInsets.only(top: 18.h, bottom: 15.h), + child: CustomText( + text: text, + fontSize: 18.sp, + fontWeight: FontWeight.w800, + ), + ), + Stack(children: [ + Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.only(bottom: 15.0), + child: CustomText( + text: '\$', + fontSize: 20.sp, + fontWeight: FontWeight.w800, + color: const Color(0xFF000000), + ), + ), + CustomText( + text: number, + fontSize: 40.sp, + fontWeight: FontWeight.w800, + color: const Color(0xFF000000), + ), + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: CustomText( + text: '/ mo', + fontSize: 14.sp, + fontWeight: FontWeight.w800, + color: const Color(0xFFA9A9A9), + ), + ), + ], + ), + ), + ]), + Image(image: AssetImage(image)), + Expanded( + child: CustomText( + text: desc, + fontSize: 18.sp, + align: TextAlign.center, + fontWeight: FontWeight.w700, + color: const Color(0xFF000000), + ), + ), + Padding( +======= +import '../../../../core/router/router.dart'; +import '../../../../core/widgets/custom_card.dart'; +import '../../../add_update_card/view.dart'; + +class BuyContainer extends StatelessWidget { + BuyContainer({this.text, this.loadsNo,this.jobsNo,this.productNo,this.vehiclesNo, + this.price,this.image,super.key}); + String? text; + int? loadsNo; + int? vehiclesNo; + int? jobsNo; + int? productNo; + +String? price; + String? image; + + @override + Widget build(BuildContext context) { + return CustomCard( + bottomPadding: 0, + widget: Column( + children: [ + Padding( + padding: EdgeInsets.only(top: 18.h, bottom: 15.h), + child: CustomText( + text: text, + fontSize: 18.sp, + fontWeight: FontWeight.w800, + ), + ), + Stack(children: [ + Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.only(bottom: 15.0), + child: CustomText( + text: '\$', + fontSize: 20.sp, + fontWeight: FontWeight.w800, + ), + ), + CustomText( + text: price, + fontSize: 40.sp, + fontWeight: FontWeight.w800, + ), + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: CustomText( + text: '/ mo', + fontSize: 14.sp, + fontWeight: FontWeight.w800, + color: const Color(0xFFA9A9A9), + ), + ), + ], + ), + ), + ]), + Image(image: AssetImage(image!)), + CustomText( + text: "$loadsNo Load Postings", + fontSize: 18.sp, + align: TextAlign.center, + fontWeight: FontWeight.w700, + ), + CustomText( + text: "$vehiclesNo Truck Posts", + fontSize: 18.sp, + align: TextAlign.center, + fontWeight: FontWeight.w700, + ), + CustomText( + text: "$productNo Buy-Sell Posts", + fontSize: 18.sp, + align: TextAlign.center, + fontWeight: FontWeight.w700, + ), + CustomText( + text: "$jobsNo Career Posts", + fontSize: 18.sp, + align: TextAlign.center, + fontWeight: FontWeight.w700, + ), + + + InkWell( + onTap: (){ + MagicRouter.navigateTo(AddUpdateCardView()); + + }, + child: Padding( +>>>>>>> nada + padding: EdgeInsets.all(12.r), + child: Container( + height: 60.h, + decoration: BoxDecoration( + border: Border.all( +<<<<<<< HEAD + color: const Color(0xFF0D6EFD), +======= + color: ColorManager.primaryColor, +>>>>>>> nada + ), + color: ColorManager.whiteColor, + borderRadius: BorderRadius.circular(7.r), + ), + child: Center( + child: CustomText( + text: 'Buy Now', + fontSize: 22.sp, + fontWeight: FontWeight.w700, +<<<<<<< HEAD + color: const Color(0xFF0D6EFD), + ), + ), + ), + ) + ], + ), +======= + color: ColorManager.primaryColor, + ), + ), + ), + ), + ) + ], +>>>>>>> nada + ), + ); + } +} diff --git a/lib/features/home/units/homebage/contact.dart b/lib/features/home/units/homebage/contact.dart new file mode 100644 index 0000000..ade9daf --- /dev/null +++ b/lib/features/home/units/homebage/contact.dart @@ -0,0 +1,61 @@ + + +import 'package:flutter/cupertino.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import '../../../../core/app_images/app_images.dart'; +import '../../../about/units/small_container.dart'; + +class Contact extends StatelessWidget { + const Contact({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Row( + children: [ + Expanded( + child: CustomContainer( + text:'232' , + hint:'Happy Customers' , + image: AppImages.happy, + ), + ), + + Expanded( + child: CustomContainer( + text:'521' , + hint: 'Vehicles', + image: AppImages.vehicle, + ), + ), + ], + ), + Row( + children: [ + + Expanded( + child: CustomContainer( + text:'1463' , + hint:'Products' , + image: AppImages.shoppingCart, + ), + ), + + Expanded( + child: CustomContainer( + text:'15' , + hint: 'Technical Staffs', + image: AppImages.usersGroup, + ), + ), + ], + ), + SizedBox( + height: 22.h, + ), + ], + ); + } +} diff --git a/lib/features/home/units/homebage/expandable.dart b/lib/features/home/units/homebage/expandable.dart new file mode 100644 index 0000000..18430c6 --- /dev/null +++ b/lib/features/home/units/homebage/expandable.dart @@ -0,0 +1,36 @@ +import 'package:expandable/expandable.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:hoga_load/widgets/widgets/custom_text.dart'; + +class Expandable extends StatelessWidget { + Expandable(this.text,this.desc, {super.key}); +String? text; +String? desc; + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.only(top: 10.0), + child: ExpandablePanel( + header: Padding( + padding: const EdgeInsets.only(top: 8.0), + child: Column( + children: [ + CustomText(text: text,align:TextAlign.start,fontSize: 16.sp,fontWeight: FontWeight.w600,color: const Color(0xFF000000),), + SizedBox( + width: 1.sw,child: const Divider(thickness: 1.5,),), + ], + ), + ), + collapsed: Column( + children: [ + CustomText(text: desc,fontSize: 14.sp,fontWeight: FontWeight.w600,color: const Color(0xFF7B7B7B),), + ], + ), + expanded: const Text('', softWrap: true, ), + + ), + ); + } +} \ No newline at end of file diff --git a/lib/features/home/units/homebage/features_container.dart b/lib/features/home/units/homebage/features_container.dart new file mode 100644 index 0000000..fcae2ad --- /dev/null +++ b/lib/features/home/units/homebage/features_container.dart @@ -0,0 +1,38 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:hoga_load/widgets/widgets/custom_text.dart'; + +import '../../../../core/color_manager/color_manager.dart'; + +class FeaturesContainer extends StatelessWidget { + String text; + FeaturesContainer(this.text, {super.key}); + + @override + Widget build(BuildContext context) { + return Padding( + padding: EdgeInsets.only(top: 16.h), + child: Container( + height: 53.h, + width: 1.sw, + decoration: BoxDecoration( + color: ColorManager.whiteColor, + borderRadius: BorderRadius.circular(12.r)), + child: Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Image(image: AssetImage('assets/images/Group 959.png')), + CustomText( + text: text, + fontSize: 16.sp, + fontWeight: FontWeight.w400, + color: const Color(0xFF000000), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/features/home/units/homebage/listview.dart b/lib/features/home/units/homebage/listview.dart new file mode 100644 index 0000000..23ca2a5 --- /dev/null +++ b/lib/features/home/units/homebage/listview.dart @@ -0,0 +1,81 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:hoga_load/widgets/widgets/custom_text.dart'; + +import '../modelList.dart'; +class WaveShape extends CustomClipper { + @override + getClip(Size size) { + Path path = new Path(); + final lowPoint = size.height - 20; + final highPoint = size.height - 40; + path.lineTo(0, size.height); + path.quadraticBezierTo( + size.width / 4, highPoint, size.width / 2, lowPoint); + path.quadraticBezierTo( + 3 / 4 * size.width, size.height, size.width, lowPoint); + path.lineTo(size.width, 0); + return path; + } + @override + bool shouldReclip(CustomClipper oldClipper) => true; +} +class listView extends StatelessWidget { + const listView({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Padding( + padding: EdgeInsets.only(top: 30.h), + child: Container( + height: 1800.h, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10.r ), + ), + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + itemCount: list.length, + itemBuilder: (context, index) => Column( + children: [ + ClipPath( + clipper: WaveShape(), + child: Container( + width: 1.sw, + height: 315.h, + child:Image(image: AssetImage(list[index].img)) , + ),), + + + CustomText( + align: TextAlign.center, + text: list[index].name, + fontSize: 20.sp, + fontWeight: FontWeight.w700, + ), + SizedBox( + height:6.h , + ), + CustomText( + align: TextAlign.center, + text: list[index].jop, + fontSize: 14.sp, + fontWeight: FontWeight.w500, + color: const Color(0xFFAEAEAE), + ), + SizedBox( + height:14.h , + ), + CustomText( + align: TextAlign.center, + text: list[index].desc, + fontSize: 14.sp, + fontWeight: FontWeight.w500, + color: const Color(0xFF858585), + ), + ], + )), + ), + ); + } +} diff --git a/lib/features/home/units/homebage/our_values.dart b/lib/features/home/units/homebage/our_values.dart new file mode 100644 index 0000000..a5c070e --- /dev/null +++ b/lib/features/home/units/homebage/our_values.dart @@ -0,0 +1,54 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import '../../../../widgets/widgets/custom_text.dart'; +import '../../../about/units/value_container.dart'; + + +class Values extends StatelessWidget { + const Values({super.key}); + + @override + Widget build(BuildContext context) { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 15.w), + child: Column(children:[ + Padding( + padding: EdgeInsets.only(top: 38.h), + child: CustomText( + text: 'OUR VALUES', + fontSize: 14.sp, + color: const Color(0xFFFDC52F), + fontWeight: FontWeight.w700, + ), + ), + Padding( + padding: EdgeInsets.only(top: 8.h, bottom: 22.h), + child: CustomText( + align: TextAlign.center, + text: 'OUR APPROACH TO MAKE YOUR LOGISTICS EASY', + fontSize: 16.sp, + fontWeight: FontWeight.w600, + ), + ), + ValueContainer(image: 'assets/images/Rectangle 9.png',title: 'Post Loads and Vehicles',desc: + 'User can post loads and vehicles from one location to another and contact other users directly.', + ), + ValueContainer(image: 'assets/images/Rectangle 9 (1).png',title: 'List items for Sale & Purchase', + desc: 'Different items related to logistics can be posted with it\'s details for sale or purchase.', + + ), + ValueContainer(image: 'assets/images/Rectangle 9 (2).png',title: 'Publish your Job Openings', + desc: 'All available jobs can be published with specific role and designation.', + + ), + + + + + ]), + ); + } +} + + diff --git a/lib/features/home/units/homebage/small_container.dart b/lib/features/home/units/homebage/small_container.dart new file mode 100644 index 0000000..6179836 --- /dev/null +++ b/lib/features/home/units/homebage/small_container.dart @@ -0,0 +1,48 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:hoga_load/core/color_manager/color_manager.dart'; +import 'package:hoga_load/widgets/widgets/custom_text.dart'; + +class CustomContainer extends StatelessWidget { + CustomContainer({Key? key, this.image, this.text, this.hint}) + : super(key: key); + String? image; + String? text; + String? hint; + @override + Widget build(BuildContext context) { + return Padding( + padding: EdgeInsets.only(left:15.h,bottom: 15.h), + child: Container( + decoration: BoxDecoration( + color: ColorManager.whiteColor, + borderRadius: BorderRadius.circular(12.r) + ), + + + child: Padding( + padding: EdgeInsets.symmetric(vertical: 10.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + SvgPicture.asset(image!), + CustomText( + text: text, + fontSize: 19.sp, + fontWeight: FontWeight.w600, + color: const Color(0xFF012970), + ), + CustomText( + text: hint, + fontSize: 14.sp, + fontWeight: FontWeight.w500, + color: ColorManager.darkGrey, + ) + ], + ), + ), + ), + ); + } +} diff --git a/lib/features/home/units/homebage/swiper1.dart b/lib/features/home/units/homebage/swiper1.dart new file mode 100644 index 0000000..6ea08b0 --- /dev/null +++ b/lib/features/home/units/homebage/swiper1.dart @@ -0,0 +1,111 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_swiper_view/flutter_swiper_view.dart'; + +import '../../../../widgets/widgets/custom_text.dart'; +import '../modelSwiper.dart'; +class swiper1 extends StatelessWidget { + const swiper1({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + height: 300.h, + child: Swiper( + autoplay: true, + pagination: const SwiperPagination( + alignment: Alignment.bottomCenter, + ), + itemCount: swiperList.length, + itemBuilder: (context, index) { + return Padding( + padding: EdgeInsets.all(10.r), + child: Container( + height: 200.h, + width: 1.sw, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12.r)), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 10.h, + ), + Padding( + padding: EdgeInsets.only(left:.25.sw), + child: Container( + width: 1.sw, + height: 20, + child: GridView.builder( + itemCount: 5, + scrollDirection: Axis.horizontal, + itemBuilder: (context, index) => Image( + width: 15.w, + height: 15.h, + image: const AssetImage( + 'assets/images/star.png')), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 1, childAspectRatio: 1), + ), + ), + ), + SizedBox( + height: 10.h, + ), + CustomText( + text: swiperList[index].text, + align: TextAlign.center, + fontSize: 12.sp, + fontWeight: FontWeight.w600, + ), + ], + ), + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + height: 10.h, + ), + CircleAvatar( + radius: 40.r, + backgroundImage: + AssetImage(swiperList[index].img), + ), + SizedBox( + height: 10.h, + ), + CustomText( + text: swiperList[index].nameImage, + fontSize: 12.sp, + fontWeight: FontWeight.w700, + ), + SizedBox( + height: 10.h, + ), + CustomText( + text: swiperList[index].jop, + fontSize: 10.sp, + fontWeight: FontWeight.w600, + color: const Color(0xFFA4A4A4), + ), + SizedBox( + height: 20.h, + ), + ], + ) + ], + ), + ), + ); + }, + ), + ), + ); + } +} diff --git a/lib/features/home/units/homebage/swiper2.dart b/lib/features/home/units/homebage/swiper2.dart new file mode 100644 index 0000000..b8c7e18 --- /dev/null +++ b/lib/features/home/units/homebage/swiper2.dart @@ -0,0 +1,44 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_swiper_view/flutter_swiper_view.dart'; + +import '../../../../widgets/widgets/custom_text.dart'; +import '../modelSwiper.dart'; +class swiper2 extends StatelessWidget { + swiper2({Key? key}) : super(key: key); +List image=[ + 'assets/images/img3.png', + 'assets/images/img4.png', + 'assets/images/img5.png', + 'assets/images/img8.png', + 'assets/images/img7.png', + 'assets/images/img1.png', + 'assets/images/img2.png', +]; + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + height: 150.h, + child: Swiper( + autoplay: true, + pagination: const SwiperPagination( + alignment: Alignment.bottomCenter, + ), + itemCount: image.length, + itemBuilder: (context, index) { + return Padding( + padding: EdgeInsets.all(30.r), + + child: Image( + height: 46.h, + width: 132.w, + image: AssetImage(image[index])), + ); + }, + ), + ), + ); + } +} diff --git a/lib/features/home/units/homebage/value_container.dart b/lib/features/home/units/homebage/value_container.dart new file mode 100644 index 0000000..9fcc92a --- /dev/null +++ b/lib/features/home/units/homebage/value_container.dart @@ -0,0 +1,71 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import '../../../../core/color_manager/color_manager.dart'; +import '../../../../widgets/widgets/custom_text.dart'; +class ValueContainer extends StatelessWidget { + String? image; + String? title; + String? desc; + + ValueContainer({this.image, this.title, this.desc}); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Container( + width: 1.sw, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12.r), + color: ColorManager.whiteColor), + child: Padding( + padding: const EdgeInsets.only(bottom:8.0), + child: Column( + children: [ + Container( + height: 170.h, + width: 1.sw, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12.r), + image: DecorationImage( + image: AssetImage(image!), + fit: BoxFit.cover)), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Center( + child: Padding( + padding: EdgeInsets.only(top: 11.h), + child: CustomText( + text: title, + fontSize: 16.sp, + color: const Color(0xFF012970), + fontWeight: FontWeight.w700, + ), + )), + ], + ), + Padding( + padding: EdgeInsets.only( + top: 10.h, bottom: 14.h, left: 15.w, right: 15.w), + child: CustomText( + align: TextAlign.center, + color: const Color(0xFF6C6C6C), + text:desc!, + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + ), + ], + ), + ), + ), + SizedBox( + height: 22.h, + ), + ], + ); + } +} diff --git a/lib/features/home/units/homebage/vehicle_container.dart b/lib/features/home/units/homebage/vehicle_container.dart new file mode 100644 index 0000000..2ca47d3 --- /dev/null +++ b/lib/features/home/units/homebage/vehicle_container.dart @@ -0,0 +1,82 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:hoga_load/widgets/widgets/custom_text.dart'; + +import '../../../../core/color_manager/color_manager.dart'; + +class VehicleContainer extends StatelessWidget { + VehicleContainer(this.image,this.text,this.hint,this.more,this.color) ; +var image; +String text; +String hint; +String more; +Color color; + @override + Widget build(BuildContext context) { + return Padding( + padding: + EdgeInsets.only(left: 15.w, right: 15.w, bottom: 22.h, top: 22.h), + child: Container( + height: 268.h, + width: 1.sw, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12.r), + boxShadow: [ + BoxShadow( + offset: const Offset(0, 3), + blurRadius: 0, + color: color.withOpacity(1), + ), + ], + color: ColorManager.whiteColor), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + height: 20.h, + ), + + Image( + height: 80.h, + width: 80.w, + image: AssetImage(image)), + Expanded( + child: CustomText( + text: text, + fontSize: 24.sp, + fontWeight: FontWeight.w700, + color: const Color(0xFF000000), + ), + ), + Expanded( + child: CustomText( + text: hint, + fontSize: 16.sp, + align: TextAlign.center, + fontWeight: FontWeight.w500, + color: const Color(0xFF000000), + ), + ), + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + CustomText( + text: more, + color: color, + fontSize: 16.sp, + fontWeight: FontWeight.w500, + ), + Icon( + Icons.arrow_right_alt, + color: color, + ), + ], + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/features/home/units/homebage/video.dart b/lib/features/home/units/homebage/video.dart new file mode 100644 index 0000000..8813adc --- /dev/null +++ b/lib/features/home/units/homebage/video.dart @@ -0,0 +1,19 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class Video extends StatelessWidget { + const Video({super.key}); + + @override + Widget build(BuildContext context) { + return Container( + height: 216.h, + width: 1.sw, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12.r), + image: const DecorationImage(image: AssetImage('assets/images/Rectangle 6.png'),fit: BoxFit.cover) + ), + ) + ; + } +} diff --git a/lib/features/home/units/homescreen.dart b/lib/features/home/units/homescreen.dart index 3513030..3f00311 100644 --- a/lib/features/home/units/homescreen.dart +++ b/lib/features/home/units/homescreen.dart @@ -1,6 +1,16 @@ import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:hoga_load/features/home/units/homebage/bottom.dart'; +<<<<<<< HEAD +======= +import 'package:hoga_load/features/plans/view.dart'; +>>>>>>> nada import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; + +import '../../about/view.dart'; + +import 'homebage/body.dart'; class HomeScreen extends StatelessWidget { const HomeScreen({Key? key}) : super(key: key); @@ -12,7 +22,26 @@ class HomeScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ CustomAppbar(title: 'Home Screen'), + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + const body(), + SizedBox( + height: 38.h, + ), + const Video(), + const Values(), + const Contact(), + const Bottom(), + +<<<<<<< HEAD +======= +>>>>>>> nada + ], + ), + ), ], ), ), diff --git a/lib/features/home/units/modelList.dart b/lib/features/home/units/modelList.dart new file mode 100644 index 0000000..ca0761b --- /dev/null +++ b/lib/features/home/units/modelList.dart @@ -0,0 +1,37 @@ +import 'package:flutter/material.dart'; + +class ListModel { + String? desc; + var img; + String? name; + String? jop; + ListModel({this.img, this.desc, this.jop, this.name}); +} + +List list = [ + ListModel( + img: 'assets/images/image1.png', + desc: 'Velit aut quia fugit et et. Dolorum ea voluptate vel tempore tenetur ipsa quae aut. Ipsum exercitationem iure minima enim corporis et voluptate.', + jop: 'Chief Executive Officer', + name: 'Walter White', + ), + ListModel( + img: 'assets/images/image2.png', + desc: + 'Quo esse repellendus quia id. Est eum et accusantium pariatur fugit nihil minima suscipit corporis. Voluptate sed quas reiciendis animi neque sapiente.', + jop: 'Product Manager', + name: 'Sarah Jhonson', + ), + ListModel( + img: 'assets/images/image3.png', + desc: 'Vero omnis enim consequatur. Voluptas consectetur unde qui molestiae deserunt. Voluptates enim aut architecto porro aspernatur molestiae modi.', + jop: 'CTO', + name: 'William Anderson', + ), + ListModel( + img: 'assets/images/image4.png', + desc: 'Rerum voluptate non adipisci animi distinctio et deserunt amet voluptas. Quia aut aliquid doloremque ut possimus ipsum officia.', + jop: 'Accountant', + name: 'Amanda Jepson', + ), +]; diff --git a/lib/features/home/units/modelSwiper.dart b/lib/features/home/units/modelSwiper.dart new file mode 100644 index 0000000..36d3e5f --- /dev/null +++ b/lib/features/home/units/modelSwiper.dart @@ -0,0 +1,43 @@ +import 'package:flutter/material.dart'; + +class SwiperModel { + String? text; + var img; + String? nameImage; + String? jop; + SwiperModel({this.img, this.text, this.jop, this.nameImage}); +} + +List swiperList = [ + SwiperModel( + img: 'assets/images/1.jpg', + text: 'Looking Glass (Back-side)', + jop: 'Ceo & Founder ', + nameImage: 'Saul Goodman', + ), + SwiperModel( + img: 'assets/images/3.jpg', + text: + 'Hegaload is very easy to use and to find trucks that can cover loads', + jop: 'Accountant', + nameImage: 'Sara Wilsson', + ), + SwiperModel( + img: 'assets/images/4.jpg', + text: 'I was skeptical in the beginning due to cost but Hegaload is worth EVERY penny.', + jop: 'Store Owner', + nameImage: 'jena Karlis', + ), + SwiperModel( + img: 'assets/images/2.jpg', + text: 'Hegaload is very easy to use and to find trucks that can cover loads', + jop: 'Manager', + nameImage: 'Matt Brandon', + ), + SwiperModel( + img: 'assets/images/5.jpg', + text: 'There’s nothing better for finding a truck for your load!!!!', + jop: 'Entrepreneur', + nameImage: 'John Larson', + ), +]; diff --git a/lib/features/home/units/nav_bar.dart b/lib/features/home/units/nav_bar.dart index d78e1a2..a4239cc 100644 --- a/lib/features/home/units/nav_bar.dart +++ b/lib/features/home/units/nav_bar.dart @@ -11,7 +11,7 @@ class _BottomBar extends StatelessWidget { currentIndex: HomeCubit.get(context).currentIndex, onTap: (i) { - HomeCubit.get(context).changeBottom(i); + HomeCubit.get(context).changeBottom(i,context); }, showUnselectedLabels: true, selectedLabelStyle: TextStyle( diff --git a/lib/features/home/view.dart b/lib/features/home/view.dart index 2d44ab1..caf0cf2 100644 --- a/lib/features/home/view.dart +++ b/lib/features/home/view.dart @@ -1,13 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:hoga_load/core/router/router.dart'; import 'package:hoga_load/features/about/view.dart'; -import 'package:hoga_load/features/add_load/view.dart'; -import 'package:hoga_load/features/add_product/view.dart'; import 'package:hoga_load/features/add_update_card/view.dart'; -import 'package:hoga_load/features/add_vehicle/view.dart'; -import 'package:hoga_load/features/advertisements/view.dart'; import 'package:hoga_load/features/blogs/view.dart'; import 'package:hoga_load/features/change_password/view.dart'; import 'package:hoga_load/features/contactus/view.dart'; @@ -15,15 +10,16 @@ import 'package:hoga_load/features/dashboard/view.dart'; import 'package:hoga_load/features/home/states.dart'; import 'package:hoga_load/features/packages/view.dart'; import 'package:hoga_load/features/subscribtion_details/view.dart'; -import 'package:hoga_load/features/upload_jop/view.dart'; import 'package:hoga_load/features/upload_product/view.dart'; -import 'package:hoga_load/features/upload_vehicles/view.dart'; import 'package:hoga_load/widgets/widgets/custom_rowdrawer.dart'; import '../../widgets/widgets/custom_scaffold.dart'; -import '../add_load/view.dart'; +import '../jobs/upload_jop/view.dart'; +import '../loads/uploaded_loads/view.dart'; +import '../vehicles/upload_vehicles/view.dart'; import 'controller.dart'; -part 'units/nav_bar.dart'; + part 'units/drawer.dart'; +part 'units/nav_bar.dart'; class Home extends StatelessWidget { const Home({Key? key}) : super(key: key); diff --git a/lib/features/jobs/cubit/getJop_cubit.dart b/lib/features/jobs/cubit/getJop_cubit.dart index 2dfa278..34ca397 100644 --- a/lib/features/jobs/cubit/getJop_cubit.dart +++ b/lib/features/jobs/cubit/getJop_cubit.dart @@ -1,11 +1,14 @@ import 'package:bloc/bloc.dart'; import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:hoga_load/core/data/models/GetLoads_model.dart'; -import 'package:hoga_load/core/data/repository/add_vehicle_repo.dart'; +import 'package:hoga_load/core/data/repository/vehicle_repo.dart'; import 'package:hoga_load/features/jobs/cubit/getJop_states.dart'; -import '../../../core/data/models/GetJop_model.dart'; +import '../../../core/data/models/jobs/GetJop_model.dart'; +import '../../../core/data/repository/product_repo.dart'; +import '../../../core/dialoges/toast.dart'; +import '../../../core/master_cubit/getDataForm_cubit.dart'; class JopCubit extends Cubit { JopCubit() : super(AddJopLoading()); @@ -15,6 +18,53 @@ class JopCubit extends Cubit { List searchList = []; List jopList = []; + TextEditingController salaryController=TextEditingController(); + TextEditingController titleController=TextEditingController(); + TextEditingController noOfPostController=TextEditingController(); + TextEditingController shiftController=TextEditingController(); + TextEditingController descController=TextEditingController(); + + List myJopList=[]; + bool isAccessToken=true; + bool testLoading=false; + bool myVehiclesLoading=false; + getJops({self}){ + myVehiclesLoading=true; + + connectivity.checkConnectivity().then((value)async{ + if(ConnectivityResult.none == value){ + emit(NetworkFailed("Check your internet connection and try again")); + }else{ + ProductRepo.getJop('jops',self).then((value) => { + myVehiclesLoading=false, + + print('..................................'), + print(value), + + if(self==1){ + myVehiclesLoading=false, + + myJopList=value, + print('Get My Product Response'), + print(myJopList.length), + + }else + { + + jopList = value, + emit(GetJopSuccess(value)) + } + }).onError((error, stackTrace) => { + myVehiclesLoading=true, + + emit(GetJopFailed(error.toString())), + print(error) + + }); + } + + }); + } getJop() { connectivity.checkConnectivity().then((value) async { @@ -70,4 +120,140 @@ class JopCubit extends Cubit { } }); } + jopClearData(context){ + DataFormCubit.get(context).cityJop=''; + DataFormCubit.get(context).countryJop=''; + DataFormCubit.get(context).countryJop=''; + DataFormCubit.get(context).jopCategory=''; + DataFormCubit.get(context).jopType=''; + DataFormCubit.get(context).salary=''; + DataFormCubit.get(context).noOfPost=''; + DataFormCubit.get(context).shiftTIme=''; + DataFormCubit.get(context).jopTitle=''; + } + addJopCubitTest({context}){ + testLoading=true; + emit(Loading()); + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + showToast(msg: 'Check your internet connection and try again', state: ToastedStates.ERROR); + } else { + VehicleRepo.addJopTest(context: context) + .then((value) => { + testLoading=false, + + }).catchError((error) { + + if(error.toString().contains('Unauthorized Access') || + error.toString().contains('no credit left')){ + testLoading=false; + isAccessToken=false; + emit(AddTestFailed(error.toString())); + print('oooooooooooooooooo'); + + } + testLoading=false; + emit(AddTestFailed(error.toString())); + + print('Add Jop Test Failed'); + + print(error); + + + + }); + } + }); + } + + + addJopCubit({context,GetJopModel? productModel}){ + + + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + showToast(msg: "Check your internet connection and try again", state: ToastedStates.ERROR); + + } else { + emit(AddJopLoading()); + ProductRepo.addJop(context: context,jopModel: productModel) + .then((value) => { + print('Add Jop Success'), + print(value), + emit(AddSuccessJop()), + descController.text='', + noOfPostController.text='', + salaryController.text='', + titleController.text='', + shiftController.text='', + + showToast(msg: 'Add Jop Success', state: ToastedStates.SUCCESS), + + }).catchError((error) { + emit(AddFailed(error)); + if(error.toString().contains('Unauthorized Access') || + error.toString().contains('no credit left')){ + } + + print('Add Jop Failed'); + print(error); + showToast(msg: error.toString(), state: ToastedStates.ERROR); + + }); + } + }); + } + + editJopCubit(GetJopModel? jopModel){ + + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + } else { + ProductRepo.editJop(jopModel) + .then((value) => { + print('Edit Jop Success'), + print(value), + + emit(EditSuccess()), + showToast(msg: 'Edit Success', state: ToastedStates.SUCCESS), + descController.text='', + noOfPostController.text='', + salaryController.text='', + titleController.text='', + shiftController.text='', + }) + .catchError((error, stackTrace) => + {emit(EditFailed()), + print(error), + showToast(msg: error.toString(), state: ToastedStates.ERROR), + print('Edit Jop Failed'), + }); + } + }); + } + deleteJopCubit(jopId){ + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + } else { + ProductRepo.deleteJop(jopId) + .then((value) => { + print('Delete Jop Success'), + print(value), + + emit(DeleteSuccess()), + showToast(msg: 'Delete Success', state: ToastedStates.SUCCESS), + + }).catchError((error, stackTrace) => + {emit(DeleteFailed()), + print(error), + showToast(msg: error.toString(), state: ToastedStates.ERROR), + print('Delete Jop Failed'), + }); + } + }); + } } diff --git a/lib/features/jobs/cubit/getJop_states.dart b/lib/features/jobs/cubit/getJop_states.dart index 99da771..9a22df8 100644 --- a/lib/features/jobs/cubit/getJop_states.dart +++ b/lib/features/jobs/cubit/getJop_states.dart @@ -1,17 +1,22 @@ -import 'package:hoga_load/core/data/models/GetJop_model.dart'; -import 'package:hoga_load/core/data/models/GetLoads_model.dart'; - -import '../../../core/data/models/Addvehicle_model.dart'; -import '../../../core/data/models/vehicles.dart'; +import '../../../core/data/models/jobs/GetJop_model.dart'; abstract class AddJopStates {} class AddJopLoading extends AddJopStates {} -class AddSuccess extends AddJopStates {} +class AddSuccessJop extends AddJopStates {} -class AddFailed extends AddJopStates {} +class AddFailed extends AddJopStates { + String? error; + AddFailed(this.error); +} +class Loading extends AddJopStates{ +} +class AddTestFailed extends AddJopStates{ + String? error; + AddTestFailed(this.error); +} class GetJopSuccess extends AddJopStates { List jopList = []; @@ -32,6 +37,12 @@ class GetSearchFailed extends AddJopStates { final String msg; GetSearchFailed(this.msg); } +class DeleteSuccess extends AddJopStates { +}class DeleteFailed extends AddJopStates { +} +class EditSuccess extends AddJopStates { +}class EditFailed extends AddJopStates { +} class NetworkFailed extends AddJopStates { final String msg; diff --git a/lib/features/jobs/units/body.dart b/lib/features/jobs/units/body.dart index 6a17b52..a8e7faa 100644 --- a/lib/features/jobs/units/body.dart +++ b/lib/features/jobs/units/body.dart @@ -2,10 +2,384 @@ part of '../view.dart'; class Body extends StatelessWidget { Body({Key? key}) : super(key: key); + List titlesList=[ + 'Title', + 'Category', + 'Type', + 'Salary', + 'Vacancy', + 'Location', + 'Shift', + ]; @override Widget build(BuildContext context) { - return BlocConsumer( + return Container( + height: 0.7.sh, + child: Scrollbar( + thickness: 15, + trackVisibility: true, + child: ListView( + physics: const BouncingScrollPhysics(), + shrinkWrap: true, + scrollDirection: Axis.horizontal, + children: [ + Column( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0.w), + child: Container( + height: 43.h, + width: 0.2.sw*7, + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(15), + topRight: Radius.circular(15))), + child: ListView.builder( + scrollDirection: Axis.horizontal, + physics:const NeverScrollableScrollPhysics(), + itemCount: 7, + itemBuilder: (context,index){ + return SizedBox( + width: 0.2.sw, + child: CustomText( + text: titlesList[index], + fontSize: 9.sp, + align: TextAlign.start, + fontWeight: FontWeight.w700, + ), + ); + } + ), + ), + ), + Container( + height: 0.6.sh, + width:0.2.sw*7 , + child: BlocConsumer( + builder: (context,state) { + if( state is GetJopFailed && state is GetSearchFailed ){ + return + Center(child: CustomText(text: state.msg)); + } + else if(state is GetSearchSuccess){ + return ListView.builder( + physics: const NeverScrollableScrollPhysics(), + itemCount: state.jopList.length, + itemBuilder: (context, index) { + + + print('jjjjjjjjjjj'); + + return + Container( + color: index.isEven ? Colors.grey[300] : Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 5), + child: InkWell( + onTap: () { + MagicRouter.navigateTo( + Detail(state.jopList[index])); + }, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CustomText( + width: 0.2.sw, + text: state.jopList[index].title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + CustomText( +// height: 20.h,o + width: 0.2.sw, + text: state.jopList[index].category==null?'other': + state.jopList[index].category!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + + CustomText( +// height: 20.h, + width: 0.2.sw, + text: state.jopList[index].jobType==null?'other': + state.jopList[index].jobType!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width:0.2.sw , + text: state.jopList[index].salary==null?'other': + state.jopList[index].salary!, + + fontSize: 8.sp, + align: TextAlign.start, + fontWeight: FontWeight.w500), + + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state.jopList[index].noOfPosts ==null?'other': + state.jopList[index].noOfPosts!.toString(), + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 30.h, + width: 0.2.sw, + text: state.jopList[index].state == + null + ? 'other' + : state.jopList[index].state!.title + .toString(), + align: TextAlign.end, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state.jopList[index].shiftTime == null + ? 'other' + : state + .jopList[index].shiftTime!, + + align: TextAlign.end, + color: + Colors.green , + fontSize: 8.sp, + fontWeight: FontWeight.w500), + ], + ), + ), + ), + ); + + } + ); + + } + else if(state is GetJopSuccess){ + return ListView.builder( + physics: const NeverScrollableScrollPhysics(), + itemCount: state.jopList.length, + itemBuilder: (context, index) { + + + print('llllllll'); + + return + Container( + color: index.isEven ? Colors.grey[300] : Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 5), + child: InkWell( + onTap: () { + MagicRouter.navigateTo( + Detail(state.jopList[index])); + }, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CustomText( + width: 0.2.sw, + text: state.jopList[index].title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + CustomText( +// height: 20.h,o + width: 0.2.sw, + text: state.jopList[index].category==null?'other': + state.jopList[index].category!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + + CustomText( +// height: 20.h, + width: 0.2.sw, + text: state.jopList[index].jobType==null?'other': + state.jopList[index].jobType!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width:0.2.sw , + text: state.jopList[index].salary==null?'other': + state.jopList[index].salary!, + + fontSize: 8.sp, + align: TextAlign.start, + fontWeight: FontWeight.w500), + + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state.jopList[index].noOfPosts ==null?'other': + state.jopList[index].noOfPosts!.toString(), + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 30.h, + width: 0.2.sw, + text: state.jopList[index].state == + null + ? 'other' + : state.jopList[index].state!.title + .toString(), + align: TextAlign.end, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state.jopList[index].shiftTime == null + ? 'other' + : state + .jopList[index].shiftTime!, + + align: TextAlign.end, + color: + Colors.green , + fontSize: 8.sp, + fontWeight: FontWeight.w500), + ], + ), + ), + ), + ); + + } + ); + + } + else if(state is AddJopLoading){ + return Column( + children: const [ + Center( + child:CircularProgressIndicator(color: Colors.orange,), + ) + ], + ); + + } + else { + return ListView.builder( + physics: const NeverScrollableScrollPhysics(), + itemCount: JopCubit.get(context).jopList.length, + itemBuilder: (context, index) { + + + print('llllllll'); + + return + Container( + color: index.isEven ? Colors.grey[300] : Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 5), + child: InkWell( + onTap: () { + MagicRouter.navigateTo( + Detail(JopCubit.get(context).jopList[index])); + }, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CustomText( + width: 0.2.sw, + text: JopCubit.get(context).jopList[index].title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + + CustomText( +// height: 20.h,o + width: 0.2.sw, + text: JopCubit.get(context).jopList[index].category==null?'other': + JopCubit.get(context).jopList[index].category!.title, + // text: '', + + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + + CustomText( +// height: 20.h, + width: 0.2.sw, + text: JopCubit.get(context).jopList[index].jobType==null?'other': + JopCubit.get(context).jopList[index].jobType!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + + CustomText( + width:0.2.sw , + text: JopCubit.get(context).jopList[index].salary==null?'other': + JopCubit.get(context).jopList[index].salary!, + + fontSize: 8.sp, + align: TextAlign.start, + fontWeight: FontWeight.w500), + + CustomText( + width: 0.2.sw, +// height: 20.h, + text: JopCubit.get(context).jopList[index].noOfPosts ==null?'other': + JopCubit.get(context).jopList[index].noOfPosts!.toString(), + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + + CustomText( +// height: 30.h, + width: 0.2.sw, + text: JopCubit.get(context).jopList[index].state ==null?'other': + JopCubit.get(context).jopList[index].state!.toString(), + align: TextAlign.end, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: JopCubit.get(context).jopList[index].shiftTime ==null?'other': + JopCubit.get(context).jopList[index].shiftTime!.toString(), + + align: TextAlign.end, + color: + Colors.green , + fontSize: 8.sp, + fontWeight: FontWeight.w500), + ], + ), + ), + ), + ); + + } + ); + } + }, listener: (BuildContext context, Object? state) { }, + ), + ) + + ], + ), + + + ], + ), + ), + ); + } +} +/* + +BlocConsumer( listener: (context, state) {}, builder: (context, state) { if (state is GetSearchFailed) { @@ -238,5 +612,5 @@ class Body extends StatelessWidget { ); } }); - } -} + + */ \ No newline at end of file diff --git a/lib/features/jobs/units/details.dart b/lib/features/jobs/units/details.dart new file mode 100644 index 0000000..3ee4af9 --- /dev/null +++ b/lib/features/jobs/units/details.dart @@ -0,0 +1,38 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import '../../../core/data/models/jobs/GetJop_model.dart'; +import '../../../core/data/models/loads/GetLoads_model.dart'; +import '../../../core/data/models/vehicle/vehicles.dart'; +import '../../../widgets/widgets/custom_appbar.dart'; +import '../../../widgets/widgets/custom_container_jop_detail.dart'; +import '../../../widgets/widgets/custom_container_load_detail.dart'; +import '../../../widgets/widgets/custom_scaffold.dart'; +class Detail extends StatefulWidget { + Detail(this.jop, {super.key}) ; + GetJopModel? jop; + + @override + State createState() => _DetailState(); +} + +class _DetailState extends State { + @override + Widget build(BuildContext context) { + return CustomScaffold( + body: + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + CustomAppbar(title: 'View Jop'), + Expanded(child: Column( + children: [ + Expanded(child: CustomContainerJop(widget.jop!)), + ], + )), + SizedBox(height: 22.h,) + ], + ), + ); + } +} diff --git a/lib/features/jobs/upload_jop/add_view.dart b/lib/features/jobs/upload_jop/add_view.dart new file mode 100644 index 0000000..f3e3006 --- /dev/null +++ b/lib/features/jobs/upload_jop/add_view.dart @@ -0,0 +1,61 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:hoga_load/core/color_manager/color_manager.dart'; +import 'package:hoga_load/core/data/models/jobs/GetJop_model.dart'; +import 'package:hoga_load/core/data/models/product/GetProduct_model.dart'; +import 'package:hoga_load/features/jobs/cubit/getJop_states.dart'; +import 'package:hoga_load/features/search_product/cubit/getProduct__states.dart'; +import 'package:hoga_load/features/search_product/cubit/getProduct_cubit.dart'; +import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; +import 'package:hoga_load/widgets/widgets/custom_button.dart'; +import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; +import 'package:hoga_load/widgets/widgets/custom_text.dart'; +import 'package:hoga_load/widgets/widgets/custom_text_field.dart'; + +import '../../../core/master_cubit/getDataForm_cubit.dart'; +import '../../../core/master_cubit/getDataForm_state.dart'; +import '../../../core/widgets/custom_card.dart'; +import '../cubit/getJop_cubit.dart'; + +part 'units/add_jop_form.dart'; + +class AddJopView extends StatelessWidget { + AddJopView( + {Key? key, + this.productModel, + this.isEdit = false, + this.index, + this.isFilter = false}) + : super(key: key); + GetJopModel? productModel; + bool isEdit; + bool isFilter; + + int? index; + @override + Widget build(BuildContext context) { + return CustomScaffold( + body: SafeArea( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + CustomAppbar( + title: isEdit + ? 'Edit Jop' + : isFilter + ? 'Search Jop' + : 'Add Jop'), + const Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Padding( + padding: EdgeInsets.only(top: 22.0), + child: FormInfo(), + ))), + ], + ), + ), + ); + } +} diff --git a/lib/features/jobs/upload_jop/units/add_jop_form.dart b/lib/features/jobs/upload_jop/units/add_jop_form.dart new file mode 100644 index 0000000..f72b631 --- /dev/null +++ b/lib/features/jobs/upload_jop/units/add_jop_form.dart @@ -0,0 +1,495 @@ +part of '../add_view.dart'; + +class FormInfo extends StatefulWidget { + const FormInfo({Key? key}) : super(key: key); + + @override + State createState() => _FormInfoState(); +} + +class _FormInfoState extends State { + String country = ''; + String state = ''; + String city = ''; + String? jopCategory = ''; + String? jopTitle=''; + String? jopType=''; + + int? jopCategoryId; + + int? jopTypeId1; + int? countryId; + int? stateId; + int? cityId; + int? jopId; + + @override + Widget build(BuildContext context) { + return CustomCard( + widget: BlocConsumer( + listener: (BuildContext context, state) {}, + builder: (BuildContext context, s) { + return Column( + children: [ + Padding( + padding: EdgeInsets.symmetric(vertical: 16.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + const Icon( + Icons.arrow_back_sharp, + ), + Expanded( + child: CustomText( + text: 'ADD JOP', + fontSize: 18.sp, + fontWeight: FontWeight.w700, + ), + ) + ], + ), + ), + SizedBox( + width: 1.sw, + child: const Divider( + thickness: 1, + ), + ), + CustomTextField( + height: 64.h, + readOnly: false, + lines: 1, + name: 'Jop Title', + hintText: jopTitle == '' ? 'Enter jop title' : jopTitle, + controller: JopCubit.get(context).titleController, + ), + + CustomTextField( + height: 64.h, + readOnly: true, + name: 'Country', + hintText: country == '' ? '--SELECT A COUNTRY--' : country, + suffixIcon: InkWell( + onTap: () { + showModalBottomSheet( + context: context, + builder: (context) { + return ListView.builder( + itemCount: DataFormCubit.get(context) + .countryList + .length, + itemBuilder: (context, index) => Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + InkWell( + onTap: () { + setState(() { + countryId = + DataFormCubit.get(context) + .countryList[index] + .id!; + country = + DataFormCubit.get(context) + .countryList[index] + .title!; + Navigator.of(context).pop(); + city = ''; + state = ''; + }); + DataFormCubit.get(context).getState( + DataFormCubit.get(context) + .countryList[index] + .id!); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: DataFormCubit.get(context) + .countryList[index] + .title == + null + ? const Center( + child: + CircularProgressIndicator( + color: Colors.green, + ), + ) + : Text( + DataFormCubit.get(context) + .countryList[index] + .title!, + style: TextStyle( + color: Colors.black, + fontSize: 20.sp), + ), + ), + ), + ], + )); + }, + ); + }, + child: Icon( + Icons.expand_more, + size: 30.sp, + color: ColorManager.blackColor, + ), + )), + s is GetStateLoading + ? CustomText( + text: 'Loading....', + ) + : CustomTextField( + height: 64.h, + readOnly: true, + name: 'state', + hintText: state == '' ? '--SELECT A STATE--' : state, + suffixIcon: InkWell( + onTap: () { + showModalBottomSheet( + context: context, + builder: (context) { + return ListView.builder( + itemCount: DataFormCubit.get(context) + .stateList + .length, + itemBuilder: (context, index) => Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + InkWell( + onTap: () { + setState(() { + stateId = + DataFormCubit.get(context) + .stateList[index] + .id!; + state = + DataFormCubit.get(context) + .stateList[index] + .title!; + Navigator.of(context).pop(); + city = ''; + }); + DataFormCubit.get(context) + .getCity(DataFormCubit.get( + context) + .stateList[index] + .title!); + }, + child: Padding( + padding: + const EdgeInsets.all(8.0), + child: DataFormCubit.get( + context) + .stateList[index] + .title == + null + ? const Center( + child: + CircularProgressIndicator( + color: Colors.green, + ), + ) + : Text( + DataFormCubit.get( + context) + .stateList[index] + .title!, + style: TextStyle( + color: Colors.black, + fontSize: 20.sp), + ), + ), + ), + ], + )); + }, + ); + }, + child: Icon( + Icons.expand_more, + size: 30.sp, + color: ColorManager.blackColor, + ), + )), + s is GetCityLoading + ? CustomText( + text: 'Loading....', + ) + : CustomTextField( + height: 64.h, + readOnly: true, + name: 'City', + hintText: city == '' ? '--SELECT A CITY--' : city, + suffixIcon: InkWell( + onTap: () { + showModalBottomSheet( + context: context, + builder: (context) { + return ListView.builder( + itemCount: DataFormCubit.get(context).cityList.length, + itemBuilder: (context, index) => Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + InkWell( + onTap: () { + setState(() { + cityId= DataFormCubit.get(context) + .cityList[index] + .id!; + city = DataFormCubit.get(context) + .cityList[index] + .title!; + Navigator.of(context).pop(); + }); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: DataFormCubit.get(context) + .cityList[index] + .title == + null + ? const Center( + child: CircularProgressIndicator( + color: Colors.green, + ), + ) + : Text( + DataFormCubit.get(context) + .cityList[index] + .title!, + style: TextStyle( + color: Colors.black, + fontSize: 20.sp), + ), + ), + ), + ], + )); + }, + ); + }, + child: Icon( + Icons.expand_more, + size: 30.sp, + color: ColorManager.blackColor, + ), + )), + + SizedBox( + width: 322.w, + child: const Divider( + thickness: 1, + ), + ), + + CustomTextField( + height: 64.h, + readOnly: true, + name: 'Jop Category', + hintText: jopCategory == '' + ? '--SELECT A JOP CATEGORY--' + : jopCategory, + suffixIcon: InkWell( + onTap: () { + showModalBottomSheet( + context: context, + builder: (context) { + return ListView.builder( + itemCount: DataFormCubit.get(context) + .jopCategoryList + .length, + itemBuilder: (context, index) => Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + InkWell( + onTap: () { + setState(() { + jopCategoryId = + DataFormCubit.get(context) + .jopCategoryList[index] + .id!; + jopCategory = + DataFormCubit.get(context) + .jopCategoryList[index] + .title!; + Navigator.of(context).pop(); + }); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: DataFormCubit.get(context) + .jopCategoryList[index] + .title == + null + ? const Center( + child: + CircularProgressIndicator( + color: Colors.green, + ), + ) + : Text( + DataFormCubit.get(context) + .jopCategoryList[index] + .title!, + style: TextStyle( + color: Colors.black, + fontSize: 20.sp), + ), + ), + ), + ], + )); + }, + ); + }, + child: Icon( + Icons.expand_more, + size: 30.sp, + color: ColorManager.blackColor, + ), + )), + CustomTextField( + height: 64.h, + readOnly: true, + name: 'Jop Type', + hintText: jopType == '' + ? '--SELECT A JOP Type--' + : jopType, + suffixIcon: InkWell( + onTap: () { + showModalBottomSheet( + context: context, + builder: (context) { + return ListView.builder( + itemCount: DataFormCubit.get(context) + .jopTypeList + .length, + itemBuilder: (context, index) => Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + InkWell( + onTap: () { + setState(() { + jopTypeId1 = + DataFormCubit.get(context) + .jopTypeList[index] + .id!; + jopType = + DataFormCubit.get(context) + .jopTypeList[index] + .title!; + Navigator.of(context).pop(); + }); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: DataFormCubit.get(context) + .jopTypeList[index] + .title == + null + ? const Center( + child: + CircularProgressIndicator( + color: Colors.green, + ), + ) + : Text( + DataFormCubit.get(context) + .jopTypeList[index] + .title!, + style: TextStyle( + color: Colors.black, + fontSize: 20.sp), + ), + ), + ), + ], + )); + }, + ); + }, + child: Icon( + Icons.expand_more, + size: 30.sp, + color: ColorManager.blackColor, + ), + )), + + CustomTextField( + height: 64.h, + hintText: 'Enter Financial Package to Offer', + name: 'Salary', + // keyboardType: TextInputType.number, + controller: JopCubit.get(context).salaryController, + ), + CustomTextField( + height: 64.h, + hintText: 'Enter Number of candidate you are hiring', + name: 'Number of Available Posts', + keyboardType: TextInputType.number, + controller: JopCubit.get(context).noOfPostController, + ), + CustomTextField( + height: 64.h, + hintText: 'Enter details about shifts and timings', + name: 'Shift Time', + // keyboardType: TextInputType.number, + controller: JopCubit.get(context).shiftController, + ), + SizedBox( + width: 322.w, + child: const Divider( + thickness: 1, + ), + ), + CustomTextField( + height: 147.h, + lines: 6, + controller: JopCubit.get(context).descController, + hintText: 'Description', + ), + if(s is AddJopLoading) + Padding( + padding: EdgeInsets.only(top: 50.sp, bottom: 15.sp), + child:const Center(child: CircularProgressIndicator()), + ), + + BlocListener( + listener: (BuildContext context, state) { + if (state is AddSuccessJop) { + Navigator.pop(context); + } + }, + child: Padding( + padding: EdgeInsets.only(top: 50.sp, bottom: 15.sp), + child: CustomButton( + text: 'Add new Jop', + color: ColorManager.yellow, + function: () { + JopCubit.get(context).addJopCubit( + context: context, + productModel: GetJopModel( + jopCategortId:jopCategoryId , + jopTypeId:jopTypeId1 , + title: JopCubit.get(context).titleController.text, + salaryInt: int.parse(JopCubit.get(context).salaryController.text), + noOfPosts: int.parse(JopCubit.get(context).noOfPostController.text), + shiftTime: JopCubit.get(context).shiftController.text, + country2: countryId, + state2: stateId, + city2: cityId, + description: JopCubit.get(context).descController.text,)); + }, + ), + ), + ), + ], + ); + }), + ); + } +} diff --git a/lib/features/advertisements/units/button.dart b/lib/features/jobs/upload_jop/units/button.dart similarity index 50% rename from lib/features/advertisements/units/button.dart rename to lib/features/jobs/upload_jop/units/button.dart index da7dfab..e224c70 100644 --- a/lib/features/advertisements/units/button.dart +++ b/lib/features/jobs/upload_jop/units/button.dart @@ -6,11 +6,17 @@ class Button extends StatelessWidget { @override Widget build(BuildContext context) { return Padding( - padding: EdgeInsets.only(bottom: 27.h), + padding: EdgeInsets.only(bottom: 27.h), child: Align( alignment: Alignment.bottomCenter, - child: CustomButton(text: 'Add',icon: Icons.add, color: ColorManager.orange, + child: CustomButton( + text: '+ Add', + icon: Icons.add, + color: ColorManager.yellow, + function: () { + MagicRouter.navigateTo( AddJopView()); + }, ), ), ); diff --git a/lib/features/jobs/upload_jop/units/table_data.dart b/lib/features/jobs/upload_jop/units/table_data.dart new file mode 100644 index 0000000..6f69b93 --- /dev/null +++ b/lib/features/jobs/upload_jop/units/table_data.dart @@ -0,0 +1,118 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:hoga_load/features/jobs/upload_jop/units/table_jop_title.dart'; +import 'package:hoga_load/features/search_product/cubit/getProduct_cubit.dart'; +import 'package:hoga_load/features/upload_product/add_view.dart'; +import '../../../../core/color_manager/color_manager.dart'; +import '../../../../core/dialoges/delete_dialoge.dart'; +import '../../../../core/router/router.dart'; +import '../../../../widgets/widgets/custom_text.dart'; +import '../../cubit/getJop_cubit.dart'; +import '../add_view.dart'; + +class MyJopTable extends StatelessWidget { + const MyJopTable({super.key}); + + @override + Widget build(BuildContext context) { + return uploadedTableJop( + child: ListView.builder( + itemCount: JopCubit.get(context).myJopList.length, + + itemBuilder: (context, index) { + return Container( + color: index.isEven ? Colors.grey[300] : Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 5), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: 1, + child: CustomText( + text:'${index+1}', + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + ), + Expanded( + flex: 2, + child: CustomText( + text: JopCubit.get(context).myJopList[index].category!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + ), + Expanded( + flex:2, + child: CustomText( + text:( '${JopCubit.get(context).myJopList[index].state!.title}→ ${JopCubit.get(context).myJopList[index].city!.title}'), + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + ), + Expanded( + flex:2, + child: CustomText( + text:( '${JopCubit.get(context).myJopList[index].category!.title}${JopCubit.get(context).myJopList[index].jobType!.title}'), + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + ), + Expanded( + flex:2, + child: Row( + children: [ + InkWell( + onTap:(){ + showDialog(context: context, builder:(context)=> DeleteEditDialog(function: (){ + Navigator.pop(context); + MagicRouter.navigateTo( AddJopView(isEdit: true,productModel: + JopCubit.get(context).myJopList[index],index:index)); + },btnText: 'Edit',)); + + }, + child: CustomText( + text: 'Edit', + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w200, + color: ColorManager.primaryColor, + ), + ), + SizedBox(width: 5.sp,), + InkWell( + onTap:(){ + showDialog(context: context, builder:(context)=> DeleteEditDialog(function: (){ + + JopCubit.get(context).deleteJopCubit(JopCubit.get(context).myJopList[index].id); + + },btnText: 'Delete',)); + }, + child: CustomText( + text: 'Delete', + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w200, + color: Colors.red, + ), + ), + + ], + ), + ), + + ], + ), + ), + ); + } + ) + + ); + } +} \ No newline at end of file diff --git a/lib/features/jobs/upload_jop/units/table_jop_title.dart b/lib/features/jobs/upload_jop/units/table_jop_title.dart new file mode 100644 index 0000000..7fc6501 --- /dev/null +++ b/lib/features/jobs/upload_jop/units/table_jop_title.dart @@ -0,0 +1,84 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import '../../../../widgets/widgets/custom_text.dart'; +class uploadedTableJop extends StatelessWidget { + uploadedTableJop({super.key, required this.child}); + Widget child; + + @override + Widget build(BuildContext context) { + return Expanded( + child: ListView( + children: [ + SizedBox( + height: 0.7.sh, + + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0.w), + child: Container( + height: 43.h, + width: 1.sw, + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(15), + topRight: Radius.circular(15))), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex:1, + child: CustomText( + text: "#", + fontSize: 9.sp, + align: TextAlign.start, + fontWeight: FontWeight.w700, + ), + ), + Expanded( + flex:2, + child: CustomText( + text: "Job Title", + fontSize: 9.sp, + align: TextAlign.start, + fontWeight: FontWeight.w700, + ), + ), + Expanded( + flex:2, + child: CustomText( + text: "Other Details", + fontSize: 9.sp, + align: TextAlign.start, + fontWeight: FontWeight.w700, + ), + ), + Expanded( + flex:2, + child: CustomText( + text: "View(s)", + fontSize: 9.sp, + align: TextAlign.start, + fontWeight: FontWeight.w700, + ), + ), + + ], + ) + + ), + ), + Expanded(child: child) + + ], + ), + + ), + ]), + ); + } +} \ No newline at end of file diff --git a/lib/features/jobs/upload_jop/units/uploaded.dart b/lib/features/jobs/upload_jop/units/uploaded.dart new file mode 100644 index 0000000..bd09dce --- /dev/null +++ b/lib/features/jobs/upload_jop/units/uploaded.dart @@ -0,0 +1,35 @@ +part of '../view.dart'; + +class Uploaded extends StatelessWidget { + const Uploaded({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return CustomCard( + widget: Padding( + padding: EdgeInsets.symmetric(horizontal: 11.sp), + child:Column( + children: [ + SizedBox( + height: 18.h, + ), + CustomCardTitle( + text: 'UPLOADED JOP', + ), + + JopCubit.get(context).jopList.isEmpty + ? Expanded( + child: Column( + children: [ + CustomNoContainer(text: 'jop'), + ], + ), + ) + : const MyJopTable(), + Button() + ], + ), + ), + ); + } +} diff --git a/lib/features/upload_jop/view.dart b/lib/features/jobs/upload_jop/view.dart similarity index 56% rename from lib/features/upload_jop/view.dart rename to lib/features/jobs/upload_jop/view.dart index 60d3011..52ebf74 100644 --- a/lib/features/upload_jop/view.dart +++ b/lib/features/jobs/upload_jop/view.dart @@ -1,14 +1,23 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:hoga_load/core/color_manager/color_manager.dart'; +import 'package:hoga_load/core/router/router.dart'; +import 'package:hoga_load/features/jobs/upload_jop/units/table_data.dart'; +import 'package:hoga_load/features/upload_product/add_view.dart'; import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; import 'package:hoga_load/widgets/widgets/custom_button.dart'; import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; -import '../../core/widgets/custom_card.dart'; -import '../../core/widgets/custom_card_title.dart'; -import '../../core/widgets/custom_no_container.dart'; -part 'units/uploaded.dart'; + +import '../../../core/widgets/custom_card.dart'; +import '../../../core/widgets/custom_card_title.dart'; +import '../../../core/widgets/custom_no_container.dart'; +import '../../loads/uploaded_loads/view.dart'; +import '../cubit/getJop_cubit.dart'; +import 'add_view.dart'; + part 'units/button.dart'; +part 'units/uploaded.dart'; + class UploadJobsView extends StatelessWidget { const UploadJobsView({Key? key}) : super(key: key); @@ -18,8 +27,8 @@ class UploadJobsView extends StatelessWidget { body: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - CustomAppbar(title: 'Uploconst aded Jobs'), - const Expanded(child: Uploaded()), + CustomAppbar(title: 'Up loaded Jobs'), + const Expanded(child: Uploaded()), ], ), ); diff --git a/lib/features/jobs/view.dart b/lib/features/jobs/view.dart index 885e586..94caa4c 100644 --- a/lib/features/jobs/view.dart +++ b/lib/features/jobs/view.dart @@ -4,12 +4,13 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:hoga_load/features/jobs/cubit/getJop_cubit.dart'; import 'package:hoga_load/features/jobs/cubit/getJop_states.dart'; +import 'package:hoga_load/features/jobs/units/details.dart'; import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; import 'package:hoga_load/widgets/widgets/custom_row.dart'; import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; import 'package:hoga_load/widgets/widgets/custom_text.dart'; -import '../add_vehicle/cubit/getVehicle_cubit.dart'; +import '../../core/router/router.dart'; part 'units/body.dart'; class JobsView extends StatelessWidget { diff --git a/lib/features/add_load/view.dart b/lib/features/loads/add_load/add_load_view.dart similarity index 83% rename from lib/features/add_load/view.dart rename to lib/features/loads/add_load/add_load_view.dart index 060dd9f..3ba96a3 100644 --- a/lib/features/add_load/view.dart +++ b/lib/features/loads/add_load/add_load_view.dart @@ -2,21 +2,26 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:hoga_load/core/color_manager/color_manager.dart'; import 'package:hoga_load/core/widgets/custom_card.dart'; +import 'package:hoga_load/features/loads/cubit/getLoad_cubit.dart'; +import 'package:hoga_load/features/vehicles/add_vehicle/view.dart'; import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; import 'package:hoga_load/widgets/widgets/custom_button.dart'; import 'package:hoga_load/widgets/widgets/custom_checkbox.dart'; import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; import 'package:hoga_load/widgets/widgets/custom_text.dart'; import 'package:hoga_load/widgets/widgets/custom_text_field.dart'; -import '../add_vehicle/cubit/getDataForm_cubit.dart'; -import '../add_vehicle/cubit/getVehicle_cubit.dart'; -part 'units/form.dart'; -part 'units/equipment.dart'; -part 'units/attributes.dart'; -part 'units/vehicles_size.dart'; -part 'units/vehicle_type.dart'; -part 'units/instructon.dart'; +import '../../../core/data/models/loads/GetLoads_model.dart'; +import '../../../core/master_cubit/getDataForm_cubit.dart'; +import '../../vehicles/get_vehicles/cubit/vehicle_cubit.dart'; + + +part '../add_load/units/attributes.dart'; +part '../add_load/units/equipment.dart'; +part '../add_load/units/form.dart'; +part '../add_load/units/instructon.dart'; +part '../add_load/units/vehicle_type.dart'; +part '../add_load/units/vehicles_size.dart'; class AddLoadsView extends StatelessWidget { const AddLoadsView({Key? key}) : super(key: key); @@ -40,7 +45,7 @@ class AddLoadsView extends StatelessWidget { physics: const BouncingScrollPhysics(), child: Padding( padding: const EdgeInsets.only(top: 22), - child: Form(), + child: FormInfo() )), SingleChildScrollView( physics: const BouncingScrollPhysics(), diff --git a/lib/features/add_load/units/attributes.dart b/lib/features/loads/add_load/units/attributes.dart similarity index 97% rename from lib/features/add_load/units/attributes.dart rename to lib/features/loads/add_load/units/attributes.dart index 4a8ec03..bf27a73 100644 --- a/lib/features/add_load/units/attributes.dart +++ b/lib/features/loads/add_load/units/attributes.dart @@ -1,4 +1,4 @@ -part of '../view.dart'; +part of '../add_load_view.dart'; class Attributes extends StatelessWidget { bool value2=false; diff --git a/lib/features/add_vehicle/units/equipment.dart b/lib/features/loads/add_load/units/equipment.dart similarity index 96% rename from lib/features/add_vehicle/units/equipment.dart rename to lib/features/loads/add_load/units/equipment.dart index ac0a0b5..44dd964 100644 --- a/lib/features/add_vehicle/units/equipment.dart +++ b/lib/features/loads/add_load/units/equipment.dart @@ -1,5 +1,4 @@ -part of '../view.dart'; - +part of '../add_load_view.dart'; class Equipment extends StatelessWidget { var value=false; diff --git a/lib/features/add_load/units/form.dart b/lib/features/loads/add_load/units/form.dart similarity index 98% rename from lib/features/add_load/units/form.dart rename to lib/features/loads/add_load/units/form.dart index 7d063f4..c52ac2b 100644 --- a/lib/features/add_load/units/form.dart +++ b/lib/features/loads/add_load/units/form.dart @@ -1,13 +1,17 @@ -part of '../view.dart'; +part of '../add_load_view.dart'; -class Form extends StatefulWidget { - const Form({Key? key}) : super(key: key); +class FormInfo extends StatefulWidget { + FormInfo({Key? key,this.isFilter=false,this.loadsModel,this.isEdit=false,this.index}) : super(key: key); + bool isFilter; + GetLoadsModel? loadsModel; + bool isEdit; + int? index; @override - State createState() => _FormState(); + State createState() => _FormInfoState(); } -class _FormState extends State { +class _FormInfoState extends State { var countryOrigin = ''; var stateOrigin = ''; diff --git a/lib/features/add_vehicle/units/instructon.dart b/lib/features/loads/add_load/units/instructon.dart similarity index 73% rename from lib/features/add_vehicle/units/instructon.dart rename to lib/features/loads/add_load/units/instructon.dart index a2f5843..0149c44 100644 --- a/lib/features/add_vehicle/units/instructon.dart +++ b/lib/features/loads/add_load/units/instructon.dart @@ -1,4 +1,4 @@ -part of '../view.dart'; +part of '../add_load_view.dart'; class Instructions extends StatelessWidget { const Instructions({super.key}); @@ -12,6 +12,8 @@ class Instructions extends StatelessWidget { CustomTextField( height: 64.h, hintText: 'Weight ( in Kilogram )', + controller: LoadsCubit.get(context).weightController, + suffixIcon: Icon( Icons.expand_more, size: 30.sp, @@ -22,11 +24,12 @@ class Instructions extends StatelessWidget { height: 147.h, lines: 4, hintText: 'Instructions', + controller: LoadsCubit.get(context).instructionsController, ), SizedBox( height: 23.h, ), - CustomButton(text: 'Add new vehicle', color: ColorManager.orange), ], + CustomButton(text: 'Add new load', color: ColorManager.yellow), ], ); } } diff --git a/lib/features/add_load/units/vehicle_type.dart b/lib/features/loads/add_load/units/vehicle_type.dart similarity index 96% rename from lib/features/add_load/units/vehicle_type.dart rename to lib/features/loads/add_load/units/vehicle_type.dart index 04a3fcb..06d0d52 100644 --- a/lib/features/add_load/units/vehicle_type.dart +++ b/lib/features/loads/add_load/units/vehicle_type.dart @@ -1,5 +1,5 @@ -part of '../view.dart'; +part of '../add_load_view.dart'; class VehicleType extends StatelessWidget { bool value3=false; diff --git a/lib/features/add_load/units/vehicles_size.dart b/lib/features/loads/add_load/units/vehicles_size.dart similarity index 97% rename from lib/features/add_load/units/vehicles_size.dart rename to lib/features/loads/add_load/units/vehicles_size.dart index ccf760a..b1207b4 100644 --- a/lib/features/add_load/units/vehicles_size.dart +++ b/lib/features/loads/add_load/units/vehicles_size.dart @@ -1,4 +1,4 @@ -part of '../view.dart'; +part of '../add_load_view.dart'; class VehiclesSize extends StatelessWidget { bool value4 = false; diff --git a/lib/features/loads/cubit/getLoad_cubit.dart b/lib/features/loads/cubit/getLoad_cubit.dart index f345db6..3a97f24 100644 --- a/lib/features/loads/cubit/getLoad_cubit.dart +++ b/lib/features/loads/cubit/getLoad_cubit.dart @@ -1,27 +1,40 @@ import 'package:bloc/bloc.dart'; import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:hoga_load/core/data/models/GetLoads_model.dart'; -import 'package:hoga_load/core/data/repository/add_vehicle_repo.dart'; - +import 'package:hoga_load/core/data/repository/vehicle_repo.dart'; +import 'package:hoga_load/features/vehicles/get_vehicles/cubit/vehicle_cubit.dart'; +import '../../../core/data/models/loads/GetLoads_model.dart'; +import '../../../core/data/repository/load_repo.dart'; +import '../../../core/dialoges/toast.dart'; import 'getLoad_states.dart'; class LoadsCubit extends Cubit { LoadsCubit() : super(AddLoadLoading()); - + TextEditingController weightController=TextEditingController(); + TextEditingController instructionsController=TextEditingController(); static LoadsCubit get(context) => BlocProvider.of(context); Connectivity connectivity = Connectivity(); List searchList=[]; List loadList=[]; + ListmyVehicleList=[]; - getLoad(){ + List equipmentType=[]; + List attributes=[]; + List vehcleType=[]; + List vehcleSize=[]; + + bool isAccessToken=true; + bool testLoading=true; + bool myVehiclesLoading=true; + getLoad({self}){ connectivity.checkConnectivity().then((value)async{ if(ConnectivityResult.none == value){ emit(NetworkFailed("Check your internet connection and try again")); }else{ - VehicleRepo.getLoads('loads').then((value) => { + LoadsRepo.getLoads(self).then((value) => { print('..................................'), print(value), loadList=value, @@ -36,48 +49,160 @@ class LoadsCubit extends Cubit { }); } - searchLoads(val,context) { - searchList.clear(); - LoadsCubit.get(context).loadList.forEach((i) { + deleteLoadsCubit(vehicleId){ + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + } else { + VehicleRepo.deleteVehicle(vehicleId) + .then((value) => { + print('Delete Vehicle Success'), + print(value), + + emit(DeleteSuccess()), + showToast(msg: 'Delete Success', state: ToastedStates.SUCCESS), + + }) + .onError((error, stackTrace) => + {emit(DeleteFailed()), + print(error), + showToast(msg: error.toString(), state: ToastedStates.ERROR), + print('Delete Vehicle Failed'), + }); + } + }); + } + editLoadsCubit({context,vehicleId}){ + + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + } else { + VehicleRepo.editVehicle(context: context,vehicleId:vehicleId) + .then((value) => { + print('Edit Vehicle Success'), + print(value), - if(i.availabilityDate!.toLowerCase().contains(val)||i.availabilityDate!.contains(val)){ - searchList.add(i); + emit(EditSuccess()), + showToast(msg: 'Edit Success', state: ToastedStates.SUCCESS), + + }) + .catchError((error, stackTrace) => + {emit(EditFailed()), + print(error), + showToast(msg: error.toString(), state: ToastedStates.ERROR), + print('Edit Vehicle Failed'), + }); } - else if(i.originCountry!.title!.toString().toLowerCase().contains(val)||i.originCountry!.title!.toString().contains(val)){ - searchList.add(i); + }); + } + addLoadsCubitTest({context}){ + testLoading=true; + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + showToast(msg: 'Check your internet connection and try again', state: ToastedStates.ERROR); + } else { + LoadsRepo.addLoadsTest(context: context) + .then((value) => { + testLoading=false, + + }).catchError((error) { + + if(error.toString().contains('Unauthorized Access') || + error.toString().contains('no credit left')){ + testLoading=false; + isAccessToken=false; + emit(AddTestFailed(error.toString())); + print('oooooooooooooooooo'); + + } + testLoading=false; + emit(AddTestFailed(error.toString())); + + print('Add Vehicle Test Failed'); + + print(error); + + //showToast(msg: error.toString(), state: ToastedStates.ERROR); - }else if(i.id!.toString().contains(val)){ - searchList.add(i); - }else if(i.originState!.title!.toString().toLowerCase().contains(val)||i.originState!.title!.toString().contains(val)){ - searchList.add(i); + }); + } + }); + } + addLoadsCubit({context}){ - }else if(i.destinationCity!.title!.toString().toLowerCase().contains(val)||i.destinationCity!.title!.toString().contains(val)){ - searchList.add(i); + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + showToast(msg: "Check your internet connection and try again", state: ToastedStates.ERROR); - }else if(i.destinationState!.title!.toString().toLowerCase().contains(val)||i.destinationState!.title!.toString().contains(val)){ - searchList.add(i); + } else { + LoadsRepo.addLoads(context: context) + .then((value) => { + print('Add Vehicle Success'), + print(value), + emit(AddSuccess()), + VehiclesCubit.get(context).vehicleClearData(context), - }else if(i.equipmentTypes.toString().toLowerCase().contains(val)||i.equipmentTypes.toString().contains(val)){ - searchList.add(i); + showToast(msg: 'Add Success', state: ToastedStates.SUCCESS), - }else if(i.vehicleSizes.toString().toLowerCase().contains(val)||i.vehicleSizes.toString().contains(val)) { - searchList.add(i); - } + }).catchError((error) => { + emit(AddFailed()), + VehiclesCubit.get(context).vehicleClearData(context), - else{ - null; + print('Add Vehicle Failed'), + print(error), + showToast(msg: error.toString(), state: ToastedStates.ERROR), + }); } + }); + } + searchLoads(context,{val,equipmentSize2,attributes2,vehicleSize2,vehicleType2}) { + searchList.clear(); + print("cubit"); + print(equipmentSize2); + print(vehicleSize2); - if(searchList!=null||searchList.length!=0){ - emit(GetSearchSuccess(searchList)); + connectivity.checkConnectivity().then((value)async{ + if(ConnectivityResult.none == value){ + emit(NetworkFailed("Check your internet connection and try again")); }else{ - emit(GetSearchFailed('list is empty')); + LoadsRepo.searchLoads(search: val,equipmentSize: equipmentSize2,vehicleSize: vehicleSize2, + attributes: attributes2,vehicleType: vehicleType2,context: context).then((value) => { + print('..................................'), + print(value), + print("value2"), + + if(value.isNotEmpty){ + print("value"), + print('..................................'), + print(value), + searchList=value, + emit(GetSearchSuccess(searchList)), + VehiclesCubit.get(context).vehicleClearData(context), + + }else{ + emit(GetSearchFailed('Nothing found try again')), + VehiclesCubit.get(context).vehicleClearData(context), + + } + + }).onError((error, stackTrace) => { + emit(GetSearchFailed(error.toString())), + VehiclesCubit.get(context).vehicleClearData(context), + print(error) + + }); } + }); } + + } diff --git a/lib/features/loads/cubit/getLoad_states.dart b/lib/features/loads/cubit/getLoad_states.dart index 2e6aa0b..17a2b18 100644 --- a/lib/features/loads/cubit/getLoad_states.dart +++ b/lib/features/loads/cubit/getLoad_states.dart @@ -1,7 +1,4 @@ -import 'package:hoga_load/core/data/models/GetLoads_model.dart'; - -import '../../../core/data/models/Addvehicle_model.dart'; -import '../../../core/data/models/vehicles.dart'; +import '../../../core/data/models/loads/GetLoads_model.dart'; abstract class AddLoadStates {} @@ -36,3 +33,18 @@ class NetworkFailed extends AddLoadStates { final String msg; NetworkFailed(this.msg); } +class AddTestFailed extends AddLoadStates{ + String? error; + AddTestFailed(this.error); +} +class EditSuccess extends AddLoadStates{ +} +class EditFailed extends AddLoadStates{} +class DeleteSuccess extends AddLoadStates{ +} +class DeleteFailed extends AddLoadStates{ + +} +class Loading extends AddLoadStates{ + +} diff --git a/lib/features/loads/get_loads/units/body.dart b/lib/features/loads/get_loads/units/body.dart new file mode 100644 index 0000000..e5c60af --- /dev/null +++ b/lib/features/loads/get_loads/units/body.dart @@ -0,0 +1,785 @@ +part of '../view.dart'; + +class Body extends StatelessWidget { + Body({Key? key}) : super(key: key); + List titlesList = [ + 'Available', + 'Origin', + 'State', + 'Destination', + 'State', + 'Type', + 'Size' + ]; + @override + Widget build(BuildContext context) { + return Container( + height: 0.7.sh, + child: Scrollbar( + thickness: 15, + trackVisibility: true, + child: ListView( + physics: const BouncingScrollPhysics(), + shrinkWrap: true, + scrollDirection: Axis.horizontal, + children: [ + Column( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0.w), + child: Container( + height: 43.h, + width: 0.2.sw * 7, + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(15), + topRight: Radius.circular(15))), + child: ListView.builder( + scrollDirection: Axis.horizontal, + physics: const NeverScrollableScrollPhysics(), + itemCount: 7, + itemBuilder: (context, index) { + return SizedBox( + width: 0.2.sw, + child: CustomText( + text: titlesList[index], + fontSize: 9.sp, + align: TextAlign.start, + fontWeight: FontWeight.w700, + ), + ); + }), + ), + ), + Container( + height: 0.6.sh, + width: 0.2.sw * 7, + child: BlocConsumer( + builder: (context, state) { + if (state is GetSearchFailed) { + return Center(child: CustomText(text: state.msg)); + } else if (state is GetSearchSuccess) { + return ListView.builder( + physics: const NeverScrollableScrollPhysics(), + itemCount: state.loadList.length, + itemBuilder: (context, index) { + print('lllllllllll'); + final load = state.loadList[index]; + return Container( + color: index.isEven + ? Colors.grey[300] + : Colors.white, + child: Padding( + padding: + const EdgeInsets.symmetric(vertical: 5), + child: InkWell( + onTap: () { + MagicRouter.navigateTo( + Detail(load)); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + CustomText( + width: 0.2.sw, + text: state + .loadList[index].availabilityDate, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + CustomText( +// height: 20.h,o + width: 0.2.sw, + text: state.loadList[index] + .originCountry!.title! ?? + 'other', + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 20.h, + width: 0.2.sw, + text: state.loadList[index] + .originState == + null + ? 'other' + : state.loadList[index] + .originState!.title!, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, + text: state.loadList[index] + .destinationCity == + null + ? 'other' + : state.loadList[index] + .destinationCity!.title!, + fontSize: 8.sp, + align: TextAlign.start, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state.loadList[index] + .destinationState == + null + ? 'other' + : state.loadList[index] + .destinationState!.title!, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 30.h, + width: 0.2.sw, + text: state + .loadList[index].equipmentTypes2! + .toString(), + align: TextAlign.end, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state + .loadList[index].vehicleSizes2! + .toString(), + align: TextAlign.end, + color: Colors.green, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + ], + ), + ), + ), + ); + }); + } else if (state is GetLoadsSuccess) { + return ListView.builder( + physics: const NeverScrollableScrollPhysics(), + itemCount: state.loadList.length, + itemBuilder: (context, index) { + print('llllllll'); + final load = state.loadList[index]; + return Container( + color: index.isEven + ? Colors.grey[300] + : Colors.white, + child: Padding( + padding: + const EdgeInsets.symmetric(vertical: 5), + child: InkWell( + onTap: () { + MagicRouter.navigateTo( + Detail(load)); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + CustomText( + width: 0.2.sw, + text: state + .loadList[index].availabilityDate, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + CustomText( +// height: 20.h,o + width: 0.2.sw, + text: state.loadList[index] + .originCountry!.title! ?? + 'other', + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 20.h, + width: 0.2.sw, + text: state.loadList[index] + .originState == + null + ? 'other' + : state.loadList[index] + .originState!.title!, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, + text: state.loadList[index] + .destinationCity == + null + ? 'other' + : state.loadList[index] + .destinationCity!.title!, + fontSize: 8.sp, + align: TextAlign.start, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state.loadList[index] + .destinationState == + null + ? 'other' + : state.loadList[index] + .destinationState!.title!, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 30.h, + width: 0.2.sw, + text: state.loadList[index] + .equipmentTypes2! + .isEmpty + ? 'other' + : state.loadList[index] + .equipmentTypes2! + .toString(), + align: TextAlign.end, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state.loadList[index] + .vehicleSizes2!.isEmpty + ? 'other' + : state.loadList[index] + .vehicleSizes2! + .toString(), + align: TextAlign.end, + color: Colors.green, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + ], + ), + ), + ), + ); + }); + } else if (state is AddLoadLoading) { + return Column( + children: const [ + Center( + child: CircularProgressIndicator( + color: Colors.orange, + ), + ) + ], + ); + } else { + return ListView.builder( + physics: const NeverScrollableScrollPhysics(), + itemCount: LoadsCubit.get(context).loadList.length, + itemBuilder: (context, index) { + print('llllllll'); + final load = LoadsCubit.get(context).loadList[index]; + return Container( + color: index.isEven + ? Colors.grey[300] + : Colors.white, + child: Padding( + padding: + const EdgeInsets.symmetric(vertical: 5), + child: InkWell( + onTap: () { + MagicRouter.navigateTo( + Detail(load)); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + CustomText( + width: 0.2.sw, + text: LoadsCubit.get(context) + .loadList[index] + .availabilityDate, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + CustomText( +// height: 20.h,o + width: 0.2.sw, + text: LoadsCubit.get(context) + .loadList[index] + .originCity == + null + ? 'other' + : LoadsCubit.get(context) + .loadList[index] + .originCity! + .title! + .toString(), + // text: '', + + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 20.h, + width: 0.2.sw, + text: LoadsCubit.get(context) + .loadList[index] + .originState == + null + ? 'other' + : LoadsCubit.get(context) + .loadList[index] + .originState! + .title! + .toString(), + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, + text: LoadsCubit.get(context) + .loadList[index] + .destinationCity == + null + ? 'other' + : LoadsCubit.get(context) + .loadList[index] + .destinationCity! + .title! + .toString(), + fontSize: 8.sp, + align: TextAlign.start, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: LoadsCubit.get(context) + .loadList[index] + .destinationState == + null + ? 'other' + : LoadsCubit.get(context) + .loadList[index] + .destinationState! + .title! + .toString(), + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 30.h, + width: 0.2.sw, + text: LoadsCubit.get(context) + .loadList[index] + .equipmentTypes + .toString() ?? + 'other', + align: TextAlign.end, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: LoadsCubit.get(context) + .loadList[index] + .vehicleSizes! + .toString() ?? + 'other', + align: TextAlign.end, + color: Colors.green, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + ], + ), + ), + ), + ); + }); + } + }, + listener: (BuildContext context, Object? state) {}, + ), + ) + ], + ), + ], + ), + ), + ); + } +} +/* + +BlocConsumer( + listener: (context, state) {}, + builder: (context, state) { + + if (state is GetSearchFailed) { + return Center(child: CustomText(text: state.msg)); + } else if (state is GetSearchSuccess) { + return Container( + height: .9.sh, + width: 1.sw, + child: Padding( + padding: const EdgeInsets.all(5.0), + child: DataTable2( + columnSpacing: 1, + horizontalMargin: 0, + dataRowHeight: + state.loadList.length >= 10 ? .06.sh : .09.sh, + minWidth: 890, + columns: const [ + DataColumn2( + label: Center(child: Text('Available')), + size: ColumnSize.L, + ), + DataColumn( + label: Center(child: Text('Origin')), + ), + DataColumn( + label: Center(child: Text('State')), + ), + DataColumn( + label: Center(child: Text('Destination')), + ), + DataColumn( + label: Center(child: Text('State')), + ), + DataColumn( + label: Center(child: Text('Type')), + ), + DataColumn( + label: Center(child: Text('Size')), + ), + ], + rows: List.generate( + state.loadList.length, + (index) => DataRow( + + color: MaterialStateColor.resolveWith( + (states) => index.isEven + ? const Color(0xFFE0E0E0) + : Colors.white), + cells: [ + DataCell(Center( + child: Text(state + .loadList[index].availabilityDate!))), + DataCell(Center( + child: Text(state.loadList[index] + .originCountry!.title!))), + DataCell(Center( + child: Text(state.loadList[index] + .originState!.title!))), + DataCell(Center( + child: Text(state.loadList[index] + .destinationCity == + null + ? 'other' + : state.loadList[index] + .destinationCity!.title!))), + DataCell(Center( + child: Text(state.loadList[index] + .destinationState!.title!))), + DataCell(Center( + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 16.0), + child: Center( + child: ListView.builder( + physics: + const NeverScrollableScrollPhysics(), + itemCount: state.loadList[index] + .equipmentTypes?.length, + itemBuilder: (context, i) => Center( + child: Text(state.loadList[index] + .equipmentTypes![i].title + .toString()))), + ), + ))), + DataCell(Center( + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 16.0), + child: Center( + child: ListView.builder( + physics: + const NeverScrollableScrollPhysics(), + itemCount: state.loadList[index] + .vehicleSizes?.length, + itemBuilder: (context, i) => Center( + child: Text(state + .loadList[index] + .vehicleSizes![i] + .title! + .isEmpty + ? 'other' + : state.loadList[index] + .vehicleSizes![i].title + .toString()))), + ), + ))), + ]))), + ), + ); + } else if (state is AddLoadLoading) { + return Column( + mainAxisAlignment: MainAxisAlignment.center, + children:const [ + Center( + child: CircularProgressIndicator( + color: Colors.orange, + ), + ), + ], + ); + } else if (state is GetLoadsSuccess) { + return Container( + height: .9.sh, + width: 1.sw, + child: Padding( + padding: const EdgeInsets.all(5.0), + child: DataTable2( + columnSpacing: 1, + horizontalMargin: 0, + dataRowHeight: LoadsCubit.get(context).loadList.length >= 10 + ? .06.sh + : .09.sh, + minWidth: 890, + columns: const [ + DataColumn2( + label: Center(child: Text('Available')), + size: ColumnSize.L, + ), + DataColumn( + label: Center(child: Text('Origin')), + ), + DataColumn( + label: Center(child: Text('State')), + ), + DataColumn( + label: Center(child: Text('Destination')), + ), + DataColumn( + label: Center(child: Text('State')), + ), + DataColumn( + label: Center(child: Text('Type')), + ), + DataColumn( + label: Center(child: Text('Size')), + ), + ], + rows: List.generate( + LoadsCubit.get(context).loadList.length, + (index) => DataRow( + color: MaterialStateColor.resolveWith( + (states) => index.isEven + ? const Color(0xFFE0E0E0) + : Colors.white), + cells: [ + DataCell(Center( + child: Text(LoadsCubit.get(context) + .loadList[index] + .availabilityDate!))), + DataCell(Center( + child: Text(LoadsCubit.get(context) + .loadList[index] + .originCountry! + .title!))), + DataCell(Center( + child: Text(LoadsCubit.get(context) + .loadList[index] + .originState! + .title!))), + DataCell(Center( + child: Text(state.loadList[index] + .destinationCity == + null + ? 'other' + : state.loadList[index] + .destinationCity!.title!))), + DataCell(Center( + child: Text(LoadsCubit.get(context) + .loadList[index] + .destinationState! + .title!))), + DataCell(Center( + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 16.0), + child: Center( + child: ListView.builder( + physics: + const NeverScrollableScrollPhysics(), + itemCount: LoadsCubit.get(context) + .loadList[index] + .equipmentTypes + ?.length, + itemBuilder: (context, i) => Center( + child: Text( + LoadsCubit.get(context) + .loadList[index] + .equipmentTypes![i] + .title + .toString()))), + ), + ))), + DataCell(Center( + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 16.0), + child: Center( + child: ListView.builder( + physics: + const NeverScrollableScrollPhysics(), + itemCount: LoadsCubit.get(context) + .loadList[index] + .vehicleSizes + ?.length, + itemBuilder: (context, i) => Center( + child: Text( + LoadsCubit.get(context) + .loadList[index] + .vehicleSizes == + null + ? 'other' + : LoadsCubit.get(context) + .loadList[index] + .vehicleSizes![i] + .title!))), + ), + ))), + ]))), + ), + ); + } else{ + return Container( + height: .9.sh, + width: 1.sw, + child: Padding( + padding: const EdgeInsets.all(5.0), + child: DataTable2( + columnSpacing: 1, + horizontalMargin: 0, + dataRowHeight: LoadsCubit.get(context).loadList.length >= 10 + ? .06.sh + : .09.sh, + minWidth: 890, + columns: const [ + DataColumn2( + label: Center(child: Text('Available')), + size: ColumnSize.L, + ), + DataColumn( + label: Center(child: Text('Origin')), + ), + DataColumn( + label: Center(child: Text('State')), + ), + DataColumn( + label: Center(child: Text('Destination')), + ), + DataColumn( + label: Center(child: Text('State')), + ), + DataColumn( + label: Center(child: Text('Type')), + ), + DataColumn( + label: Center(child: Text('Size')), + ), + ], + rows: List.generate( + LoadsCubit.get(context).loadList.length, + (index) => DataRow( + color: MaterialStateColor.resolveWith( + (states) => index.isEven + ? const Color(0xFFE0E0E0) + : Colors.white), + cells: [ + DataCell(Center( + child: Text(LoadsCubit.get(context) + .loadList[index] + .availabilityDate!))), + DataCell(Center( + child: Text(LoadsCubit.get(context) + .loadList[index] + .originCountry! + .title!))), + DataCell(Center( + child: Text(LoadsCubit.get(context) + .loadList[index] + .originState! + .title!))), + DataCell(Center( + child: Text(LoadsCubit.get(context).loadList[index] + .destinationCity == + null + ? 'other' + : LoadsCubit.get(context).loadList[index] + .destinationCity!.title!))), + DataCell(Center( + child: Text(LoadsCubit.get(context) + .loadList[index] + .destinationState! + .title!))), + DataCell(Center( + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 16.0), + child: Center( + child: ListView.builder( + physics: + const NeverScrollableScrollPhysics(), + itemCount: LoadsCubit.get(context) + .loadList[index] + .equipmentTypes + ?.length, + itemBuilder: (context, i) => Center( + child: Text( + LoadsCubit.get(context) + .loadList[index] + .equipmentTypes![i] + .title + .toString()))), + ), + ))), + DataCell(Center( + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 16.0), + child: Center( + child: ListView.builder( + physics: + const NeverScrollableScrollPhysics(), + itemCount: LoadsCubit.get(context) + .loadList[index] + .vehicleSizes + ?.length, + itemBuilder: (context, i) => Center( + child: Text( + LoadsCubit.get(context) + .loadList[index] + .vehicleSizes == + null + ? 'other' + : LoadsCubit.get(context) + .loadList[index] + .vehicleSizes![i] + .title!))), + ), + ))), + ]))), + ), + ); + } + }); + + */ diff --git a/lib/features/loads/get_loads/units/details.dart b/lib/features/loads/get_loads/units/details.dart new file mode 100644 index 0000000..68b862d --- /dev/null +++ b/lib/features/loads/get_loads/units/details.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import '../../../../core/data/models/loads/GetLoads_model.dart'; +import '../../../../widgets/widgets/custom_appbar.dart'; +import '../../../../widgets/widgets/custom_container_load_detail.dart'; +import '../../../../widgets/widgets/custom_scaffold.dart'; +class Detail extends StatefulWidget { + Detail(this.load, {super.key}) ; + GetLoadsModel? load; + + @override + State createState() => _DetailState(); +} + +class _DetailState extends State { + @override + Widget build(BuildContext context) { + return CustomScaffold( + body: + SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + CustomAppbar(title: 'View Loads'), + CustomContainerLoad(widget.load!), + SizedBox(height: 22.h,) + ], + ), + ), + ); + } +} diff --git a/lib/features/loads/view.dart b/lib/features/loads/get_loads/view.dart similarity index 66% rename from lib/features/loads/view.dart rename to lib/features/loads/get_loads/view.dart index 4073078..60ce82b 100644 --- a/lib/features/loads/view.dart +++ b/lib/features/loads/get_loads/view.dart @@ -2,15 +2,27 @@ import 'package:data_table_2/data_table_2.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +<<<<<<< HEAD:lib/features/loads/view.dart +import 'package:hoga_load/features/loads/units/details.dart'; +======= +import 'package:hoga_load/features/loads/get_loads/units/details.dart'; +>>>>>>> nada:lib/features/loads/get_loads/view.dart import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; import 'package:hoga_load/widgets/widgets/custom_row.dart'; import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; import 'package:hoga_load/widgets/widgets/custom_text.dart'; +<<<<<<< HEAD:lib/features/loads/view.dart +import '../../core/router/router.dart'; import 'cubit/getLoad_cubit.dart'; import 'cubit/getLoad_states.dart'; +======= +import '../../../core/router/router.dart'; +import '../cubit/getLoad_cubit.dart'; +import '../cubit/getLoad_states.dart'; +>>>>>>> nada:lib/features/loads/get_loads/view.dart -part 'units/body.dart'; +part '../get_loads/units/body.dart'; class LoadsView extends StatelessWidget { const LoadsView({Key? key}) : super(key: key); diff --git a/lib/features/loads/units/body.dart b/lib/features/loads/units/body.dart index 12ff723..e5c60af 100644 --- a/lib/features/loads/units/body.dart +++ b/lib/features/loads/units/body.dart @@ -2,10 +2,422 @@ part of '../view.dart'; class Body extends StatelessWidget { Body({Key? key}) : super(key: key); - + List titlesList = [ + 'Available', + 'Origin', + 'State', + 'Destination', + 'State', + 'Type', + 'Size' + ]; @override Widget build(BuildContext context) { - return BlocConsumer( + return Container( + height: 0.7.sh, + child: Scrollbar( + thickness: 15, + trackVisibility: true, + child: ListView( + physics: const BouncingScrollPhysics(), + shrinkWrap: true, + scrollDirection: Axis.horizontal, + children: [ + Column( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0.w), + child: Container( + height: 43.h, + width: 0.2.sw * 7, + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(15), + topRight: Radius.circular(15))), + child: ListView.builder( + scrollDirection: Axis.horizontal, + physics: const NeverScrollableScrollPhysics(), + itemCount: 7, + itemBuilder: (context, index) { + return SizedBox( + width: 0.2.sw, + child: CustomText( + text: titlesList[index], + fontSize: 9.sp, + align: TextAlign.start, + fontWeight: FontWeight.w700, + ), + ); + }), + ), + ), + Container( + height: 0.6.sh, + width: 0.2.sw * 7, + child: BlocConsumer( + builder: (context, state) { + if (state is GetSearchFailed) { + return Center(child: CustomText(text: state.msg)); + } else if (state is GetSearchSuccess) { + return ListView.builder( + physics: const NeverScrollableScrollPhysics(), + itemCount: state.loadList.length, + itemBuilder: (context, index) { + print('lllllllllll'); + final load = state.loadList[index]; + return Container( + color: index.isEven + ? Colors.grey[300] + : Colors.white, + child: Padding( + padding: + const EdgeInsets.symmetric(vertical: 5), + child: InkWell( + onTap: () { + MagicRouter.navigateTo( + Detail(load)); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + CustomText( + width: 0.2.sw, + text: state + .loadList[index].availabilityDate, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + CustomText( +// height: 20.h,o + width: 0.2.sw, + text: state.loadList[index] + .originCountry!.title! ?? + 'other', + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 20.h, + width: 0.2.sw, + text: state.loadList[index] + .originState == + null + ? 'other' + : state.loadList[index] + .originState!.title!, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, + text: state.loadList[index] + .destinationCity == + null + ? 'other' + : state.loadList[index] + .destinationCity!.title!, + fontSize: 8.sp, + align: TextAlign.start, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state.loadList[index] + .destinationState == + null + ? 'other' + : state.loadList[index] + .destinationState!.title!, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 30.h, + width: 0.2.sw, + text: state + .loadList[index].equipmentTypes2! + .toString(), + align: TextAlign.end, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state + .loadList[index].vehicleSizes2! + .toString(), + align: TextAlign.end, + color: Colors.green, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + ], + ), + ), + ), + ); + }); + } else if (state is GetLoadsSuccess) { + return ListView.builder( + physics: const NeverScrollableScrollPhysics(), + itemCount: state.loadList.length, + itemBuilder: (context, index) { + print('llllllll'); + final load = state.loadList[index]; + return Container( + color: index.isEven + ? Colors.grey[300] + : Colors.white, + child: Padding( + padding: + const EdgeInsets.symmetric(vertical: 5), + child: InkWell( + onTap: () { + MagicRouter.navigateTo( + Detail(load)); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + CustomText( + width: 0.2.sw, + text: state + .loadList[index].availabilityDate, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + CustomText( +// height: 20.h,o + width: 0.2.sw, + text: state.loadList[index] + .originCountry!.title! ?? + 'other', + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 20.h, + width: 0.2.sw, + text: state.loadList[index] + .originState == + null + ? 'other' + : state.loadList[index] + .originState!.title!, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, + text: state.loadList[index] + .destinationCity == + null + ? 'other' + : state.loadList[index] + .destinationCity!.title!, + fontSize: 8.sp, + align: TextAlign.start, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state.loadList[index] + .destinationState == + null + ? 'other' + : state.loadList[index] + .destinationState!.title!, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 30.h, + width: 0.2.sw, + text: state.loadList[index] + .equipmentTypes2! + .isEmpty + ? 'other' + : state.loadList[index] + .equipmentTypes2! + .toString(), + align: TextAlign.end, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state.loadList[index] + .vehicleSizes2!.isEmpty + ? 'other' + : state.loadList[index] + .vehicleSizes2! + .toString(), + align: TextAlign.end, + color: Colors.green, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + ], + ), + ), + ), + ); + }); + } else if (state is AddLoadLoading) { + return Column( + children: const [ + Center( + child: CircularProgressIndicator( + color: Colors.orange, + ), + ) + ], + ); + } else { + return ListView.builder( + physics: const NeverScrollableScrollPhysics(), + itemCount: LoadsCubit.get(context).loadList.length, + itemBuilder: (context, index) { + print('llllllll'); + final load = LoadsCubit.get(context).loadList[index]; + return Container( + color: index.isEven + ? Colors.grey[300] + : Colors.white, + child: Padding( + padding: + const EdgeInsets.symmetric(vertical: 5), + child: InkWell( + onTap: () { + MagicRouter.navigateTo( + Detail(load)); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + CustomText( + width: 0.2.sw, + text: LoadsCubit.get(context) + .loadList[index] + .availabilityDate, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + CustomText( +// height: 20.h,o + width: 0.2.sw, + text: LoadsCubit.get(context) + .loadList[index] + .originCity == + null + ? 'other' + : LoadsCubit.get(context) + .loadList[index] + .originCity! + .title! + .toString(), + // text: '', + + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 20.h, + width: 0.2.sw, + text: LoadsCubit.get(context) + .loadList[index] + .originState == + null + ? 'other' + : LoadsCubit.get(context) + .loadList[index] + .originState! + .title! + .toString(), + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, + text: LoadsCubit.get(context) + .loadList[index] + .destinationCity == + null + ? 'other' + : LoadsCubit.get(context) + .loadList[index] + .destinationCity! + .title! + .toString(), + fontSize: 8.sp, + align: TextAlign.start, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: LoadsCubit.get(context) + .loadList[index] + .destinationState == + null + ? 'other' + : LoadsCubit.get(context) + .loadList[index] + .destinationState! + .title! + .toString(), + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 30.h, + width: 0.2.sw, + text: LoadsCubit.get(context) + .loadList[index] + .equipmentTypes + .toString() ?? + 'other', + align: TextAlign.end, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: LoadsCubit.get(context) + .loadList[index] + .vehicleSizes! + .toString() ?? + 'other', + align: TextAlign.end, + color: Colors.green, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + ], + ), + ), + ), + ); + }); + } + }, + listener: (BuildContext context, Object? state) {}, + ), + ) + ], + ), + ], + ), + ), + ); + } +} +/* + +BlocConsumer( listener: (context, state) {}, builder: (context, state) { @@ -369,5 +781,5 @@ class Body extends StatelessWidget { ); } }); - } -} + + */ diff --git a/lib/features/loads/units/details.dart b/lib/features/loads/units/details.dart new file mode 100644 index 0000000..016a3fd --- /dev/null +++ b/lib/features/loads/units/details.dart @@ -0,0 +1,36 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import '../../../core/data/models/loads/GetLoads_model.dart'; +import '../../../core/data/models/vehicle/vehicles.dart'; +import '../../../widgets/widgets/custom_appbar.dart'; +import '../../../widgets/widgets/custom_container_load_detail.dart'; +import '../../../widgets/widgets/custom_scaffold.dart'; +class Detail extends StatefulWidget { + Detail(this.load, {super.key}) ; + GetLoadsModel? load; + + @override + State createState() => _DetailState(); +} + +class _DetailState extends State { + @override + Widget build(BuildContext context) { + return CustomScaffold( + body: + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + CustomAppbar(title: 'View Loads'), + Expanded(child: Column( + children: [ + Expanded(child: CustomContainerLoad(widget.load!)), + ], + )), + SizedBox(height: 22.h,) + ], + ), + ); + } +} diff --git a/lib/features/upload_vehicles/units/button.dart b/lib/features/loads/uploaded_loads/units/button.dart similarity index 58% rename from lib/features/upload_vehicles/units/button.dart rename to lib/features/loads/uploaded_loads/units/button.dart index da7dfab..7b554b0 100644 --- a/lib/features/upload_vehicles/units/button.dart +++ b/lib/features/loads/uploaded_loads/units/button.dart @@ -1,16 +1,17 @@ part of '../view.dart'; class Button extends StatelessWidget { - const Button({super.key}); - + Button({super.key}); @override Widget build(BuildContext context) { return Padding( padding: EdgeInsets.only(bottom: 27.h), child: Align( alignment: Alignment.bottomCenter, - child: CustomButton(text: 'Add',icon: Icons.add, color: ColorManager.orange, - + child: CustomButton(text: '+ Add',icon: Icons.add, color: ColorManager.yellow, + function: (){ + // MagicRouter.navigateTo(const AddLoadsView()); + }, ), ), ); diff --git a/lib/features/loads/uploaded_loads/units/my_table.dart b/lib/features/loads/uploaded_loads/units/my_table.dart new file mode 100644 index 0000000..9394287 --- /dev/null +++ b/lib/features/loads/uploaded_loads/units/my_table.dart @@ -0,0 +1,43 @@ +part of '../view.dart'; +class MyTable extends StatelessWidget { + const MyTable({super.key}); + + @override + Widget build(BuildContext context) { + return UploadedTableTitle( + child: BlocConsumer( + listener: (BuildContext context, Object? state) { }, + builder: (context,state) { + return ListView.builder( + itemCount: LoadsCubit.get(context).myVehicleList.length, + + itemBuilder: (context, index) { + return Container( + color: index.isEven ? Colors.grey[300] : Colors.white, + child: UploadedTableDataRow( + origin:"${LoadsCubit.get(context).myVehicleList[index].originCity!.title??"other"}" + " (${LoadsCubit.get(context).myVehicleList[index].originState!.title??"other"} , " + "${LoadsCubit.get(context).myVehicleList[index].originCountry!.title??"other"}) " + " → ""${LoadsCubit.get(context).myVehicleList[index].destinationCity!.title??"other"}" + " (${LoadsCubit.get(context).myVehicleList[index].destinationState!.title??"other"} , " + "${LoadsCubit.get(context).myVehicleList[index].destinationCountry!.title??"other"}) ", + editFunc:(){ +// MagicRouter.navigateTo( AddVehiclesView(isEdit: true,vehiclesModel: +// LoadsCubit.get(context).myVehicleList[index],index:index)); + //VehiclesCubit.get(context).editVehicleCubit(context:context,vehicleId:VehiclesCubit.get(context).vehicleList[index].id); + + } , + deleteFunc:(){ + LoadsCubit.get(context).deleteLoadsCubit(LoadsCubit.get(context).myVehicleList[index].id); + } , + tableWeight:"${LoadsCubit.get(context).myVehicleList[index].weight}" , + tableNumber: "${index+1}", + ), + ); + } + ); + } + ), + ); + } +} diff --git a/lib/features/loads/uploaded_loads/units/upload_load.dart b/lib/features/loads/uploaded_loads/units/upload_load.dart new file mode 100644 index 0000000..431a485 --- /dev/null +++ b/lib/features/loads/uploaded_loads/units/upload_load.dart @@ -0,0 +1,59 @@ +part of '../view.dart'; + +class UploadedLoad extends StatefulWidget { + const UploadedLoad({Key? key}) : super(key: key); + + @override + State createState() => _UploadedLoadState(); +} + +class _UploadedLoadState extends State { + @override + void initState() { + // TODO: implement initState + super.initState(); + LoadsCubit.get(context).addLoadsCubitTest(); + } + @override + Widget build(BuildContext context) { + return BlocConsumer( + listener: (BuildContext context, Object? state) { + + }, + builder: (context,state) { + print("is access token ${LoadsCubit.get(context).isAccessToken}"); + + return LoadsCubit.get(context).testLoading? + const Expanded(child: Center(child: CircularProgressIndicator(color: ColorManager.yellow,))): + + LoadsCubit.get(context).isAccessToken?CustomCard( + widget: Padding( + padding: EdgeInsets.symmetric(horizontal: 11.sp), + child: Column( + children: [ + SizedBox(height: 18.h,), + CustomCardTitle(text: 'UPLOADED LOADS',), + LoadsCubit.get(context).myVehiclesLoading? + const Expanded(child: Center(child: CircularProgressIndicator(color: ColorManager.yellow,))): + LoadsCubit.get(context).myVehicleList.isEmpty?Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + CustomNoContainer(text: 'loads'), + ], + ), + ): + const MyTable(), + Button() + + + ], + ), + ), + ): UpgradeMember(); + + + } + ); + } +} diff --git a/lib/features/loads/uploaded_loads/view.dart b/lib/features/loads/uploaded_loads/view.dart new file mode 100644 index 0000000..c338458 --- /dev/null +++ b/lib/features/loads/uploaded_loads/view.dart @@ -0,0 +1,48 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:hoga_load/core/color_manager/color_manager.dart'; +import 'package:hoga_load/core/router/router.dart'; +import 'package:hoga_load/core/widgets/custom_card.dart'; +import 'package:hoga_load/core/widgets/custom_card_title.dart'; +import 'package:hoga_load/core/widgets/custom_no_container.dart'; +import 'package:hoga_load/features/loads/cubit/getLoad_states.dart'; +import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; +import 'package:hoga_load/widgets/widgets/custom_button.dart'; +import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; +import '../../../widgets/widgets/upgrade_member_ship.dart'; +import '../../../widgets/widgets/uploaded_table_row.dart'; +import '../../../widgets/widgets/uploaded_table_title.dart'; +import '../add_load/add_load_view.dart'; +import '../cubit/getLoad_cubit.dart'; +part '../uploaded_loads/units/button.dart'; +part '../uploaded_loads/units/my_table.dart'; +part '../uploaded_loads/units/upload_load.dart'; +class UploadedLoadsView extends StatefulWidget { + const UploadedLoadsView({Key? key}) : super(key: key); + + @override + State createState() => _UploadedLoadsViewState(); +} + +class _UploadedLoadsViewState extends State { + @override + void initState() { + super.initState(); + LoadsCubit.get(context).getLoad(self: 1); + } + @override + Widget build(BuildContext context) { + return CustomScaffold( + body: SafeArea( + child: Column( + children: [ + CustomAppbar(title: 'Uploaded Products'), + const Expanded(child: UploadedLoad()), + + ], + ), + ), + ); + } +} diff --git a/lib/features/packages/cubit/package_cubit.dart b/lib/features/packages/cubit/package_cubit.dart index 5764722..745f355 100644 --- a/lib/features/packages/cubit/package_cubit.dart +++ b/lib/features/packages/cubit/package_cubit.dart @@ -2,11 +2,9 @@ import 'package:bloc/bloc.dart'; import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:hoga_load/core/data/models/Packages.dart'; -import 'package:hoga_load/core/data/repository/add_vehicle_repo.dart'; +import 'package:hoga_load/core/data/repository/vehicle_repo.dart'; import 'package:hoga_load/features/packages/cubit/package_states.dart'; -import '../../../core/data/models/Attributes.dart'; - class PackageCubit extends Cubit { PackageCubit() : super(PackageLoading()); diff --git a/lib/features/packages/units/body.dart b/lib/features/packages/units/body.dart index 22379a5..049d162 100644 --- a/lib/features/packages/units/body.dart +++ b/lib/features/packages/units/body.dart @@ -18,7 +18,7 @@ class Body extends StatelessWidget { height: .69.sh, width: 1.sw, child: ListView.builder( - + physics: const BouncingScrollPhysics(), itemCount: PackageCubit.get(context).packageList.length, itemBuilder: (context,index){ return CustomPackage( diff --git a/lib/features/packages/view.dart b/lib/features/packages/view.dart index 80152b1..63f1aa8 100644 --- a/lib/features/packages/view.dart +++ b/lib/features/packages/view.dart @@ -1,18 +1,15 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:hoga_load/core/color_manager/color_manager.dart'; import 'package:hoga_load/core/widgets/custom_card_title.dart'; import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; import 'package:hoga_load/widgets/widgets/custom_package.dart'; import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; -import 'package:hoga_load/widgets/widgets/custom_text.dart'; import '../../core/widgets/custom_card.dart'; import 'cubit/package_cubit.dart'; import 'cubit/package_states.dart'; - part 'units/body.dart'; class PackagesView extends StatelessWidget { @@ -23,6 +20,7 @@ class PackagesView extends StatelessWidget { return CustomScaffold( body: SafeArea( child: SingleChildScrollView( + physics: const BouncingScrollPhysics(), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ diff --git a/lib/features/plans/cubit/plans_cubit.dart b/lib/features/plans/cubit/plans_cubit.dart new file mode 100644 index 0000000..65618aa --- /dev/null +++ b/lib/features/plans/cubit/plans_cubit.dart @@ -0,0 +1,37 @@ +import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:hoga_load/core/data/repository/plans_repo.dart'; +import '../../../core/data/models/plans/plans_model.dart'; +import 'plans_states.dart'; + +class PlansCubit extends Cubit { + PlansCubit() : super(PlansLoading()); + + static PlansCubit get(context) => BlocProvider.of(context); + Connectivity connectivity = Connectivity(); + ListplansList=[]; + + getPlansCubit(){ + emit(PlansLoading()); + connectivity.checkConnectivity().then((value)async{ + if(ConnectivityResult.none == value){ + emit(NetworkFailed("Check your internet connection and try again")); + }else{ + PlansRepo.getPlans().then((value) => { + print('..................................'), + plansList=value, + print("this value--------Plans"), + print(value), + emit(GetPlansSuccess(value)) + }).onError((error, stackTrace) => { + emit(GetPlansFailed(error.toString())), + print(error) + + }); + } + + }); + } + + +} \ No newline at end of file diff --git a/lib/features/plans/cubit/plans_states.dart b/lib/features/plans/cubit/plans_states.dart new file mode 100644 index 0000000..6ab9b49 --- /dev/null +++ b/lib/features/plans/cubit/plans_states.dart @@ -0,0 +1,25 @@ + +import '../../../core/data/models/plans/plans_model.dart'; + +abstract class PlansStates{} + +class PlansLoading extends PlansStates{} + +class GetPlansSuccess extends PlansStates{ + + final ListplansList; + GetPlansSuccess(this.plansList); +} + +class GetPlansFailed extends PlansStates{ + + final String msg; + GetPlansFailed(this.msg); +} + + +class NetworkFailed extends PlansStates{ + + final String msg; + NetworkFailed(this.msg); +} \ No newline at end of file diff --git a/lib/features/plans/units/body.dart b/lib/features/plans/units/body.dart new file mode 100644 index 0000000..81bed6b --- /dev/null +++ b/lib/features/plans/units/body.dart @@ -0,0 +1,60 @@ +part of'../view.dart'; +class PlanBody extends StatelessWidget { + @override + Widget build(BuildContext context) { + return + + Padding( + padding: EdgeInsets.symmetric(horizontal: 15.sp), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: CustomText( + text: 'SUBSCRIPTION PLANS', + align: TextAlign.center, + fontSize: 14.sp, + fontWeight: FontWeight.w700, + color: const Color(0xFFFDC52F), + ), + ), + SizedBox( + height: 8.h, + ), + Padding( + padding: EdgeInsets.only(left: 15.w, right: 15.w), + child: CustomText( + text: 'CHECK OUR PRICING POLICY', + align: TextAlign.center, + fontSize: 16.sp, + fontWeight: FontWeight.w700, + color: const Color(0xFF000000), + ), + ), + BlocConsumer( + listener: (context, state) {}, + builder: (context, state) { + return ListView.builder( + itemCount: PlansCubit.get(context).plansList.length>3?3:PlansCubit.get(context).plansList.length, + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context,index){ + return + BuyContainer(text:PlansCubit.get(context).plansList[index].title, + loadsNo:PlansCubit.get(context).plansList[index].totalNumberOfLoads, + vehiclesNo: PlansCubit.get(context).plansList[index].totalNumberOfVehicles, + jobsNo: PlansCubit.get(context).plansList[index].totalNumberOfJobs, + productNo: PlansCubit.get(context).plansList[index].totalNumberOfProducts, + price: PlansCubit.get(context).plansList[index].price, + image:'assets/images/30day.png'); + + + }); + } + ), + +] + )); + } +} diff --git a/lib/features/plans/view.dart b/lib/features/plans/view.dart new file mode 100644 index 0000000..d8e9e53 --- /dev/null +++ b/lib/features/plans/view.dart @@ -0,0 +1,31 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:hoga_load/features/plans/cubit/plans_states.dart'; +import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; + +import '../../widgets/widgets/custom_appbar.dart'; +import '../../widgets/widgets/custom_text.dart'; +import '../home/units/homebage/buy_container.dart'; +import 'cubit/plans_cubit.dart'; +part 'units/body.dart'; + +class PlanView extends StatelessWidget { + @override + Widget build(BuildContext context) { + return CustomScaffold( + + body: + Column( + children: [ + CustomAppbar(title: 'SUBSCRIPTION PLANS'), + SizedBox(height: 22.h,), + Expanded(child: + SingleChildScrollView( + physics: const BouncingScrollPhysics(), + child: PlanBody())), + ], + )); + } +} + diff --git a/lib/features/search_product/cubit/getProduct__states.dart b/lib/features/search_product/cubit/getProduct__states.dart index 8facb85..c2a6b7b 100644 --- a/lib/features/search_product/cubit/getProduct__states.dart +++ b/lib/features/search_product/cubit/getProduct__states.dart @@ -1,8 +1,4 @@ -import 'package:hoga_load/core/data/models/GetLoads_model.dart'; -import 'package:hoga_load/core/data/models/GetProduct_model.dart'; - -import '../../../core/data/models/Addvehicle_model.dart'; -import '../../../core/data/models/vehicles.dart'; +import '../../../core/data/models/product/GetProduct_model.dart'; abstract class AddProductStates {} @@ -23,6 +19,10 @@ class GetProductsFailed extends AddProductStates { final String msg; GetProductsFailed(this.msg); } +class AddTestFailed extends AddProductStates { + final String msg; + AddTestFailed(this.msg); +} class GetSearchSuccess extends AddProductStates { List productList = []; @@ -38,3 +38,12 @@ class NetworkFailed extends AddProductStates { final String msg; NetworkFailed(this.msg); } +class ImageGallery extends AddProductStates { + ImageGallery(); +} +class DeleteSuccess extends AddProductStates { +}class DeleteFailed extends AddProductStates { +} +class EditSuccess extends AddProductStates { +}class EditFailed extends AddProductStates { +} diff --git a/lib/features/search_product/cubit/getProduct_cubit.dart b/lib/features/search_product/cubit/getProduct_cubit.dart index c4e91dd..fe6c644 100644 --- a/lib/features/search_product/cubit/getProduct_cubit.dart +++ b/lib/features/search_product/cubit/getProduct_cubit.dart @@ -1,35 +1,68 @@ +import 'dart:convert'; +import 'dart:io'; + import 'package:bloc/bloc.dart'; import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:hoga_load/core/data/models/GetLoads_model.dart'; -import 'package:hoga_load/core/data/models/GetProduct_model.dart'; -import 'package:hoga_load/core/data/repository/add_vehicle_repo.dart'; +import 'package:hoga_load/core/data/repository/product_repo.dart'; import 'package:hoga_load/features/search_product/cubit/getProduct__states.dart'; +import 'package:image_picker/image_picker.dart'; + +import '../../../core/data/models/product/GetProduct_model.dart'; +import '../../../core/dialoges/toast.dart'; class ProductsCubit extends Cubit { ProductsCubit() : super(AddProductLoading()); - + TextEditingController priceController=TextEditingController(); + TextEditingController nameController=TextEditingController(); + TextEditingController descController=TextEditingController(); + var image; static ProductsCubit get(context) => BlocProvider.of(context); Connectivity connectivity = Connectivity(); List searchList=[]; + + List myProductList=[]; + + String? img64; List productList=[]; + bool isAccessToken=true; + bool testLoading=false; + bool myVehiclesLoading=false; + getProduct({self}){ + myVehiclesLoading=true; - getProduct(){ connectivity.checkConnectivity().then((value)async{ if(ConnectivityResult.none == value){ emit(NetworkFailed("Check your internet connection and try again")); }else{ - VehicleRepo.getProducts('products').then((value) => { - print('..................................'), + ProductRepo.getProducts('products',self).then((value) => { + myVehiclesLoading=false, + + print('..................................'), print(value), - productList=value, - emit(GetProductsSuccess(value)) + + if(self==1){ + myVehiclesLoading=false, + + myProductList=value, + print('Get My Product Response'), + print(myProductList.length), + + }else + { + + productList = value, + emit(GetProductsSuccess(value)) + } }).onError((error, stackTrace) => { - emit(GetProductsFailed(error.toString())), + myVehiclesLoading=true, + + emit(GetProductsFailed(error.toString())), print(error) }); @@ -38,37 +71,182 @@ class ProductsCubit extends Cubit { }); } - searchProducts(val,context) { + searchProducts(GetProductModel productModel) { searchList.clear(); - ProductsCubit.get(context).productList.forEach((i) { - if(i.buyOrSell!.toLowerCase().contains(val)||i.buyOrSell!.contains(val)){ - searchList.add(i); + print("cubit search product"); + + connectivity.checkConnectivity().then((value)async{ + if(ConnectivityResult.none == value){ + emit(NetworkFailed("Check your internet connection and try again")); + }else{ + ProductRepo.searchProduct('products',0,productModel: productModel).then((value) => { + print('..................................'), + print(value), + print("value2"), + + if(value.isNotEmpty){ + print("value"), + print('..................................'), + print(value), + searchList=value, + emit(GetSearchSuccess(searchList)), + + + }else{ + emit(GetSearchFailed('Nothing found try again')), + + } + + }).onError((error, stackTrace) => { + emit(GetSearchFailed(error.toString())), + print(error) + + }); } - else if(i.productName!.toLowerCase().contains(val)||i.productName.toString().contains(val)){ - searchList.add(i); - }else if(i.id!.toString().contains(val)) { - searchList.add(i); - }else if(i.price!.contains(val)||i.price!.toString().contains(val)){ - searchList.add(i); + }); + } + + addProductCubit({context,GetProductModel? productModel}){ + + + + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + showToast(msg: "Check your internet connection and try again", state: ToastedStates.ERROR); + + } else { + emit(AddProductLoading()); + ProductRepo.addProduct(context: context,productModel: productModel) + .then((value) => { + print('Add Product Success'), + print(value), + emit(AddSuccess()), + priceController.text='', + descController.text='', + nameController.text='', + img64='', + image=null, + + showToast(msg: 'Add Success', state: ToastedStates.SUCCESS), + + }).catchError((error) { + emit(AddFailed()); + if(error.toString().contains('Unauthorized Access') || + error.toString().contains('no credit left')){ + - }else if(i.productType!.title!.contains(val)||i.productType!.title!.toLowerCase().contains(val)) { - searchList.add(i); } + print('Add Product Failed'); + print(error); + showToast(msg: error.toString(), state: ToastedStates.ERROR); + + }); + } + }); + } + + pickFromGallery(BuildContext context) async { + var img = await ImagePicker().pickImage(source: ImageSource.gallery); + image = File( + img!.path, + ); + print(image.toString().split('/data/user/0/com.example.hoga_load/cache/image_picker')); + final bytes = image.readAsBytesSync(); + img64 = "data:image/png;base64,"+base64Encode(bytes); + emit(ImageGallery()); + print('img64'+img64!); + + + } + + + + addProductCubitTest({context}){ + testLoading=true; + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + showToast(msg: 'Check your internet connection and try again', state: ToastedStates.ERROR); + } else { + ProductRepo.addProductTest(context: context) + .then((value) => { + testLoading=false, + + }).catchError((error) { + + if(error.toString().contains('Unauthorized Access') || + error.toString().contains('no credit left')){ + testLoading=false; + isAccessToken=false; + emit(AddTestFailed(error.toString())); + print('oooooooooooooooooo'); - else{ - null; + } + testLoading=false; + emit(AddTestFailed(error.toString())); + print('Add Product Test Failed'); + + print(error); + + //showToast(msg: error.toString(), state: ToastedStates.ERROR); + + + }); } + }); + } + editProductCubit(GetProductModel? productModel){ + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + } else { + ProductRepo.editVehicle(productModel) + .then((value) => { + print('Edit Vehicle Success'), + print(value), - if(searchList!=null||searchList.length!=0){ - emit(GetSearchSuccess(searchList)); + emit(EditSuccess()), + showToast(msg: 'Edit Success', state: ToastedStates.SUCCESS), + priceController.text='', + descController.text='', + nameController.text='', + img64='', + image=null, + }) + .catchError((error, stackTrace) => + {emit(EditFailed()), + print(error), + showToast(msg: error.toString(), state: ToastedStates.ERROR), + print('Edit Vehicle Failed'), + }); + } + }); + } + deleteProductCubit(productId){ + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + } else { + ProductRepo.delete(productId) + .then((value) => { + print('Delete Vehicle Success'), + print(value), - }else{ - emit(GetSearchFailed('list is empty')); + emit(DeleteSuccess()), + showToast(msg: 'Delete Success', state: ToastedStates.SUCCESS), + }).catchError((error, stackTrace) => + {emit(DeleteFailed()), + print(error), + showToast(msg: error.toString(), state: ToastedStates.ERROR), + print('Delete Vehicle Failed'), + }); } }); } + } diff --git a/lib/features/search_product/units/body.dart b/lib/features/search_product/units/body.dart index 8a5d9c2..384494b 100644 --- a/lib/features/search_product/units/body.dart +++ b/lib/features/search_product/units/body.dart @@ -2,10 +2,346 @@ part of '../view.dart'; class Body extends StatelessWidget { Body({Key? key}) : super(key: key); - + List titlesList = ['Buy / Sell', 'Product', 'Type', 'Price', ' ']; @override Widget build(BuildContext context) { - return BlocConsumer( +<<<<<<< HEAD + return Container( +======= + return SizedBox( +>>>>>>> nada + height: 0.7.sh, + child: Scrollbar( + thickness: 15, + trackVisibility: true, + child: ListView( + physics: const BouncingScrollPhysics(), + shrinkWrap: true, + scrollDirection: Axis.horizontal, + children: [ + Column( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0.w), + child: Container( + height: 43.h, + width: 0.2.sw * 7, + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(15), + topRight: Radius.circular(15))), + child: ListView.builder( + scrollDirection: Axis.horizontal, + physics: const NeverScrollableScrollPhysics(), + itemCount: 5, + itemBuilder: (context, index) { + return SizedBox( + width: 0.2.sw, + child: CustomText( + text: titlesList[index], + fontSize: 9.sp, + align: TextAlign.start, + fontWeight: FontWeight.w700, + ), + ); + }), + ), + ), + Container( + height: 0.6.sh, + width: 0.2.sw * 7, + child: BlocConsumer( + builder: (context, state) { + if (state is GetProductsFailed && state is GetSearchFailed) { + return Center(child: CustomText(text: state.msg)); + } else if (state is GetSearchSuccess) { + return ListView.builder( + physics: const NeverScrollableScrollPhysics(), + itemCount: state.productList.length, + itemBuilder: (context, index) { + print('lllllllllll'); + + return Container( + color: index.isEven + ? Colors.grey[300] + : Colors.white, + child: Padding( + padding: + const EdgeInsets.symmetric(vertical: 5), + child: InkWell( + onTap: () { + MagicRouter.navigateTo(Detail( + ProductsCubit.get(context) + .productList[index])); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + CustomText( + width: 0.2.sw, + text: + state.productList[index].buyOrSell, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + CustomText( +// height: 20.h,o + width: 0.2.sw, + text: state.productList[index] + .productName ?? + 'other', + // text: '', + + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 20.h, + width: 0.2.sw, + text: state.productList[index] + .productType == + null + ? 'other' + : state.productList[index] + .productType!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, + text: + '\$ ${state.productList[index].price!} ' ?? + 'other', + fontSize: 8.sp, + align: TextAlign.start, + fontWeight: FontWeight.w500), + Image( + height: 50, + width: 0.2.sw, + image: NetworkImage(state + .productList[index] + .productImage == + null + ? 'https://hegaload.com/uploads/product-images/1657431690.jpg' + : state.productList[index] + .productImage!)) + ], + ), + ), + ), + ); + }); + } else if (state is GetProductsSuccess) { + return ListView.builder( + physics: const NeverScrollableScrollPhysics(), + itemCount: state.productList.length, + itemBuilder: (context, index) { +<<<<<<< HEAD + print('llllllll'); +======= +>>>>>>> nada + + return Container( + color: index.isEven + ? Colors.grey[300] + : Colors.white, + child: Padding( + padding: + const EdgeInsets.symmetric(vertical: 5), + child: InkWell( + onTap: () { + MagicRouter.navigateTo(Detail( + ProductsCubit.get(context) + .productList[index])); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + CustomText( + width: 0.2.sw, + text: + state.productList[index].buyOrSell, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + CustomText( +// height: 20.h,o + width: 0.2.sw, + text: state.productList[index] + .productName ?? + 'other', + // text: '', + + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 20.h, + width: 0.2.sw, + text: state.productList[index] + .productType == + null + ? 'other' + : state.productList[index] + .productType!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, + text: + '\$ ${state.productList[index].price!} ' ?? + 'other', + fontSize: 8.sp, + align: TextAlign.start, + fontWeight: FontWeight.w500), +<<<<<<< HEAD + Image( + height: 50, + width: 0.2.sw, + image: NetworkImage( + + state + .productList[index] + .productImage == + null + ? 'https://hegaload.com/uploads/product-images/1657431690.jpg' + : state.productList[index] + .productImage!)) +======= + + CachedNetworkImage( + height: 50, + width: 0.2.sw, + imageUrl: state + .productList[index] + .productImage!, + placeholder: (context, url) => CircularProgressIndicator(), + errorWidget: (context, url, error) => Icon(Icons.error), + ), + +>>>>>>> nada + ], + ), + ), + ), + ); + }); + } else if (state is AddProductLoading) { + return Column( + children: const [ + Center( + child: CircularProgressIndicator( + color: Colors.orange, + ), + ) + ], + ); + } else { + return ListView.builder( + physics: const NeverScrollableScrollPhysics(), + itemCount: + ProductsCubit.get(context).productList.length, + itemBuilder: (context, index) { + print('llllllll'); + + return Container( + color: index.isEven + ? Colors.grey[300] + : Colors.white, + child: Padding( + padding: + const EdgeInsets.symmetric(vertical: 5), + child: InkWell( + onTap: () { + MagicRouter.navigateTo(Detail( + ProductsCubit.get(context) + .productList[index])); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + CustomText( + width: 0.2.sw, + text: ProductsCubit.get(context) + .productList[index] + .buyOrSell, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + CustomText( +// height: 20.h,o + width: 0.2.sw, + text: ProductsCubit.get(context) + .productList[index] + .productName ?? + 'other', + // text: '', + + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 20.h, + width: 0.2.sw, + text: ProductsCubit.get(context) + .productList[index] + .productType == + null + ? 'other' + : ProductsCubit.get(context) + .productList[index] + .productType! + .title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, + text: + '\$ ${ProductsCubit.get(context).productList[index].price!} ', + fontSize: 8.sp, + align: TextAlign.start, + fontWeight: FontWeight.w500), + Image(height: 50, + width: 0.2.sw, + image: NetworkImage(ProductsCubit.get( + context) + .productList[index] + .productImage == + null + ? 'https://hegaload.com/uploads/product-images/1657431690.jpg' + : ProductsCubit.get(context) + .productList[index] + .productImage!)) + ], + ), + ), + ), + ); + }); + } + }, + listener: (BuildContext context, Object? state) {}, + ), + ) + ], + ), + ], + ), + ), + ); + } +} +/* +BlocConsumer( listener: (context, state) {}, builder: (context, state) { if (state is GetSearchFailed) { @@ -215,5 +551,4 @@ class Body extends StatelessWidget { ); } }); - } -} + */ diff --git a/lib/features/search_product/units/details.dart b/lib/features/search_product/units/details.dart new file mode 100644 index 0000000..18f514c --- /dev/null +++ b/lib/features/search_product/units/details.dart @@ -0,0 +1,38 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import '../../../core/data/models/loads/GetLoads_model.dart'; +import '../../../core/data/models/product/GetProduct_model.dart'; +import '../../../core/data/models/vehicle/vehicles.dart'; +import '../../../widgets/widgets/custom_appbar.dart'; +import '../../../widgets/widgets/custom_container_load_detail.dart'; +import '../../../widgets/widgets/custom_container_product_detail.dart'; +import '../../../widgets/widgets/custom_scaffold.dart'; +class Detail extends StatefulWidget { + Detail(this.load, {super.key}) ; + GetProductModel? load; + + @override + State createState() => _DetailState(); +} + +class _DetailState extends State { + @override + Widget build(BuildContext context) { + return CustomScaffold( + body: + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + CustomAppbar(title: 'View Product'), + Expanded(child: Column( + children: [ + Expanded(child: CustomContainerProduct(widget.load!)), + ], + )), + SizedBox(height: 22.h,) + ], + ), + ); + } +} diff --git a/lib/features/search_product/view.dart b/lib/features/search_product/view.dart index e6752f5..ce48bd0 100644 --- a/lib/features/search_product/view.dart +++ b/lib/features/search_product/view.dart @@ -1,3 +1,4 @@ +import 'package:cached_network_image/cached_network_image.dart'; import 'package:data_table_2/data_table_2.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; @@ -5,12 +6,18 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:hoga_load/core/color_manager/color_manager.dart'; import 'package:hoga_load/features/search_product/cubit/getProduct_cubit.dart'; import 'package:hoga_load/features/search_product/model.dart'; +import 'package:hoga_load/features/search_product/units/details.dart'; +<<<<<<< HEAD +======= +import 'package:hoga_load/features/upload_product/add_view.dart'; +>>>>>>> nada import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; import 'package:hoga_load/widgets/widgets/custom_button.dart'; import 'package:hoga_load/widgets/widgets/custom_row.dart'; import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; import 'package:hoga_load/widgets/widgets/custom_text.dart'; +import '../../core/router/router.dart'; import 'cubit/getProduct__states.dart'; part 'units/body.dart'; @@ -26,7 +33,9 @@ class SearchView extends StatelessWidget { children: [ CustomAppbar(title: 'Search Product'), SizedBox(height: 22.h,), - CustomSearchRow(3), + CustomSearchRow(3,function: (){ + MagicRouter.navigateTo(AddProductsView(isFilter: true,)); + },), SizedBox(height: 21.h,), Body() ], diff --git a/lib/features/splash/splash_view.dart b/lib/features/splash/splash_view.dart index 2840486..945ed19 100644 --- a/lib/features/splash/splash_view.dart +++ b/lib/features/splash/splash_view.dart @@ -1,10 +1,12 @@ import 'package:animated_splash_screen/animated_splash_screen.dart'; import 'package:flutter/material.dart'; import 'package:hoga_load/core/app_images/app_images.dart'; -import 'package:hoga_load/core/data/local/cacheHelper.dart'; -import 'package:hoga_load/core/keys/keys.dart'; import 'package:hoga_load/features/auth/login.dart'; +import '../../core/data/local/cacheHelper.dart'; +import '../../core/keys/keys.dart'; +import '../home/view.dart'; + class SplashScreen extends StatelessWidget { final Widget? nextScreen; @@ -19,7 +21,12 @@ class SplashScreen extends StatelessWidget { splashIconSize: 150, splash: Image.asset(AppImages.logo), nextScreen: - // CacheHelper.getString(SharedKeys.token)!=null?const Home(): +<<<<<<< HEAD +======= + // CacheHelper.getString(SharedKeys.token)!=null? + //const Home(): +>>>>>>> nada + // CacheHelper.getString(SharedKeys.token)!=null?const Home(): Login(), splashTransition: SplashTransition.fadeTransition, backgroundColor: Colors.white)); diff --git a/lib/features/subscribtion_details/view.dart b/lib/features/subscribtion_details/view.dart index 3ee6d70..9f25977 100644 --- a/lib/features/subscribtion_details/view.dart +++ b/lib/features/subscribtion_details/view.dart @@ -1,13 +1,11 @@ import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:hoga_load/core/color_manager/color_manager.dart'; -import 'package:hoga_load/core/widgets/custom_card_title.dart'; import 'package:hoga_load/features/subscribtion_details/units/details.dart'; import 'package:hoga_load/features/subscribtion_details/units/facilities.dart'; import 'package:hoga_load/features/subscribtion_details/units/plans.dart'; import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; + import '../../core/widgets/custom_card.dart'; part 'units/body.dart'; diff --git a/lib/features/upload_jop/units/button.dart b/lib/features/upload_jop/units/button.dart deleted file mode 100644 index da7dfab..0000000 --- a/lib/features/upload_jop/units/button.dart +++ /dev/null @@ -1,18 +0,0 @@ -part of '../view.dart'; - -class Button extends StatelessWidget { - const Button({super.key}); - - @override - Widget build(BuildContext context) { - return Padding( - padding: EdgeInsets.only(bottom: 27.h), - child: Align( - alignment: Alignment.bottomCenter, - child: CustomButton(text: 'Add',icon: Icons.add, color: ColorManager.orange, - - ), - ), - ); - } -} diff --git a/lib/features/upload_jop/units/uploaded.dart b/lib/features/upload_jop/units/uploaded.dart deleted file mode 100644 index ce8925e..0000000 --- a/lib/features/upload_jop/units/uploaded.dart +++ /dev/null @@ -1,25 +0,0 @@ -part of '../view.dart'; - -class Uploaded extends StatelessWidget { - const Uploaded({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return CustomCard( - widget: Padding( - padding: EdgeInsets.symmetric(horizontal: 11.sp), - child: Column( - children: [ - SizedBox(height: 18.h,), - CustomCardTitle(text: 'UPLOADED JOBS',), - CustomNoContainer(text: 'jobs'), - const Spacer(), - const Button() - - - ], - ), - ), - ); - } -} diff --git a/lib/features/add_product/view.dart b/lib/features/upload_product/add_view.dart similarity index 50% rename from lib/features/add_product/view.dart rename to lib/features/upload_product/add_view.dart index 9aad484..7bbaedf 100644 --- a/lib/features/add_product/view.dart +++ b/lib/features/upload_product/add_view.dart @@ -1,20 +1,29 @@ import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:hoga_load/core/color_manager/color_manager.dart'; +import 'package:hoga_load/core/data/models/product/GetProduct_model.dart'; +import 'package:hoga_load/features/search_product/cubit/getProduct__states.dart'; +import 'package:hoga_load/features/search_product/cubit/getProduct_cubit.dart'; import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; import 'package:hoga_load/widgets/widgets/custom_button.dart'; import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; import 'package:hoga_load/widgets/widgets/custom_text.dart'; import 'package:hoga_load/widgets/widgets/custom_text_field.dart'; +import '../../core/master_cubit/getDataForm_state.dart'; import '../../core/widgets/custom_card.dart'; -import '../add_vehicle/cubit/getDataForm_cubit.dart'; +import '../../core/master_cubit/getDataForm_cubit.dart'; -part 'units/form.dart'; +part 'units/add_product_form.dart'; -class AddProductsView extends StatelessWidget { - const AddProductsView({Key? key}) : super(key: key); + class AddProductsView extends StatelessWidget { + AddProductsView({Key? key,this.productModel,this.isEdit=false,this.index,this.isFilter=false}) : super(key: key); + GetProductModel? productModel; + bool isEdit; + bool isFilter; + int? index; @override Widget build(BuildContext context) { return CustomScaffold( @@ -22,15 +31,14 @@ class AddProductsView extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - CustomAppbar(title: 'Add Products'), - - - const Expanded(child: SingleChildScrollView( + CustomAppbar(title: isEdit?'Edit Products':isFilter?'Search Product':'Add Product'), + Expanded(child: SingleChildScrollView( physics:BouncingScrollPhysics(), child: Padding( padding: EdgeInsets.only(top: 22.0), - child: Form(), + child: Form(productModel: productModel,isEdit: isEdit,index: index,isFilter: isFilter,), ))), + ], ), ), diff --git a/lib/features/upload_product/units/add_product_form.dart b/lib/features/upload_product/units/add_product_form.dart new file mode 100644 index 0000000..1c27c88 --- /dev/null +++ b/lib/features/upload_product/units/add_product_form.dart @@ -0,0 +1,713 @@ +part of '../add_view.dart'; + +class Form extends StatefulWidget { + Form({Key? key,this.isFilter=false,this.productModel,this.isEdit=false,this.index}) : super(key: key); + bool isFilter; + GetProductModel? productModel; + bool isEdit; + int? index; + @override + State createState() => _FormState(); +} + +class _FormState extends State { + String country = ''; + String state = ''; + String city = ''; + String product = ''; + String? buyOrSell; + + int? countryId; + int? stateId; + int? cityId; + int? productId; + List productType = ['Buy', 'Sell']; + + @override + void initState() { + super.initState(); + if (widget.isEdit) { + //print(widget.productModel!.city); + // print('mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm'); + // country = widget.productModel!.country!.title??''; +// city = widget.productModel!.city!.title!; +// state = widget.productModel!.state!.title!; +// countryId = widget.productModel!.country!.id!; +// cityId = widget.productModel!.city!.id!; +// stateId = widget.productModel!.state!.id!; + buyOrSell=widget.productModel!.buyOrSell; + + ProductsCubit + .get(context) + .priceController + .text = widget.productModel!.price!; + ProductsCubit + .get(context) + .nameController + .text = widget.productModel!.productName!; + ProductsCubit + .get(context) + .descController + .text = widget.productModel!.description == null ? "" : + widget.productModel!.description!; + + ProductsCubit + .get(context) + .img64 = widget.productModel!.productImage!; + + ProductsCubit + .get(context) + .image = widget.productModel!.productImage!; + } + } + + @override + Widget build(BuildContext context) { + return + BlocConsumer( + listener: (BuildContext context, state) {}, + builder: (BuildContext context, s) { + return CustomCard( + widget: BlocConsumer( + listener: (BuildContext context, state) {}, + builder: (BuildContext context, s) { + return Column( + children: [ + Padding( + padding: EdgeInsets.symmetric(vertical: 16.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + const Icon( + Icons.arrow_back_sharp, + ), + Expanded( + child: CustomText( + text: widget.isEdit?"EDIT PRODUCT":widget.isFilter?'SEARCH':'ADD PRODUCT', + fontSize: 18.sp, + fontWeight: FontWeight.w700, + ), + ) + ], + ), + ), + SizedBox( + width: 1.sw, + child: const Divider( + thickness: 1, + ), + ), + CustomTextField( + height: 64.h, + readOnly: true, + lines: 1, + name: 'Product for', + hintText: buyOrSell ?? 'Buy', + suffixIcon: InkWell( + onTap: () { + showModalBottomSheet( + context: context, + builder: (context) { + return ListView.builder( + itemCount: + productType.length, + itemBuilder: (context, index) => + Column( + mainAxisAlignment: MainAxisAlignment + .center, + children: [ + InkWell( + onTap: () { + setState(() { + buyOrSell = + productType[index]; + Navigator.of(context) + .pop(); + }); + }, + child: Padding( + padding: const EdgeInsets + .all(8.0), + child: productType[index] + == + null + ? const Center( + child: CircularProgressIndicator( + color: Colors.green, + ), + ) + : Text( + productType[index], + style: TextStyle( + color: Colors.black, + fontSize: 20.sp), + ), + ), + ), + ], + )); + }, + ); + }, + child: Icon( + Icons.expand_more, + size: 30.sp, + color: ColorManager.blackColor, + ), + )), + CustomTextField( + // name: '', + height: 64.h, + lines: 1, + hintText: 'Name of the Product', + controller: ProductsCubit + .get(context) + .nameController, + color: Colors.grey, + ), + CustomTextField( + + height: 64.h, + readOnly: true, + name: 'Country', + hintText: + country == '' ? 'Select a Country' : country, + suffixIcon: InkWell( + onTap: () { + showModalBottomSheet( + context: context, + builder: (context) { + return ListView.builder( + itemCount: + DataFormCubit + .get(context) + .countryList + .length, + itemBuilder: (context, index) => + Column( + mainAxisAlignment: MainAxisAlignment + .center, + children: [ + InkWell( + onTap: () { + setState(() { + countryId = + DataFormCubit + .get(context) + .countryList[index] + .id!; + country = + DataFormCubit + .get(context) + .countryList[index] + .title!; + Navigator.of(context) + .pop(); + city = ''; + state = ''; + }); + DataFormCubit.get(context) + .getState( + DataFormCubit + .get(context) + .countryList[index] + .id!); + }, + child: Padding( + padding: const EdgeInsets + .all(8.0), + child: DataFormCubit + .get(context) + .countryList[index] + .title == + null + ? const Center( + child: CircularProgressIndicator( + color: Colors.green, + ), + ) + : Text( + DataFormCubit + .get(context) + .countryList[index] + .title!, + style: TextStyle( + color: Colors.black, + fontSize: 20.sp), + ), + ), + ), + ], + )); + }, + ); + }, + child: Icon( + Icons.expand_more, + size: 30.sp, + color: ColorManager.blackColor, + ), + )), + s is GetStateLoading ? + CustomText(text: 'Loading....',) : CustomTextField( + height: 64.h, + readOnly: true, + name: 'state', + hintText: state == '' ? 'Select a state' : state, + suffixIcon: InkWell( + onTap: () { + showModalBottomSheet( + context: context, + builder: (context) { + return ListView.builder( + itemCount: + DataFormCubit + .get(context) + .stateList + .length, + itemBuilder: (context, index) => + Column( + mainAxisAlignment: MainAxisAlignment + .center, + children: [ + InkWell( + onTap: () { + setState(() { + stateId = DataFormCubit + .get(context) + .stateList[index] + .id!; + state = DataFormCubit + .get(context) + .stateList[index] + .title!; + Navigator.of(context) + .pop(); + city = ''; + }); + DataFormCubit.get(context) + .getCity + (DataFormCubit + .get(context) + .stateList[index] + .title!); + }, + child: Padding( + padding: const EdgeInsets + .all(8.0), + child: DataFormCubit + .get(context) + .stateList[index] + .title == + null + ? const Center( + child: CircularProgressIndicator( + color: Colors.green, + ), + ) + : Text( + DataFormCubit + .get(context) + .stateList[index] + .title!, + style: TextStyle( + color: Colors.black, + fontSize: 20.sp), + ), + ), + ), + ], + )); + }, + ); + }, + child: Icon( + Icons.expand_more, + size: 30.sp, + color: ColorManager.blackColor, + ), + )), + s is GetCityLoading ? + CustomText(text: 'Loading....',) : CustomTextField( + height: 64.h, + readOnly: true, + name: 'City', + hintText: city == '' ? 'Select a city' : city, + suffixIcon: InkWell( + onTap: () { + showModalBottomSheet( + context: context, + builder: (context) { + return ListView.builder( + itemCount: DataFormCubit + .get(context) + .cityList + .length, + itemBuilder: (context, index) => + Column( + mainAxisAlignment: MainAxisAlignment + .center, + children: [ + InkWell( + onTap: () { + setState(() { + cityId = DataFormCubit + .get(context) + .cityList[index] + .id!; + city = DataFormCubit + .get(context) + .cityList[index] + .title!; + Navigator.of(context) + .pop(); + }); + }, + child: Padding( + padding: const EdgeInsets + .all(8.0), + child: DataFormCubit + .get(context) + .cityList[index] + .title == + null + ? const Center( + child: CircularProgressIndicator( + color: Colors.green, + ), + ) + : Text( + DataFormCubit + .get(context) + .cityList[index] + .title!, + style: TextStyle( + color: Colors.black, + fontSize: 20.sp), + ), + ), + ), + ], + )); + }, + ); + }, + child: Icon( + Icons.expand_more, + size: 30.sp, + color: ColorManager.blackColor, + ), + )), + + + CustomTextField( + height: 64.h, + readOnly: true, + name: 'Product Type', + hintText: product == '' + ? 'Select a product type' + : product, + suffixIcon: InkWell( + onTap: () { + showModalBottomSheet( + context: context, + builder: (context) { + return ListView.builder( + itemCount: DataFormCubit + .get(context) + .productList + .length, + itemBuilder: (context, index) => + Column( + mainAxisAlignment: MainAxisAlignment + .center, + children: [ + InkWell( + onTap: () { + setState(() { + productId = + DataFormCubit + .get(context) + .productList[index] + .id!; + product = DataFormCubit + .get(context) + .productList[index] + .title!; + Navigator.of(context) + .pop(); + }); + }, + child: Padding( + padding: const EdgeInsets + .all(8.0), + child: DataFormCubit + .get(context) + .productList[index] + .title == + null + ? const Center( + child: CircularProgressIndicator( + color: Colors.green, + ), + ) + : Text( + DataFormCubit + .get(context) + .productList[index] +//======= +// ), +// ), +// ], +// )); +// }, +// ); +// }, +// child: Icon( +// Icons.expand_more, +// size: 30.sp, +// color: ColorManager.blackColor, +// ), +// )), +// s is GetCityLoading +// ? CustomText( +// text: 'Loading....', +// ) +// : CustomTextField( +// height: 64.h, +// readOnly: true, +// name: 'City', +// hintText: city == '' ? 'Select a city' : city, +// suffixIcon: InkWell( +// onTap: () { +// showModalBottomSheet( +// context: context, +// builder: (context) { +// return ListView.builder( +// itemCount: DataFormCubit.get(context) +// .cityList +// .length, +// itemBuilder: (context, index) => Column( +// mainAxisAlignment: +// MainAxisAlignment.center, +// children: [ +// InkWell( +// onTap: () { +// setState(() { +// cityId = +// DataFormCubit.get(context) +// .cityList[index] +// .id!; +// city = +// DataFormCubit.get(context) +// .cityList[index] +// .title!; +// Navigator.of(context).pop(); +// }); +// }, +// child: Padding( +// padding: +// const EdgeInsets.all(8.0), +// child: DataFormCubit.get( +// context) +// .cityList[index] +// .title == +// null +// ? const Center( +// child: +// CircularProgressIndicator( +// color: Colors.green, +// ), +// ) +// : Text( +// DataFormCubit.get( +// context) +// .cityList[index] + .title!, + style: TextStyle( + color: Colors.black, + fontSize: 20.sp), + ), + ), + ), + ], + )); + }, + ); + }, + child: Icon( + Icons.expand_more, + size: 30.sp, + color: ColorManager.blackColor, + ), + )), + + CustomTextField( + height: 64.h, + hintText: 'Price (CAD)', + keyboardType: TextInputType.number, + controller: ProductsCubit + .get(context) + .priceController, + ), + widget.isFilter?const SizedBox(): Padding( + padding: EdgeInsets.symmetric( + vertical: 5.h, horizontal: 14.w), + child: Container( + height: 64.h, + width: 1.sw, + decoration: BoxDecoration( + border: Border.all( + color: ColorManager.greyColor), + color: ColorManager.whiteColor, + borderRadius: BorderRadius.circular(12.r)), + child: InkWell( + onTap: () { + ProductsCubit.get(context).pickFromGallery( + context); + }, + child: Row( + children: [ + Container( + height: 64.h, + width: 106.w, + decoration: BoxDecoration( + color: Colors.grey[100], + borderRadius: BorderRadius.circular( + 12.r)), + child: Center( + child: Text( + 'Choose File', + style: TextStyle( + color: const Color(0xFF757575), + fontWeight: FontWeight.w400, + fontSize: 14.sp), + ), + ), + ), + Expanded( + child: Center( + child: Text( + ProductsCubit + .get(context) + .image + .toString() + .isNotEmpty + ? + '${ProductsCubit + .get(context) + .image + .toString() + .split( + '/data/user/0/com.example.hoga_load/cache/image_picker')}' + : + ' No File chosen', + style: TextStyle( + color: const Color(0xFF757575), + fontWeight: FontWeight.w400, + fontSize: 14.sp), + ), + ), + ) + ], + ), + ), + ), + ), + SizedBox( + width: 1.sw, + child: const Divider( + thickness: 1, + ), + ), + CustomTextField( + height: 147.h, + lines: 6, + controller: ProductsCubit + .get(context) + .descController, + hintText: 'Description', + ), + BlocListener( + listener: (BuildContext context, state) { + if (state is AddSuccess) { + Navigator.pop(context); + } + }, + child: Padding( + padding: EdgeInsets.only(top: 50.sp, + bottom: 15.sp), + child: CustomButton( + text: widget.isEdit?'Edit Product':widget.isFilter?'Search':'Add new product', + color: ColorManager.yellow, + function: () { + widget.isEdit? + ProductsCubit.get(context).editProductCubit( + GetProductModel( + buyOrSell: buyOrSell, + productName: ProductsCubit + .get(context) + .nameController + .text, + priceInt: int.parse(ProductsCubit + .get(context) + .priceController + .text), + productTypeId: productId, + countryPost: countryId, + statePost: stateId, + cityPost: cityId, + description: ProductsCubit + .get(context) + .descController + .text, + productImage: ProductsCubit + .get(context) + .img64)): + widget.isFilter? ProductsCubit.get(context).searchProducts(GetProductModel( + buyOrSell: buyOrSell, + productTypeId: productId, + countryPost: countryId, + statePost: stateId, + cityPost: cityId, + + + )) + :ProductsCubit.get(context).addProductCubit( + context: context + , + productModel: GetProductModel( + buyOrSell: buyOrSell, + productName: ProductsCubit + .get(context) + .nameController + .text, + priceInt: int.parse(ProductsCubit + .get(context) + .priceController + .text), + productTypeId: productId, + countryPost: countryId, + statePost: stateId, + cityPost: cityId, + description: ProductsCubit + .get(context) + .descController + .text, + productImage: ProductsCubit + .get(context) + .img64)); + }, + ), + ), + ), + ], + ); + } + ), + ); + } + ); + } + } + diff --git a/lib/features/upload_product/units/button.dart b/lib/features/upload_product/units/button.dart new file mode 100644 index 0000000..4411e1c --- /dev/null +++ b/lib/features/upload_product/units/button.dart @@ -0,0 +1,31 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import '../../../core/color_manager/color_manager.dart'; +import '../../../core/router/router.dart'; +import '../../../widgets/widgets/custom_button.dart'; +import '../../plans/view.dart'; +import '../add_view.dart'; +class Button extends StatelessWidget { + + Button({super.key,this.isUpgradeMember=false}); + bool isUpgradeMember; + @override + Widget build(BuildContext context) { + return Padding( + padding: EdgeInsets.only(bottom: 27.h), + child: Align( + alignment: Alignment.bottomCenter, + child: CustomButton(text: '+ Add',icon: Icons.add, color: ColorManager.yellow, + function: (){ + isUpgradeMember? MagicRouter.navigateTo( PlanView()): + + MagicRouter.navigateTo( AddProductsView( + + )); + }, + ), + ), + ); + } +} diff --git a/lib/features/upload_product/units/table_data.dart b/lib/features/upload_product/units/table_data.dart new file mode 100644 index 0000000..5c2350a --- /dev/null +++ b/lib/features/upload_product/units/table_data.dart @@ -0,0 +1,106 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:hoga_load/features/search_product/cubit/getProduct_cubit.dart'; +import 'package:hoga_load/features/upload_product/add_view.dart'; +import 'package:hoga_load/features/upload_product/units/table_product_title.dart'; +import '../../../core/color_manager/color_manager.dart'; +import '../../../core/dialoges/delete_dialoge.dart'; +import '../../../core/router/router.dart'; +import '../../../widgets/widgets/custom_text.dart'; +class MyProductTable extends StatelessWidget { + const MyProductTable({super.key}); + + @override + Widget build(BuildContext context) { + return UploadedTableProduct( + child: ListView.builder( + itemCount: ProductsCubit.get(context).myProductList.length, + + itemBuilder: (context, index) { + return Container( + color: index.isEven ? Colors.grey[300] : Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 5), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: 1, + child: CustomText( + text:'${index+1}', + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + ), + Expanded( + flex: 2, + child: CustomText( + text: ProductsCubit.get(context).myProductList[index].productName, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + ), + Expanded( + flex:2, + child: CustomText( + text: ProductsCubit.get(context).myProductList[index].productType!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + ), + Expanded( + flex:2, + child: Row( + children: [ + InkWell( + onTap:(){ + showDialog(context: context, builder:(context)=> DeleteEditDialog(function: (){ + Navigator.pop(context); + MagicRouter.navigateTo( AddProductsView(isEdit: true,productModel: + ProductsCubit.get(context).myProductList[index],index:index)); + },btnText: 'Edit',)); + + }, + child: CustomText( + text: 'Edit', + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w200, + color: ColorManager.primaryColor, + ), + ), + SizedBox(width: 5.sp,), + InkWell( + onTap:(){ + showDialog(context: context, builder:(context)=> DeleteEditDialog(function: (){ + + ProductsCubit.get(context).deleteProductCubit(ProductsCubit.get(context).myProductList[index].id); + + },btnText: 'Delete',)); + }, + child: CustomText( + text: 'Delete', + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w200, + color: Colors.red, + ), + ), + + ], + ), + ), + + ], + ), + ), + ); + } + ) + + ); + } +} \ No newline at end of file diff --git a/lib/features/upload_product/units/table_product_title.dart b/lib/features/upload_product/units/table_product_title.dart new file mode 100644 index 0000000..607f437 --- /dev/null +++ b/lib/features/upload_product/units/table_product_title.dart @@ -0,0 +1,83 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import '../../../widgets/widgets/custom_text.dart'; +class UploadedTableProduct extends StatelessWidget { + UploadedTableProduct({super.key, required this.child}); + Widget child; + + @override + Widget build(BuildContext context) { + return Expanded( + child: ListView( + children: [ + SizedBox( + height: 0.7.sh, + + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0.w), + child: Container( + height: 43.h, + width: 1.sw, + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(15), + topRight: Radius.circular(15))), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex:1, + child: CustomText( + text: "#", + fontSize: 9.sp, + align: TextAlign.start, + fontWeight: FontWeight.w700, + ), + ), + Expanded( + flex:2, + child: CustomText( + text: "Product", + fontSize: 9.sp, + align: TextAlign.start, + fontWeight: FontWeight.w700, + ), + ), + Expanded( + flex:2, + child: CustomText( + text: "ProductType", + fontSize: 9.sp, + align: TextAlign.start, + fontWeight: FontWeight.w700, + ), + ), + Expanded( + flex:2, + child: CustomText( + text: "View(s)", + fontSize: 9.sp, + align: TextAlign.start, + fontWeight: FontWeight.w700, + ), + ), + + ], + ) + + ), + ), + Expanded(child: child) + + ], + ), + + ), + ]), + ); + } +} \ No newline at end of file diff --git a/lib/features/upload_product/units/uploaded.dart b/lib/features/upload_product/units/uploaded.dart index 4a9d8db..ab2b94e 100644 --- a/lib/features/upload_product/units/uploaded.dart +++ b/lib/features/upload_product/units/uploaded.dart @@ -1,25 +1,59 @@ part of '../view.dart'; -class Uploaded extends StatelessWidget { +class Uploaded extends StatefulWidget { const Uploaded({Key? key}) : super(key: key); @override - Widget build(BuildContext context) { - return CustomCard( - widget: Padding( - padding: EdgeInsets.symmetric(horizontal: 11.sp), - child: Column( - children: [ - SizedBox(height: 18.h,), - CustomCardTitle(text: 'UPLOADED PRODUCTS',), - CustomNoContainer(text: 'products'), - const Spacer(), - const Button() + State createState() => _UploadedState(); +} +class _UploadedState extends State { + @override + void initState() { + // TODO: implement initState + super.initState(); + ProductsCubit.get(context).addProductCubitTest(context: context); + } + + @override + Widget build(BuildContext context) { + return BlocConsumer( + listener: (BuildContext context, Object? state) {}, + builder: (context, state) { + return ProductsCubit.get(context).testLoading + ? const Expanded( + child: Center( + child: CircularProgressIndicator( + color: ColorManager.yellow, + ))) + : ProductsCubit.get(context).isAccessToken + ? CustomCard( + widget: Padding( + padding: EdgeInsets.symmetric(horizontal: 11.sp), + child: Column( + children: [ + SizedBox( + height: 18.h, + ), + CustomCardTitle( + text: 'UPLOADED PRODUCTS', + ), - ], - ), - ), - ); + ProductsCubit.get(context).myProductList.isEmpty + ? Expanded( + child: Column( + children: [ + CustomNoContainer(text: 'products'), + ], + ), + ) + : const MyProductTable(), + Button() + ], + ), + ), + ) + : UpgradeMember(); + }); } } diff --git a/lib/features/upload_product/view.dart b/lib/features/upload_product/view.dart index e26a0cd..8686de0 100644 --- a/lib/features/upload_product/view.dart +++ b/lib/features/upload_product/view.dart @@ -1,21 +1,31 @@ import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:hoga_load/core/color_manager/color_manager.dart'; +import 'package:hoga_load/features/search_product/cubit/getProduct_cubit.dart'; +import 'package:hoga_load/features/upload_product/units/button.dart'; +import 'package:hoga_load/features/upload_product/units/table_data.dart'; import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; -import 'package:hoga_load/widgets/widgets/custom_button.dart'; -import 'package:hoga_load/widgets/widgets/custom_row.dart'; import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; -import 'package:hoga_load/widgets/widgets/custom_text.dart'; - +import 'package:hoga_load/widgets/widgets/upgrade_member_ship.dart'; +import '../../core/color_manager/color_manager.dart'; import '../../core/widgets/custom_card.dart'; import '../../core/widgets/custom_card_title.dart'; import '../../core/widgets/custom_no_container.dart'; -import '../advertisements/view.dart'; - +import '../search_product/cubit/getProduct__states.dart'; part 'units/uploaded.dart'; -class UploadProductsView extends StatelessWidget { +class UploadProductsView extends StatefulWidget { const UploadProductsView({Key? key}) : super(key: key); + @override + State createState() => _UploadProductsViewState(); +} + +class _UploadProductsViewState extends State { + @override + void initState() { + super.initState(); + ProductsCubit.get(context).getProduct(self: 1); + } @override Widget build(BuildContext context) { return CustomScaffold( @@ -23,7 +33,7 @@ class UploadProductsView extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ CustomAppbar(title: 'Uploaded Products'), - Expanded(child: const Uploaded()), + const Expanded(child: Uploaded()), ], ), ); diff --git a/lib/features/upload_vehicles/units/uploaded.dart b/lib/features/upload_vehicles/units/uploaded.dart deleted file mode 100644 index 2a506bd..0000000 --- a/lib/features/upload_vehicles/units/uploaded.dart +++ /dev/null @@ -1,26 +0,0 @@ -part of '../view.dart'; - -class Uploaded extends StatelessWidget { - const Uploaded({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return CustomCard( - widget: Padding( - padding: EdgeInsets.symmetric(horizontal: 11.sp), - child: Column( - children: [ - SizedBox(height: 18.h,), - CustomCardTitle(text: 'UPLOADED Vehicles',), - CustomNoContainer(text: 'vehicles'), - const Spacer(), - const Button() - - - ], - ), - ), - ); - - } -} diff --git a/lib/features/upload_vehicles/view.dart b/lib/features/upload_vehicles/view.dart deleted file mode 100644 index 426810a..0000000 --- a/lib/features/upload_vehicles/view.dart +++ /dev/null @@ -1,31 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:hoga_load/core/color_manager/color_manager.dart'; -import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; -import 'package:hoga_load/widgets/widgets/custom_button.dart'; -import 'package:hoga_load/widgets/widgets/custom_row.dart'; -import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; -import 'package:hoga_load/widgets/widgets/custom_text.dart'; - -import '../../core/widgets/custom_card.dart'; -import '../../core/widgets/custom_card_title.dart'; -import '../../core/widgets/custom_no_container.dart'; - -part 'units/uploaded.dart'; -part 'units/button.dart'; -class UploadVehiclesView extends StatelessWidget { - const UploadVehiclesView({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return CustomScaffold( - body: - Column( - children: [ - CustomAppbar(title: 'Uploadeconst d VEHICLES'), - const Expanded(child: Uploaded()), - ], - ), - ); - } -} \ No newline at end of file diff --git a/lib/features/add_vehicle/units/attributes.dart b/lib/features/vehicles/add_vehicle/units/attributes.dart similarity index 71% rename from lib/features/add_vehicle/units/attributes.dart rename to lib/features/vehicles/add_vehicle/units/attributes.dart index 76900a7..0e4321a 100644 --- a/lib/features/add_vehicle/units/attributes.dart +++ b/lib/features/vehicles/add_vehicle/units/attributes.dart @@ -2,6 +2,9 @@ part of '../view.dart'; class Attributes extends StatelessWidget { bool value2 = false; + Vehicles? vehiclesModel; + bool? isEdit; + Attributes({super.key,this.vehiclesModel,this.isEdit=false}); @override Widget build(BuildContext context) { return Column( @@ -30,10 +33,15 @@ class Attributes extends StatelessWidget { physics: const NeverScrollableScrollPhysics(), gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, childAspectRatio: 5), - itemCount: VehiclesCubit.get(context).attributesList.length, + itemCount:VehiclesCubit.get(context).attributesList.length, itemBuilder: (BuildContext context, int index) { return CustomCheckBox( - value: value2, + index: index, + boxKey: MasterKeys.attributes.name, + value: isEdit!? + vehiclesModel!.attributes2! + .contains(VehiclesCubit.get(context).attributesList[index].title) + ?true:value2: value2, text: VehiclesCubit.get(context).attributesList[index].title); }, ), diff --git a/lib/features/add_load/units/equipment.dart b/lib/features/vehicles/add_vehicle/units/equipment.dart similarity index 69% rename from lib/features/add_load/units/equipment.dart rename to lib/features/vehicles/add_vehicle/units/equipment.dart index 500f7e4..31e56dc 100644 --- a/lib/features/add_load/units/equipment.dart +++ b/lib/features/vehicles/add_vehicle/units/equipment.dart @@ -1,6 +1,10 @@ part of '../view.dart'; + class Equipment extends StatelessWidget { var value=false; + Vehicles? vehiclesModel; + bool? isEdit; + Equipment({super.key,this.vehiclesModel,this.isEdit=false}); @override Widget build(BuildContext context) { @@ -21,7 +25,13 @@ class Equipment extends StatelessWidget { itemCount: VehiclesCubit.get(context).equipmentList.length, itemBuilder: (BuildContext context, int index) { return CustomCheckBox( - value: value, + + index: index, + boxKey: MasterKeys.equipmentTypes.name, + value:isEdit!? + vehiclesModel!.equipmentTypes2! + .contains(VehiclesCubit.get(context).equipmentList[index].title) + ?true:value: value, text: VehiclesCubit.get(context).equipmentList[index].title); }, ), diff --git a/lib/features/vehicles/add_vehicle/units/form.dart b/lib/features/vehicles/add_vehicle/units/form.dart new file mode 100644 index 0000000..be9d579 --- /dev/null +++ b/lib/features/vehicles/add_vehicle/units/form.dart @@ -0,0 +1,544 @@ +part of '../view.dart'; + +class FormInfo extends StatefulWidget { + FormInfo({Key? key,this.isFilter=false,this.vehiclesModel,this.isEdit=false,this.index}) : super(key: key); + bool isFilter; + Vehicles? vehiclesModel; + bool isEdit; + int? index; + @override + State createState() => _FormInfoState(); +} + +class _FormInfoState extends State { + String countryOrigin = ''; + String stateOrigin = ''; + String cityOrigin = ''; + String countryDestination = ''; + String stateDestination = ''; + String cityDestination = ''; + String day = ''; + String month = ''; + String year = ''; + String date = ''; + + @override + void initState() { + super.initState(); + if(widget.isEdit){ + date=widget.vehiclesModel!.availabilityDate!; + cityDestination=widget.vehiclesModel!.destinationCity!.title!; + cityOrigin=widget.vehiclesModel!.originCity!.title!; + countryDestination=widget.vehiclesModel!.destinationCountry!.title!; + countryOrigin=widget.vehiclesModel!.originCountry!.title!; + stateDestination=widget.vehiclesModel!.destinationState!.title!; + stateOrigin=widget.vehiclesModel!.originState!.title!; + + DataFormCubit.get(context).cityDestinationID=widget.vehiclesModel!.destinationCity!.id!.toString(); + DataFormCubit.get(context).cityOriginID=widget.vehiclesModel!.originCity!.id!.toString(); + DataFormCubit.get(context).cityDestinationID=widget.vehiclesModel!.destinationCountry!.id!.toString(); + DataFormCubit.get(context).countryOriginID=widget.vehiclesModel!.originCountry!.id!.toString(); + DataFormCubit.get(context).stateDestinationID=widget.vehiclesModel!.destinationState!.id!.toString(); + DataFormCubit.get(context).stateOriginID=widget.vehiclesModel!.originState!.id!.toString(); + DataFormCubit.get(context).dateTime=widget.vehiclesModel!.availabilityDate!; + + VehiclesCubit.get(context).weightController.text=widget.vehiclesModel!.weight!; + VehiclesCubit.get(context).instructionsController.text=widget.vehiclesModel!.instructions==null?"": + VehiclesCubit.get(context).instructionsController.text=widget.vehiclesModel!.instructions.toString(); + + +// VehiclesCubit.get(context).equipmentBoxValue![widget.index!]==null?true:null; +// VehiclesCubit.get(context).attributesBoxValue![widget.index!]==null?true:null; +// //VehiclesCubit.get(context).vehcleSizeBoxValue![widget.index!]==null?true:null; +// print(VehiclesCubit.get(context).vehcleSizeBoxValue!.length); +// print(widget.index!); +// print('nda'); + + // VehiclesCubit.get(context).vehcleTypeBoxValue![widget.index!]=true; + + + + + }else{ + //VehiclesCubit.get(context).equipmentBoxValue=List.filled(VehiclesCubit.get(context).equipmentList.length,false); + // VehiclesCubit.get(context).attributesBoxValue=List.filled(VehiclesCubit.get(context).attributesList.length,false); + // VehiclesCubit.get(context).vehcleTypeBoxValue=List.filled(VehiclesCubit.get(context).vehiclesTypeList.length,false); + // VehiclesCubit.get(context).vehcleSizeBoxValue=List.filled(VehiclesCubit.get(context).vehicleSizeList.length,false); + + } + } + @override + Widget build(BuildContext context) { + return CustomCard( + widget: BlocConsumer( + listener: (BuildContext context, state) { }, + builder: (BuildContext context, state) { + + return Column( + children: [ + Padding( + padding: EdgeInsets.symmetric(vertical: 17.h, horizontal: 14.w), + child:widget.isFilter? + const SizedBox(): + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + const Icon(Icons.arrow_back_sharp), + Expanded( + child: CustomText( + text: 'ADD VEHICLE', + fontSize: 18.sp, + fontWeight: FontWeight.w700, + ), + ) + ], + ), + ), + widget.isFilter? + const SizedBox(): SizedBox( + width: 1.sw, + child: const Divider( + thickness: 1, + ), + ), + widget.isFilter? + const SizedBox():CustomTextField( + height: 64.h, + readOnly: true, + name: 'Availability Date', + hintText: + date == '' ? 'dd-mm-yy' : date, + suffixIcon: InkWell( + onTap: () async { + DateTime? newDate = await showDatePicker( + context: context, + firstDate: DateTime(1000), + lastDate: DateTime(3000), + initialDate: DateTime.now()); + if (newDate == null) return; + day = newDate.day.toString(); + month = newDate.month.toString(); + year = newDate.year.toString(); + + date = '$day/$month/$year'; + setState(() { + DataFormCubit.get(context).dateTime = date; + }); + }, + child: const Icon(Icons.date_range_outlined)), + ), + + CustomTextField( + height: 64.h, + readOnly: true, + name: 'Original Country', + hintText: + countryOrigin == '' ? 'Select a Country' : countryOrigin, + suffixIcon: InkWell( + onTap: () { + showModalBottomSheet( + context: context, + builder: (context) { + return ListView.builder( + itemCount: + DataFormCubit.get(context).countryList.length, + itemBuilder: (context, index) => Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + InkWell( + onTap: () { + setState(() { + countryOrigin = + DataFormCubit.get(context) + .countryList[index] + .title!; + Navigator.of(context).pop(); + DataFormCubit.get(context).countryOriginID=DataFormCubit.get(context) + .countryList[index] + .id!.toString(); + cityOrigin=''; + stateOrigin=''; + DataFormCubit.get(context).cityOriginID=''; + DataFormCubit.get(context).stateOriginID=''; + + }); + DataFormCubit.get(context).getState( + DataFormCubit.get(context) + .countryList[index] + .id!); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child:DataFormCubit.get(context).countryList[index].title==null? + const Center(child: CircularProgressIndicator(color: Colors.green,),): Text( + DataFormCubit.get(context) + .countryList[index] + .title!, + style: TextStyle( + color: Colors.black, + fontSize: 20.sp), + ), + ), + ), + ], + )); + }, + ); + }, + child: Icon( + Icons.expand_more, + size: 30.sp, + color: ColorManager.blackColor, + ), + )), + state is GetStateLoading? + CustomText(text: 'Loading....',): + CustomTextField( + height: 64.h, + readOnly: true, + name: 'Original State', + hintText: stateOrigin == '' ? 'Select a state' : stateOrigin, + suffixIcon: InkWell( + onTap: () { + showModalBottomSheet( + context: context, + builder: (context) { + return ListView.builder( + itemCount: + DataFormCubit.get(context).stateList.length, + itemBuilder: (context, index) => Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + InkWell( + onTap: () { + setState(() { + stateOrigin = DataFormCubit.get(context) + .stateList[index] + .title!; + Navigator.of(context).pop(); + DataFormCubit.get(context).stateOriginID=DataFormCubit.get(context) + .stateList[index] + .id!.toString(); + cityOrigin=''; + DataFormCubit.get(context).cityOriginID=''; + + }); + print('sssssssss'); + DataFormCubit.get(context).getCity + (DataFormCubit.get(context) + .stateList[index] + .title!); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: DataFormCubit.get(context) + .stateList[index] + .title == + null + ? const Center( + child: CircularProgressIndicator( + color: Colors.green, + ), + ) + : Text( + DataFormCubit.get(context) + .stateList[index] + .title!, + style: TextStyle( + color: Colors.black, + fontSize: 20.sp), + ), + ), + ), + ], + )); + }, + ); + }, + child: Icon( + Icons.expand_more, + size: 30.sp, + color: ColorManager.blackColor, + ), + )), + state is GetCityLoading? + CustomText(text: 'Loading....',): + CustomTextField( + height: 64.h, + readOnly: true, + name: 'Original City', + hintText: cityOrigin == '' ? 'Select a city' : cityOrigin, + suffixIcon: InkWell( + onTap: () { + showModalBottomSheet( + context: context, + builder: (context) { + return ListView.builder( + itemCount: DataFormCubit.get(context).cityList.length, + itemBuilder: (context, index) => Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + InkWell( + onTap: () { + setState(() { + cityOrigin = DataFormCubit.get(context) + .cityList[index] + .title!; + Navigator.of(context).pop(); + DataFormCubit.get(context).cityOriginID=DataFormCubit.get(context) + .cityList[index] + .id!.toString(); + }); + + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: DataFormCubit.get(context) + .cityList[index] + .title == + null + ? const Center( + child: CircularProgressIndicator( + color: Colors.green, + ), + ) + : Text( + DataFormCubit.get(context) + .cityList[index] + .title!, + style: TextStyle( + color: Colors.black, + fontSize: 20.sp), + ), + ), + ), + ], + )); + }, + ); + }, + child: Icon( + Icons.expand_more, + size: 30.sp, + color: ColorManager.blackColor, + ), + )), + CustomTextField( + height: 64.h, + readOnly: true, + name: 'Destination Country', + hintText: countryDestination == '' + ? 'Select a country' + : countryDestination, + suffixIcon: InkWell( + onTap: () { + showModalBottomSheet( + context: context, + builder: (context) { + return ListView.builder( + itemCount: + DataFormCubit.get(context).countryList.length, + itemBuilder: (context, index) => Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + InkWell( + onTap: () { + setState(() { + countryDestination = + DataFormCubit.get(context) + .countryList[index] + .title!; + Navigator.of(context).pop(); + DataFormCubit.get(context).countryDestinationID=DataFormCubit.get(context) + .countryList[index] + .id!.toString(); + cityDestination=''; + stateDestination=''; + DataFormCubit.get(context).cityDestinationID=''; + DataFormCubit.get(context).cityOriginID=''; + + + }); + DataFormCubit.get(context).getDestintionState( DataFormCubit.get(context) + .countryList[index] + .id!); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: DataFormCubit.get(context) + .countryList[index] + .title == + null + ? const Center( + child: CircularProgressIndicator( + color: Colors.green, + ), + ) + : Text( + DataFormCubit.get(context) + .countryList[index] + .title!, + style: TextStyle( + color: Colors.black, + fontSize: 20.sp), + ), + ), + ), + ], + )); + }, + ); + }, + child: Icon( + Icons.expand_more, + size: 30.sp, + color: ColorManager.blackColor, + ), + )), + state is GetDestintionStateLoading? + CustomText(text: 'Loading....',):CustomTextField( + height: 64.h, + readOnly: true, + name: 'Destination State', + hintText: + stateDestination == '' ? 'Select a state' : stateDestination, + suffixIcon: InkWell( + onTap: () { + showModalBottomSheet( + context: context, + builder: (context) { + return ListView.builder( + itemCount: + DataFormCubit.get(context).stateList.length, + itemBuilder: (context, index) => Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + InkWell( + onTap: () { + setState(() { + stateDestination = + DataFormCubit.get(context) + .stateList[index] + .title!; + Navigator.of(context).pop(); + DataFormCubit.get(context).stateDestinationID=DataFormCubit.get(context) + .stateList[index] + .id!.toString(); + cityDestination=''; + DataFormCubit.get(context).cityDestinationID=''; + + + }); + DataFormCubit.get(context).getDestintionCity( DataFormCubit.get(context) + .stateList[index] + .title!); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: DataFormCubit.get(context) + .stateList[index] + .title == + null + ? const Center( + child: CircularProgressIndicator( + color: Colors.green, + ), + ) + : Text( + DataFormCubit.get(context) + .stateList[index] + .title!, + style: TextStyle( + color: Colors.black, + fontSize: 20.sp), + ), + ), + ), + ], + )); + }, + ); + }, + child: Icon( + Icons.expand_more, + size: 30.sp, + color: ColorManager.blackColor, + ), + )), + state is GetDestintionCityLoading? + CustomText(text: 'Loading....',):CustomTextField( + height: 64.h, + name: 'Destination City', + hintText: + cityDestination == '' ? 'Select a city' : cityDestination, + readOnly: true, + suffixIcon: InkWell( + onTap: () { + showModalBottomSheet( + context: context, + builder: (ctx) { + return ListView.builder( + itemCount: DataFormCubit.get(context).cityList.length, + itemBuilder: (context, index) => Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + InkWell( + onTap: () { + setState(() { + cityDestination = + DataFormCubit.get(context) + .cityList[index] + .title!; + Navigator.of(context).pop(); + DataFormCubit.get(context).cityDestinationID=DataFormCubit.get(context) + .cityList[index] + .id!.toString(); + }); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: DataFormCubit.get(context) + .cityList[index] + .title == + null + ? const Center( + child: CircularProgressIndicator( + color: Colors.green, + ), + ) + : Text( + DataFormCubit.get(context) + .cityList[index] + .title!, + style: TextStyle( + color: Colors.black, + fontSize: 20.sp), + ), + ), + ), + ], + )); + }, + ); + }, + child: Icon( + Icons.expand_more, + size: 30.sp, + color: ColorManager.blackColor, + ), + )), + + SizedBox( + width: 1.sw, + child: const Divider( + thickness: 1, + ), + ), + ], + ); + }, + ), + ); + } +} + diff --git a/lib/features/add_load/units/instructon.dart b/lib/features/vehicles/add_vehicle/units/instructon.dart similarity index 72% rename from lib/features/add_load/units/instructon.dart rename to lib/features/vehicles/add_vehicle/units/instructon.dart index e891e8b..24c7e45 100644 --- a/lib/features/add_load/units/instructon.dart +++ b/lib/features/vehicles/add_vehicle/units/instructon.dart @@ -12,21 +12,19 @@ class Instructions extends StatelessWidget { CustomTextField( height: 64.h, hintText: 'Weight ( in Kilogram )', - suffixIcon: Icon( - Icons.expand_more, - size: 30.sp, - color: ColorManager.blackColor, - ), + keyboardType: TextInputType.number, + controller: VehiclesCubit.get(context).weightController, ), CustomTextField( height: 147.h, lines: 4, hintText: 'Instructions', + controller: VehiclesCubit.get(context).instructionsController, ), SizedBox( height: 23.h, ), - CustomButton(text: 'Add new load', color: ColorManager.orange), ], + ], ); } } diff --git a/lib/features/add_vehicle/units/vehicle_type.dart b/lib/features/vehicles/add_vehicle/units/vehicle_type.dart similarity index 68% rename from lib/features/add_vehicle/units/vehicle_type.dart rename to lib/features/vehicles/add_vehicle/units/vehicle_type.dart index 0e771f4..29696ec 100644 --- a/lib/features/add_vehicle/units/vehicle_type.dart +++ b/lib/features/vehicles/add_vehicle/units/vehicle_type.dart @@ -2,6 +2,9 @@ part of '../view.dart'; class VehicleType extends StatelessWidget { bool value3 = false; + Vehicles? vehiclesModel; + bool? isEdit; + VehicleType({super.key,this.vehiclesModel,this.isEdit=false}); @override Widget build(BuildContext context) { return Column( @@ -27,7 +30,13 @@ class VehicleType extends StatelessWidget { itemCount: VehiclesCubit.get(context).vehiclesTypeList.length, itemBuilder: (BuildContext context, int index) { return CustomCheckBox( - value: value3, + index: index, + boxKey: MasterKeys.vehicleTypes.name, + value: isEdit!? + vehiclesModel!.vehicleTypes2! + .contains(VehiclesCubit.get(context).vehiclesTypeList[index].title) + ?true:value3: value3, + // value: VehiclesCubit.get(context).vehcleTypeBoxValue![index], text: VehiclesCubit.get(context).vehiclesTypeList[index].title); }, diff --git a/lib/features/vehicles/add_vehicle/units/vehicles_size.dart b/lib/features/vehicles/add_vehicle/units/vehicles_size.dart new file mode 100644 index 0000000..d633f0f --- /dev/null +++ b/lib/features/vehicles/add_vehicle/units/vehicles_size.dart @@ -0,0 +1,79 @@ +part of '../view.dart'; + +class VehiclesSize extends StatefulWidget { + Vehicles? vehiclesModel; + bool? isEdit; + VehiclesSize({super.key, this.vehiclesModel, this.isEdit = false}); + + @override + State createState() => _VehiclesSizeState(); +} + +class _VehiclesSizeState extends State { + bool value4 = false; + + @override + Widget build(BuildContext context) { + return Column(children: [ + SizedBox( + width: 1.sw, + child: const Divider( + thickness: 1, + ), + ), + Column( + children: [ + Row( + children: [ + CustomText( + text: ' VEHICLE SIZES', + fontSize: 14.sp, + fontWeight: FontWeight.w600, + ) + ], + ), + SizedBox( + height: 14.h, + ), + SizedBox( + child: GridView.builder( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, childAspectRatio: 5), + itemCount: VehiclesCubit.get(context).vehicleSizeList.length, + itemBuilder: (BuildContext context, int index) { + widget.isEdit! && + widget.vehiclesModel!.vehicleSizes2!.contains( + VehiclesCubit.get(context) + .vehicleSizeList[index] + .title) + ? VehiclesCubit.get(context).vehcleSize.add( + VehiclesCubit.get(context) + .vehicleSizeList[index] + .id! + .toString()) + : null; + return CustomCheckBox( + index: index, + boxKey: MasterKeys.vehicleSize.name, + // value: VehiclesCubit.get(context).vehcleSizeBoxValue![index], + value: widget.isEdit! + ? widget.vehiclesModel!.vehicleSizes2!.contains( + VehiclesCubit.get(context) + .vehicleSizeList[index] + .title) + ? true + : value4 + : value4, + text: VehiclesCubit.get(context) + .vehicleSizeList[index] + .title); + }, + ), + ), + ], + ) + ]); + } +} diff --git a/lib/features/add_vehicle/view.dart b/lib/features/vehicles/add_vehicle/view.dart similarity index 53% rename from lib/features/add_vehicle/view.dart rename to lib/features/vehicles/add_vehicle/view.dart index e4bbca4..7d06f34 100644 --- a/lib/features/add_vehicle/view.dart +++ b/lib/features/vehicles/add_vehicle/view.dart @@ -1,8 +1,8 @@ -import 'package:date_time_picker/date_time_picker.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:hoga_load/core/color_manager/color_manager.dart'; +import 'package:hoga_load/core/data/models/vehicle/vehicles.dart'; import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; import 'package:hoga_load/widgets/widgets/custom_button.dart'; @@ -11,31 +11,40 @@ import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; import 'package:hoga_load/widgets/widgets/custom_text.dart'; import 'package:hoga_load/widgets/widgets/custom_text_field.dart'; -import '../../core/widgets/custom_card.dart'; -import 'cubit/getDataForm_cubit.dart'; -import 'cubit/getVehicle_cubit.dart'; -import 'cubit/getVehicle_states.dart'; +import '../../../core/keys/keys.dart'; +import '../../../core/master_cubit/getDataForm_cubit.dart'; +import '../../../core/master_cubit/getDataForm_state.dart'; +import '../../../core/widgets/custom_card.dart'; +import '../get_vehicles/cubit/vehicle_cubit.dart'; +import '../get_vehicles/cubit/vehicle_states.dart'; + -part 'units/form.dart'; -part 'units/equipment.dart'; part 'units/attributes.dart'; +part 'units/equipment.dart'; +part 'units/form.dart'; +part 'units/instructon.dart'; part 'units/vehicle_type.dart'; part 'units/vehicles_size.dart'; -part 'units/instructon.dart'; class AddVehiclesView extends StatelessWidget { - const AddVehiclesView({Key? key}) : super(key: key); - + AddVehiclesView({Key? key,this.vehiclesModel,this.isEdit=false,this.index}) : super(key: key); + Vehicles? vehiclesModel; + bool isEdit; + int? index; @override Widget build(BuildContext context) { return CustomScaffold( body: SafeArea( - child: BlocConsumer( - listener: (BuildContext context, state) { }, + child: BlocConsumer( + listener: (BuildContext context, state) { + if(state is AddSuccess){ + Navigator.pop(context); + } + }, builder: (context,state) { return Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - CustomAppbar(title: 'Add a New Vehicle'), + CustomAppbar(title:isEdit?"Edit Vehicle": 'Add a New Vehicle'), Expanded( child: SingleChildScrollView( physics: const BouncingScrollPhysics(), @@ -43,31 +52,42 @@ class AddVehiclesView extends StatelessWidget { padding: const EdgeInsets.all(8.0), child: Column( children: [ - const Padding( - padding: EdgeInsets.only(top:22), - child: FormInfo(), + Padding( + padding: const EdgeInsets.only(top:22), + child: + FormInfo(vehiclesModel: vehiclesModel,isEdit: isEdit,index: index,), ), Padding( padding: const EdgeInsets.only(top:22), - child: Equipment(), + child: Equipment(vehiclesModel: vehiclesModel,isEdit:isEdit), ), Padding( padding: const EdgeInsets.only(top:22), - child: Attributes(), + child: Attributes(vehiclesModel: vehiclesModel,isEdit:isEdit), ), Padding( padding: const EdgeInsets.only(top:22), - child: VehicleType(), + child: VehicleType(vehiclesModel: vehiclesModel,isEdit:isEdit), ), - Padding( padding: const EdgeInsets.only(top:22), - child: VehiclesSize(), + child: VehiclesSize(vehiclesModel: vehiclesModel,isEdit:isEdit), ), const Padding( padding: EdgeInsets.only(top:22), child: Instructions(), ), + InkWell( + onTap: ()async{ + isEdit==false? + await VehiclesCubit.get(context).addVehicleCubit(context:context): + await VehiclesCubit.get(context).editVehicleCubit + (context:context,vehicleId:vehiclesModel!.id); + + }, + child: CustomButton(text: + isEdit?"Edit Vehicle": 'Add new vehicle', color: ColorManager.yellow)), + ], ), ), diff --git a/lib/features/vehicles/get_vehicles/cubit/vehicle_cubit.dart b/lib/features/vehicles/get_vehicles/cubit/vehicle_cubit.dart new file mode 100644 index 0000000..22436aa --- /dev/null +++ b/lib/features/vehicles/get_vehicles/cubit/vehicle_cubit.dart @@ -0,0 +1,351 @@ + +import 'package:bloc/bloc.dart'; +import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:hoga_load/core/data/models/response.dart'; +import 'package:hoga_load/core/data/repository/vehicle_repo.dart'; +import 'package:hoga_load/core/keys/keys.dart'; +import '../../../../core/data/models/vehicle/Addvehicle_model.dart'; +import '../../../../core/data/models/vehicle/vehicles.dart'; +import '../../../../core/dialoges/toast.dart'; +import '../../../../core/master_cubit/getDataForm_cubit.dart'; +import 'vehicle_states.dart'; + +class VehiclesCubit extends Cubit { + VehiclesCubit() : super(VehicleLoading()); + + static VehiclesCubit get(context) => BlocProvider.of(context); + TextEditingController weightController=TextEditingController(); + TextEditingController instructionsController=TextEditingController(); + + Connectivity connectivity = Connectivity(); + List attributesList = []; + List equipmentList = []; + List vehicleSizeList = []; + List vehiclesTypeList = []; + ListsearchList=[]; + ListvehicleList=[]; + ListmyVehicleList=[]; + + + //checkBoxlist + List equipmentType=[]; + List attributes=[]; + List vehcleType=[]; + List vehcleSize=[]; + + + +bool isAccessToken=true; + bool testLoading=true; + bool myVehiclesLoading=true; + + + + getAttributesCubit() { + + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + } else { + VehicleRepo.getData('masters/attributes') + .then((value) => { + print('..................................'), + print(value), + attributesList = value, + emit(GetAttributesSuccess(value)), + // attributesBoxValue=List.filled(attributesList.length, false), + + }) + .onError((error, stackTrace) => + {emit(GetAttributesFailed(error.toString())), print(error)}); + } + }); + } + getEquipmentsCubit() { + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + } else { + VehicleRepo.getData('masters/equipment-types') + .then((value) => { + print('..................................'), + print(value), + equipmentList = value, + emit(GetEquipmentSuccess(value)), + //equipmentBoxValue=List.filled(equipmentList.length, false), + + }) + .onError((error, stackTrace) => + {emit(GetEquipmentFailed(error.toString())), print(error)}); + } + }); + } + getVehicleSizesCubit() { + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + } else { + VehicleRepo.getData('masters/vehicle-sizes') + .then((value) => { + print('..................................'), + print(value), + vehicleSizeList = value, + emit(GetVehicleSizeSuccess(value)), + // vehcleSizeBoxValue=List.filled(vehicleSizeList.length, false), + + }) + .onError((error, stackTrace) => + {emit(GetVehicleSizeFailed(error.toString())), print(error)}); + } + }); + } + getVehicleTypesCubit() { + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + } else { + VehicleRepo.getData('masters/vehicle-types') + .then((value) => { + print('..................................'), + print(value), + vehiclesTypeList = value, + emit(GetVehiclesTypeSuccess(value)), + //vehcleTypeBoxValue=List.filled(vehiclesTypeList.length, false), + + }) + .onError((error, stackTrace) => + {emit(GetVehiclesTypeFailed(error.toString())), print(error)}); + } + }); + } + vehicleClearData(context){ + equipmentType.clear(); + attributes.clear(); + vehcleType.clear(); + vehcleSize.clear(); + DataFormCubit.get(context).cityOriginID=''; + DataFormCubit.get(context).countryOriginID=''; + DataFormCubit.get(context).countryDestinationID=''; + DataFormCubit.get(context).stateDestinationID=''; + DataFormCubit.get(context).stateOriginID=''; + DataFormCubit.get(context).cityDestinationID=''; + } + changeCheckBox(boxKey,index,val){ + + if(boxKey==MasterKeys.vehicleSize.name){ + val?vehcleSize.add(vehicleSizeList[index].id):vehcleSize.remove(vehicleSizeList[index].id); + } + if(boxKey==MasterKeys.vehicleTypes.name){ + val?vehcleType.add(vehiclesTypeList[index].id):vehcleType.remove(vehiclesTypeList[index].id); + } + if(boxKey==MasterKeys.attributes.name){ + val?attributes.add(attributesList[index].id):attributes.remove(attributesList[index].id); + } + if(boxKey==MasterKeys.equipmentTypes.name){ + val?equipmentType.add(equipmentList[index].id):equipmentType.remove(equipmentList[index].id); + } + // emit(ChangeBox()); + + print(vehcleSize); + print(attributes); + print(equipmentType); + print(vehcleType); + + print('+++++++++++++++++++++++++++++++++++'); + } + + getVehicleCubit({self}){ + myVehiclesLoading=true; + emit(VehicleLoading()); + connectivity.checkConnectivity().then((value)async{ + if(ConnectivityResult.none == value){ + emit(NetworkFailed("Check your internet connection and try again")); + }else{ + VehicleRepo.getVehicles(self).then((value) => { + myVehiclesLoading=false, + + print(value), + if(self==1){ + myVehicleList=value, + print('Get Vehice Response'), + print(myVehicleList.length), + + }else{ + vehicleList=value, + emit(GetVehicleSuccess(value)) + + }, + }).onError((error, stackTrace) => { + myVehiclesLoading=true, + + emit(GetVehicleFailed(error.toString())), + print(error) + + }); + } + + }); + } + searchVehicles(context,{val,equipmentSize2,attributes2,vehicleSize2,vehicleType2}) { + searchList.clear(); + print("cubit"); + print(equipmentSize2); + print(vehicleSize2); + + + connectivity.checkConnectivity().then((value)async{ + if(ConnectivityResult.none == value){ + emit(NetworkFailed("Check your internet connection and try again")); + }else{ + VehicleRepo.searchVehicles(search: val,equipmentSize: equipmentSize2,vehicleSize: vehicleSize2, + attributes: attributes2,vehicleType: vehicleType2,context: context).then((value) => { + print('..................................'), + print(value), + print("value2"), + + if(value.isNotEmpty){ + print("value"), + print('..................................'), + print(value), + searchList=value, + emit(GetSearchSuccess(searchList)), + vehicleClearData(context), + + + }else{ + emit(GetSearchFailed('Nothing found try again')), + vehicleClearData(context), + + } + + }).onError((error, stackTrace) => { + emit(GetSearchFailed(error.toString())), + vehicleClearData(context), + print(error) + + }); + } + + }); + } + + + + deleteVehicleCubit(vehicleId){ + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + } else { + VehicleRepo.deleteVehicle(vehicleId) + .then((value) => { + print('Delete Vehicle Success'), + print(value), + + emit(DeleteSuccess()), + showToast(msg: 'Delete Success', state: ToastedStates.SUCCESS), + + }) + .onError((error, stackTrace) => + {emit(DeleteFailed()), + print(error), + showToast(msg: error.toString(), state: ToastedStates.ERROR), + print('Delete Vehicle Failed'), + }); + } + }); + } + editVehicleCubit({context,vehicleId}){ + + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + } else { + VehicleRepo.editVehicle(context: context,vehicleId:vehicleId) + .then((value) => { + print('Edit Vehicle Success'), + print(value), + + emit(EditSuccess()), + showToast(msg: 'Edit Success', state: ToastedStates.SUCCESS), + + }) + .catchError((error, stackTrace) => + {emit(EditFailed()), + print(error), + showToast(msg: error.toString(), state: ToastedStates.ERROR), + print('Edit Vehicle Failed'), + }); + } + }); + } + + addVehicleCubitTest({context}){ + testLoading=true; + emit(Loading()); + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + showToast(msg: 'Check your internet connection and try again', state: ToastedStates.ERROR); + } else { + VehicleRepo.addVehicleTest(context: context) + .then((value) => { + testLoading=false, + + }).catchError((error) { + + if(error.toString().contains('Unauthorized Access') || + error.toString().contains('no credit left')){ + testLoading=false; + isAccessToken=false; + emit(AddTestFailed(error.toString())); + print('oooooooooooooooooo'); + + } + testLoading=false; + emit(AddTestFailed(error.toString())); + + print('Add Vehicle Test Failed'); + + print(error); + + //showToast(msg: error.toString(), state: ToastedStates.ERROR); + + + }); + } + }); + } + addVehicleCubit({context}){ + + connectivity.checkConnectivity().then((value) async { + if (ConnectivityResult.none == value) { + emit(NetworkFailed("Check your internet connection and try again")); + showToast(msg: "Check your internet connection and try again", state: ToastedStates.ERROR); + + } else { + VehicleRepo.addVehicle(context: context) + .then((value) => { + print('Add Vehicle Success'), + print(value), + emit(AddSuccess()), + vehicleClearData(context), + + showToast(msg: 'Add Success', state: ToastedStates.SUCCESS), + + }).catchError((error) => { + emit(AddFailed(error.toString())), + vehicleClearData(context), + + print('Add Vehicle Failed'), + print(error), + showToast(msg: error.toString(), state: ToastedStates.ERROR), + + }); + } + }); + } + + +} diff --git a/lib/features/vehicles/get_vehicles/cubit/vehicle_states.dart b/lib/features/vehicles/get_vehicles/cubit/vehicle_states.dart new file mode 100644 index 0000000..7842b5b --- /dev/null +++ b/lib/features/vehicles/get_vehicles/cubit/vehicle_states.dart @@ -0,0 +1,118 @@ +import '../../../../core/data/models/vehicle/Addvehicle_model.dart'; +import '../../../../core/data/models/vehicle/vehicles.dart'; + + + + +abstract class VehicleStates{} + +class VehicleLoading extends VehicleStates{} +class ChangeBox extends VehicleStates{} + + + +class AddSuccess extends VehicleStates{ +} +class AddFailed extends VehicleStates{ + String? error; + AddFailed(this.error); +} +class AddTestFailed extends VehicleStates{ + String? error; + AddTestFailed(this.error); +} +class EditSuccess extends VehicleStates{ +} +class EditFailed extends VehicleStates{} +class DeleteSuccess extends VehicleStates{ +} +class DeleteFailed extends VehicleStates{ + +} +class Loading extends VehicleStates{ + +} + +class GetAttributesSuccess extends VehicleStates{ + + ListattributesList=[]; + GetAttributesSuccess(this.attributesList); +} + +class GetAttributesFailed extends VehicleStates{ + + final String msg; + GetAttributesFailed(this.msg); +} + + + +class GetEquipmentSuccess extends VehicleStates{ + + ListequipmentList=[]; + GetEquipmentSuccess(this.equipmentList); +} + +class GetEquipmentFailed extends VehicleStates{ + + final String msg; + GetEquipmentFailed(this.msg); +} + + + +class GetVehicleSizeSuccess extends VehicleStates{ + + ListvehicleSizeList=[]; + GetVehicleSizeSuccess(this.vehicleSizeList); +} + +class GetVehicleSizeFailed extends VehicleStates{ + + final String msg; + GetVehicleSizeFailed(this.msg); +} + + +class GetVehiclesTypeSuccess extends VehicleStates{ + + ListvehiclesTypeList=[]; + GetVehiclesTypeSuccess(this.vehiclesTypeList); +} + +class GetVehiclesTypeFailed extends VehicleStates{ + + final String msg; + GetVehiclesTypeFailed(this.msg); +} +class GetVehicleSuccess extends VehicleStates{ + + ListvehicleList=[]; + GetVehicleSuccess(this.vehicleList); +} +class VehicleListEmpty extends VehicleStates{ + +} + +class GetVehicleFailed extends VehicleStates{ + + final String msg; + GetVehicleFailed(this.msg); +} +class GetSearchSuccess extends VehicleStates{ + + ListvehicleList=[]; + GetSearchSuccess(this.vehicleList); +} + +class GetSearchFailed extends VehicleStates{ + + final String msg; + GetSearchFailed(this.msg); +} + +class NetworkFailed extends VehicleStates{ + + final String msg; + NetworkFailed(this.msg); +} \ No newline at end of file diff --git a/lib/features/vehicles/get_vehicles/details.dart b/lib/features/vehicles/get_vehicles/details.dart new file mode 100644 index 0000000..fd691fa --- /dev/null +++ b/lib/features/vehicles/get_vehicles/details.dart @@ -0,0 +1,30 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import '../../../core/data/models/vehicle/vehicles.dart'; +import '../../../widgets/widgets/custom_appbar.dart'; +import '../../../widgets/widgets/custom_container_vehicle_detail.dart'; +import '../../../widgets/widgets/custom_scaffold.dart'; +class Detail extends StatelessWidget { + Detail(this.vehicle, {super.key}) ; + Vehicles? vehicle; + + @override + Widget build(BuildContext context) { + return CustomScaffold( + body: + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + CustomAppbar(title: 'View Vehicles'), + Expanded(child: Column( + children: [ + Expanded(child: CustomContainerVehicle(vehicle!)), + ], + )), + SizedBox(height: 22.h,) + ], + ), + ); + } +} diff --git a/lib/features/vehicles/get_vehicles/filter_page.dart b/lib/features/vehicles/get_vehicles/filter_page.dart new file mode 100644 index 0000000..d68eef6 --- /dev/null +++ b/lib/features/vehicles/get_vehicles/filter_page.dart @@ -0,0 +1,102 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + +import '../../../core/color_manager/color_manager.dart'; +import '../../../widgets/widgets/custom_appbar.dart'; +import '../../../widgets/widgets/custom_button.dart'; +import '../../../widgets/widgets/custom_scaffold.dart'; +import '../add_vehicle/view.dart'; +import 'cubit/vehicle_cubit.dart'; +import 'cubit/vehicle_states.dart'; +class FilterVehicle extends StatelessWidget { + bool isFilter= true; + @override + Widget build(BuildContext context) { + return CustomScaffold( + body: SafeArea( + child: BlocConsumer( + listener: (BuildContext context, state) { + if(state is GetSearchSuccess||state is GetSearchFailed){ + Navigator.pop(context); + + } + }, + builder: (context,state) { + return Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + CustomAppbar(title: 'Vehicle'), + Expanded( + child: SingleChildScrollView( + physics: const BouncingScrollPhysics(), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Padding( + padding: const EdgeInsets.only(top:22), + child: FormInfo(isFilter:isFilter), + ), + Padding( + padding: const EdgeInsets.only(top:22), + child: Equipment(), + ), + Padding( + padding: const EdgeInsets.only(top:22), + child: Attributes(), + ), + Padding( + padding: const EdgeInsets.only(top:22), + child: VehicleType(), + ), + + Padding( + padding: const EdgeInsets.only(top:22), + child: VehiclesSize(), + ), + Padding( + padding: const EdgeInsets.only(top:22), + child: InkWell( + onTap: ()async{ + await VehiclesCubit.get(context).searchVehicles(context, + equipmentSize2: + VehiclesCubit.get(context).equipmentType.toString() + .replaceAll(",","-").replaceAll("[","").replaceAll("]",""). + replaceAll(" ",""), + attributes2: + VehiclesCubit.get(context).attributes.toString() + .replaceAll(",","-").replaceAll("[","").replaceAll("]",""). + replaceAll(" ",""), + vehicleSize2: + VehiclesCubit.get(context).vehcleSize.toString() + .replaceAll(",","-").replaceAll("[","").replaceAll("]",""). + replaceAll(" ",""), + vehicleType2: + VehiclesCubit.get(context).vehcleType.toString() + .replaceAll(",","-").replaceAll("[","").replaceAll("]",""). + replaceAll(" ","") + + ); + print( + VehiclesCubit.get(context).equipmentType.toString() + .replaceAll(",","-").replaceAll("[","").replaceAll("]",""). + replaceAll(" ","")); + }, + child: CustomButton(text: 'Search', color: ColorManager.yellow)) , + ), + ], + ), + ), + ), + ), + + + + ], + ); + }, + ), + ), + ); + } +} diff --git a/lib/features/vehicles/get_vehicles/units/body.dart b/lib/features/vehicles/get_vehicles/units/body.dart new file mode 100644 index 0000000..83e1ee1 --- /dev/null +++ b/lib/features/vehicles/get_vehicles/units/body.dart @@ -0,0 +1,460 @@ +part of '../view.dart'; + +class Body extends StatelessWidget { + Body({Key? key}) : super(key: key); + List titlesList=[ + 'Available', + 'Origin', + 'State', + 'Destination', + 'State', + 'Type', + 'Size' + ]; + @override + Widget build(BuildContext context) { + return + Expanded( + child: ListView( + children: [ + Container( + height: 0.7.sh, + + child: ListView( + physics: const BouncingScrollPhysics(), + shrinkWrap: true, + scrollDirection: Axis.horizontal, + children: [ + Column( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0.w), + child: Container( + height: 43.h, + width: 0.2.sw * 7, + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(15), + topRight: Radius.circular(15))), + child: ListView.builder( + scrollDirection: Axis.horizontal, + physics: const NeverScrollableScrollPhysics(), + itemCount: 7, + itemBuilder: (context, index) { + return SizedBox( + width: 0.2.sw, + child: CustomText( + text: titlesList[index], + fontSize: 9.sp, + align: TextAlign.start, + fontWeight: FontWeight.w700, + ), + ); + }), + ), + ), + Container( + height: 0.6.sh, + width: 0.2.sw * 7, + child: BlocConsumer( + builder: (context, state) { + if (state is GetSearchFailed) { + return Center( + child: CustomText( + text: state.msg, + fontSize: 30, + )); + } else if (state is GetSearchSuccess) { + return ListView.builder( + physics: const NeverScrollableScrollPhysics(), + itemCount: state.vehicleList.length, + itemBuilder: (context, index) { + print(state.vehicleList[index].equipmentTypes2! + .toString()); + print('nnnnnnnnnnnnn'); + final vehicle = state.vehicleList[index]; + return Container( + color: index.isEven + ? Colors.grey[300] + : Colors.white, + child: Padding( + padding: + const EdgeInsets.symmetric(vertical: 5), + child: InkWell( + onTap: () { + MagicRouter.navigateTo(Detail(vehicle)); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + CustomText( + width: 0.2.sw, + text: state.vehicleList[index] + .availabilityDate, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + CustomText( +// height: 20.h,o + width: 0.2.sw, + text: state.vehicleList[index] + .originCity == + null + ? 'other' + : state.vehicleList[index] + .originCity!.title, + // text: '', + + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 20.h, + width: 0.2.sw, + text: state.vehicleList[index] + .originState == + null + ? 'other' + : state.vehicleList[index] + .originState!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, + text: state.vehicleList[index] + .destinationCity == + null + ? 'other' + : state.vehicleList[index] + .destinationCity!.title, + fontSize: 8.sp, + align: TextAlign.start, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state.vehicleList[index] + .destinationState == + null + ? 'other' + : state.vehicleList[index] + .destinationState!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 30.h, + width: 0.2.sw, + text: state.vehicleList[index] + .equipmentTypes2!.isEmpty + ? 'other' + : state.vehicleList[index] + .equipmentTypes2! + .toString(), + align: TextAlign.end, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state.vehicleList[index] + .vehicleSizes2!.isEmpty + ? 'other' + : state.vehicleList[index] + .vehicleSizes2! + .toString(), + align: TextAlign.end, + color: Colors.green, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + ], + ), + ), + ), + ); + }); + } else if (state is GetVehicleSuccess) { + return ListView.builder( + physics: const NeverScrollableScrollPhysics(), + itemCount: state.vehicleList.length, + itemBuilder: (context, index) { + print('this'); + print(state.vehicleList[index].equipmentTypes2! + .toString()); + print('nnnnnnnnnnnnn'); + final vehicle = state.vehicleList[index]; + return Container( + color: index.isEven + ? Colors.grey[300] + : Colors.white, + child: Padding( + padding: + const EdgeInsets.symmetric(vertical: 5), + child: InkWell( + onTap: () { + MagicRouter.navigateTo(Detail(vehicle)); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + CustomText( + width: 0.2.sw, + text: state.vehicleList[index] + .availabilityDate, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + CustomText( +// height: 20.h,o + width: 0.2.sw, + text: state.vehicleList[index] + .originCity == + null + ? 'other' + : state.vehicleList[index] + .originCity!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 20.h, + width: 0.2.sw, + text: state.vehicleList[index] + .originState == + null + ? 'other' + : state.vehicleList[index] + .originState!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, + text: state.vehicleList[index] + .destinationCity == + null + ? 'other' + : state.vehicleList[index] + .destinationCity!.title, + fontSize: 8.sp, + align: TextAlign.start, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state.vehicleList[index] + .destinationState == + null + ? 'other' + : state.vehicleList[index] + .destinationState!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 30.h, + width: 0.2.sw, + text: state.vehicleList[index] + .equipmentTypes2!.isEmpty + ? 'other' + : state.vehicleList[index] + .equipmentTypes2! + .toString(), + align: TextAlign.end, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state.vehicleList[index] + .equipmentTypes2!.isEmpty + ? 'other' + : state.vehicleList[index] + .equipmentTypes2! + .toString(), + align: TextAlign.end, + color: Colors.green, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + ], + ), + ), + ), + ); + }); + } else if (state is VehicleLoading) { + return Column( + children: const [ + Center( + child: CircularProgressIndicator( + color: Colors.orange, + ), + ) + ], + ); + } else { + print('nnnnnnnnnnnnn'); + return ListView.builder( + physics: const NeverScrollableScrollPhysics(), + itemCount: + VehiclesCubit.get(context).vehicleList.length, + itemBuilder: (context, index) { + print(VehiclesCubit.get(context) + .vehicleList[index] + .equipmentTypes2! + .toString()); + print('nnnnnnnnnnnnn'); + + return Container( + color: index.isEven + ? Colors.grey[300] + : Colors.white, + child: Padding( + padding: + const EdgeInsets.symmetric(vertical: 5), + child: InkWell( + onTap: () { + MagicRouter.navigateTo(Detail( + VehiclesCubit.get(context) + .vehicleList[index])); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + CustomText( + width: 0.2.sw, + text: VehiclesCubit.get(context) + .vehicleList[index] + .availabilityDate, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + CustomText( +// height: 20.h,o + width: 0.2.sw, + text: VehiclesCubit.get(context) + .vehicleList[index] + .originCity == + null + ? 'other' + : VehiclesCubit.get(context) + .vehicleList[index] + .originCity! + .title, + // text: '', + + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 20.h, + width: 0.2.sw, + text: VehiclesCubit.get(context) + .vehicleList[index] + .originState == + null + ? 'other' + : VehiclesCubit.get(context) + .vehicleList[index] + .originState! + .title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, + text: VehiclesCubit.get(context) + .vehicleList[index] + .destinationCity == + null + ? 'other' + : VehiclesCubit.get(context) + .vehicleList[index] + .destinationCity! + .title, + fontSize: 8.sp, + align: TextAlign.start, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: VehiclesCubit.get(context) + .vehicleList[index] + .destinationState == + null + ? 'other' + : VehiclesCubit.get(context) + .vehicleList[index] + .destinationState! + .title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 30.h, + width: 0.2.sw, + text: VehiclesCubit.get(context) + .vehicleList[index] + .equipmentTypes2! + .isEmpty + ? 'other' + : VehiclesCubit.get(context) + .vehicleList[index] + .equipmentTypes2! + .toString(), + align: TextAlign.end, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: VehiclesCubit.get(context) + .vehicleList[index] + .vehicleSizes2! + .isEmpty + ? 'other' + : VehiclesCubit.get(context) + .vehicleList[index] + .vehicleSizes2! + .toString(), + align: TextAlign.end, + color: Colors.green, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + ], + ), + ), + ), + ); + }); + } + }, + listener: (BuildContext context, Object? state) {}, + ), + ) + ], + ), + ], + ), + + ), + ]), + ); + + + + + + + } +} + + diff --git a/lib/features/vehicles/get_vehicles/view.dart b/lib/features/vehicles/get_vehicles/view.dart new file mode 100644 index 0000000..4678248 --- /dev/null +++ b/lib/features/vehicles/get_vehicles/view.dart @@ -0,0 +1,62 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:hoga_load/core/router/router.dart'; +<<<<<<< HEAD:lib/features/vehicles/view.dart +import 'package:hoga_load/features/vehicles/filter_page.dart'; +import 'package:hoga_load/features/vehicles/units/details.dart'; +======= +import 'cubit/vehicle_cubit.dart'; +import 'cubit/vehicle_states.dart'; +import 'details.dart'; +import 'filter_page.dart'; +>>>>>>> nada:lib/features/vehicles/get_vehicles/view.dart +import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; +import 'package:hoga_load/widgets/widgets/custom_row.dart'; +import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; +import 'package:hoga_load/widgets/widgets/custom_text.dart'; + +part '../get_vehicles/units/body.dart'; +class VehiclesView extends StatelessWidget { + const VehiclesView({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return CustomScaffold( + body: +<<<<<<< HEAD:lib/features/vehicles/view.dart + SafeArea( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + CustomAppbar(title: 'Vehicles'), + SizedBox(height: 22.h,), + CustomSearchRow(1,function: (){ + MagicRouter.navigateTo(FilterVehicle()); + },), + SizedBox(height: 21.h,), + Expanded(child: Body()) + ], + ), +======= + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + CustomAppbar(title: 'Vehicles'), + SizedBox(height: 22.h,), + CustomSearchRow(1,function: (){ + MagicRouter.navigateTo(FilterVehicle()); + },), + SizedBox(height: 21.h,), + Body() + ], + +>>>>>>> nada:lib/features/vehicles/get_vehicles/view.dart + ), + ); + } +} \ No newline at end of file diff --git a/lib/features/vehicles/units/body.dart b/lib/features/vehicles/units/body.dart index ca9338a..d260a45 100644 --- a/lib/features/vehicles/units/body.dart +++ b/lib/features/vehicles/units/body.dart @@ -2,374 +2,706 @@ part of '../view.dart'; class Body extends StatelessWidget { Body({Key? key}) : super(key: key); - + List titlesList = [ + 'Available', + 'Origin', + 'State', + 'Destination', + 'State', + 'Type', + 'Size' + ]; @override Widget build(BuildContext context) { - return BlocConsumer( - listener: (context, state) {}, - builder: (context, state) { - if (state is GetSearchFailed) { - return Center(child: CustomText(text: state.msg)); - } else if (state is GetSearchSuccess) { - return Container( - height: .9.sh, - width: 1.sw, - child: Padding( - padding: const EdgeInsets.all(5.0), - child: DataTable2( - columnSpacing: 1, - horizontalMargin: 0, - dataRowHeight: - state.vehicleList.length <= 10 ? .06.sh : .11.sh, - minWidth: 890, - columns: const [ - DataColumn2( - label: Center(child: Text('Available')), - size: ColumnSize.L, - ), - DataColumn( - label: Center(child: Text('Origin')), - ), - DataColumn( - label: Center(child: Text('State')), - ), - DataColumn( - label: Center(child: Text('Destination')), - ), - DataColumn( - label: Center(child: Text('State')), - ), - DataColumn2( - label: Center(child: Text('Type')), - size: ColumnSize.L,), - DataColumn( - label: Center(child: Text('Size')), - ), - ], - rows: List.generate( - state.vehicleList.length, - (index) => DataRow( - color: MaterialStateColor.resolveWith( - (states) => index.isEven - ? const Color(0xFFE0E0E0) - : Colors.white), - cells: [ - DataCell(Center( - child: Text(state.vehicleList[index] - .availabilityDate!))), - DataCell(Center( - child: Text(state.vehicleList[index] - .originCountry!.title!))), - DataCell(Center( - child: Text(state.vehicleList[index] - .originState!.title!))), - DataCell(Center( - child: Text(state.vehicleList[index] - .destinationCity == - null - ? 'other' - : state.vehicleList[index] - .destinationCity!.title!))), - DataCell(Center( - child: Text(state.vehicleList[index] - .destinationState!.title!))), - DataCell(Center( - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 16.0), - child: Center( - child: ListView.builder( - physics: - const NeverScrollableScrollPhysics(), - itemCount: state.vehicleList[index] - .equipmentTypes?.length, - itemBuilder: (context, i) => Center( - child: Text(state - .vehicleList[index] - .equipmentTypes![i] - .title - .toString()))), - ), - ))), - DataCell(Center( - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 16.0), - child: Center( - child: ListView.builder( - physics: - const NeverScrollableScrollPhysics(), - itemCount: state.vehicleList[index] - .vehicleSizes?.length, - itemBuilder: (context, i) => Center( - child: Text(state - .vehicleList[index] - .vehicleSizes![i] - .title - .toString()))), - ), - ))), - ]))), - ), - ); - } else if (state is AddVehicleLoading) { - return Column( - mainAxisAlignment: MainAxisAlignment.center, - children:const [ - Center( - child: CircularProgressIndicator( - color: Colors.orange, + return Container( + height: 0.7.sh, + child: Scrollbar( + thickness: 15, + trackVisibility: true, + child: ListView( + physics: const BouncingScrollPhysics(), + shrinkWrap: true, + scrollDirection: Axis.horizontal, + children: [ + Column( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0.w), + child: Container( + height: 43.h, + width: 0.2.sw * 7, + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(15), + topRight: Radius.circular(15))), + child: ListView.builder( + scrollDirection: Axis.horizontal, + physics: const NeverScrollableScrollPhysics(), + itemCount: 7, + itemBuilder: (context, index) { + return SizedBox( + width: 0.2.sw, + child: CustomText( + text: titlesList[index], + fontSize: 9.sp, + align: TextAlign.start, + fontWeight: FontWeight.w700, + ), + ); + }), ), ), - ], - ); - } - else if (state is GetVehicleSuccess){ - return Container( - height: .9.sh, - width: 1.sw, - child: Padding( - padding: const EdgeInsets.all(5.0), - child: DataTable2( - columnSpacing: 1, - horizontalMargin: 0, - dataRowHeight: state.vehicleList.length >= 10 - ? .06.sh - : .11.sh, - minWidth: 890, - columns: const [ - DataColumn2( - label: Center(child: Text('Available')), - size: ColumnSize.L, - ), - DataColumn( - label: Center(child: Text('Origin')), - ), - DataColumn( - label: Center(child: Text('State')), - ), - DataColumn( - label: Center(child: Text('Destination')), - ), - DataColumn( - label: Center(child: Text('State')), - ), - DataColumn( - label: Center(child: Text('Type')), - - ), - DataColumn( - label: Center(child: Text('Size')), - ), - ], - rows: List.generate( - VehiclesCubit.get(context).vehicleList.length, - (index) => DataRow( - color: MaterialStateColor.resolveWith( - (states) => index.isEven - ? const Color(0xFFE0E0E0) - : Colors.white), - cells: [ - DataCell(Center( - child: Text(VehiclesCubit.get(context) - .vehicleList[index] - .availabilityDate!))), - DataCell(Center( - child: Text(VehiclesCubit.get(context) - .vehicleList[index] - .originCountry! - .title!))), - DataCell(Center( - child: Text(VehiclesCubit.get(context) - .vehicleList[index] - .originState! - .title!))), - DataCell(Center( - child: Text(VehiclesCubit.get(context) - .vehicleList[index] - .destinationCity == - null - ? 'other' - : VehiclesCubit.get(context) - .vehicleList[index] - .destinationCity! - .title!))), - DataCell(Center( - child: Text(VehiclesCubit.get(context) - .vehicleList[index] - .destinationState! - .title!))), - DataCell(Center( - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 16.0), - child: Center( - child: ListView.builder( - physics: - const NeverScrollableScrollPhysics(), - itemCount: VehiclesCubit.get(context) - .vehicleList[index] - .equipmentTypes - ?.length, - itemBuilder: (context, i) => Center( - child: Text( - VehiclesCubit.get(context) - .vehicleList[index] - .equipmentTypes![i] - .title - .toString()))), + Container( + height: 0.6.sh, + width: 0.2.sw * 7, + child: BlocConsumer( + builder: (context, state) { + if (state is GetSearchFailed) { + return Center( + child: CustomText( + text: state.msg, + fontSize: 30, + )); + } else if (state is GetSearchSuccess) { + return ListView.builder( + physics: const NeverScrollableScrollPhysics(), + itemCount: state.vehicleList.length, + itemBuilder: (context, index) { + print(state.vehicleList[index].equipmentTypes2! + .toString()); + print('nnnnnnnnnnnnn'); + final vehicle = state.vehicleList[index]; + return Container( + color: index.isEven + ? Colors.grey[300] + : Colors.white, + child: Padding( + padding: + const EdgeInsets.symmetric(vertical: 5), + child: InkWell( + onTap: () { + MagicRouter.navigateTo(Detail(vehicle)); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + CustomText( + width: 0.2.sw, + text: state.vehicleList[index] + .availabilityDate, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + CustomText( +// height: 20.h,o + width: 0.2.sw, + text: state.vehicleList[index] + .originCity == + null + ? 'other' + : state.vehicleList[index] + .originCity!.title, + // text: '', + + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 20.h, + width: 0.2.sw, + text: state.vehicleList[index] + .originState == + null + ? 'other' + : state.vehicleList[index] + .originState!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, + text: state.vehicleList[index] + .destinationCity == + null + ? 'other' + : state.vehicleList[index] + .destinationCity!.title, + fontSize: 8.sp, + align: TextAlign.start, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state.vehicleList[index] + .destinationState == + null + ? 'other' + : state.vehicleList[index] + .destinationState!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 30.h, + width: 0.2.sw, + text: state.vehicleList[index] + .equipmentTypes2!.isEmpty + ? 'other' + : state.vehicleList[index] + .equipmentTypes2! + .toString(), + align: TextAlign.end, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state.vehicleList[index] + .vehicleSizes2!.isEmpty + ? 'other' + : state.vehicleList[index] + .vehicleSizes2! + .toString(), + align: TextAlign.end, + color: Colors.green, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + ], ), - ))), - DataCell(Center( - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 16.0), - child: Center( - child: ListView.builder( - physics: - const NeverScrollableScrollPhysics(), - itemCount: VehiclesCubit.get(context) - .vehicleList[index] - .vehicleSizes - ?.length, - itemBuilder: (context, i) => Center( - child: Text( - VehiclesCubit.get(context) - .vehicleList[index] - .vehicleSizes![i] - .title - .toString()))), + ), + ), + ); + }); + } else if (state is GetVehicleSuccess) { + return ListView.builder( + physics: const NeverScrollableScrollPhysics(), + itemCount: state.vehicleList.length, + itemBuilder: (context, index) { + print('this'); + print(state.vehicleList[index].equipmentTypes2! + .toString()); + print('nnnnnnnnnnnnn'); + final vehicle = state.vehicleList[index]; + return Container( + color: index.isEven + ? Colors.grey[300] + : Colors.white, + child: Padding( + padding: + const EdgeInsets.symmetric(vertical: 5), + child: InkWell( + onTap: () { + MagicRouter.navigateTo(Detail(vehicle)); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + CustomText( + width: 0.2.sw, + text: state.vehicleList[index] + .availabilityDate, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + CustomText( +// height: 20.h,o + width: 0.2.sw, + text: state.vehicleList[index] + .originCity == + null + ? 'other' + : state.vehicleList[index] + .originCity!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 20.h, + width: 0.2.sw, + text: state.vehicleList[index] + .originState == + null + ? 'other' + : state.vehicleList[index] + .originState!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, + text: state.vehicleList[index] + .destinationCity == + null + ? 'other' + : state.vehicleList[index] + .destinationCity!.title, + fontSize: 8.sp, + align: TextAlign.start, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state.vehicleList[index] + .destinationState == + null + ? 'other' + : state.vehicleList[index] + .destinationState!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 30.h, + width: 0.2.sw, + text: state.vehicleList[index] + .equipmentTypes2!.isEmpty + ? 'other' + : state.vehicleList[index] + .equipmentTypes2! + .toString(), + align: TextAlign.end, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state.vehicleList[index] + .equipmentTypes2!.isEmpty + ? 'other' + : state.vehicleList[index] + .equipmentTypes2! + .toString(), + align: TextAlign.end, + color: Colors.green, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + ], ), - ))), - ]))), - ), - ); - } - else { - return Container( - height: .9.sh, - width: 1.sw, - child: Padding( - padding: const EdgeInsets.all(5.0), - child: DataTable2( - columnSpacing: 1, - horizontalMargin: 0, - dataRowHeight: - VehiclesCubit.get(context).vehicleList.length >= 10 - ? .06.sh - : .11.sh, - minWidth: 890, - columns: const [ - DataColumn2( - label: Center(child: Text('Available')), - size: ColumnSize.L, - ), - DataColumn( - label: Center(child: Text('Origin')), - ), - DataColumn( - label: Center(child: Text('State')), - ), - DataColumn( - label: Center(child: Text('Destination')), - ), - DataColumn( - label: Center(child: Text('State')), - ), - DataColumn( - label: Center(child: Text('Type')), - ), - DataColumn( - label: Center(child: Text('Size')), - ), - ], - rows: List.generate( - VehiclesCubit.get(context).vehicleList.length, - (index) => DataRow( - color: MaterialStateColor.resolveWith( - (states) => index.isEven - ? const Color(0xFFE0E0E0) - : Colors.white), - cells: [ - DataCell(Center( - child: Text(VehiclesCubit.get(context) - .vehicleList[index] - .availabilityDate!))), - DataCell(Center( - child: Text(VehiclesCubit.get(context) - .vehicleList[index] - .originCountry! - .title!))), - DataCell(Center( - child: Text(VehiclesCubit.get(context) - .vehicleList[index] - .originState! - .title!))), - DataCell(Center( - child: Text(VehiclesCubit.get(context) - .vehicleList[index] - .destinationCity == - null - ? 'other' - : VehiclesCubit.get(context) - .vehicleList[index] - .destinationCity! - .title!))), - DataCell(Center( - child: Text(VehiclesCubit.get(context) - .vehicleList[index] - .destinationState! - .title!))), - DataCell(Center( - child: Padding( - padding: EdgeInsets.symmetric( - vertical: 16.sp), - child: Center( - child: ListView.builder( - physics: - const NeverScrollableScrollPhysics(), - itemCount: VehiclesCubit.get(context) + ), + ), + ); + }); + } else if (state is AddVehicleLoading) { + return Column( + children: const [ + Center( + child: CircularProgressIndicator( + color: Colors.orange, + ), + ) + ], + ); + } else { + print('nnnnnnnnnnnnn'); + return ListView.builder( + physics: const NeverScrollableScrollPhysics(), + itemCount: + VehiclesCubit.get(context).vehicleList.length, + itemBuilder: (context, index) { + print(VehiclesCubit.get(context) + .vehicleList[index] + .equipmentTypes2! + .toString()); + print('nnnnnnnnnnnnn'); + + return Container( + color: index.isEven + ? Colors.grey[300] + : Colors.white, + child: Padding( + padding: + const EdgeInsets.symmetric(vertical: 5), + child: InkWell( + onTap: () { + MagicRouter.navigateTo(Detail( + VehiclesCubit.get(context) + .vehicleList[index])); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + CustomText( + width: 0.2.sw, + text: VehiclesCubit.get(context) .vehicleList[index] - .equipmentTypes - ?.length, - itemBuilder: (context, i) => Center( - child: Text( - VehiclesCubit.get(context) - .vehicleList[index] - .equipmentTypes![i] - .title - .toString()))), + .availabilityDate, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + CustomText( +// height: 20.h,o + width: 0.2.sw, + text: VehiclesCubit.get(context) + .vehicleList[index] + .originCity == + null + ? 'other' + : VehiclesCubit.get(context) + .vehicleList[index] + .originCity! + .title, + // text: '', + + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 20.h, + width: 0.2.sw, + text: VehiclesCubit.get(context) + .vehicleList[index] + .originState == + null + ? 'other' + : VehiclesCubit.get(context) + .vehicleList[index] + .originState! + .title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, + text: VehiclesCubit.get(context) + .vehicleList[index] + .destinationCity == + null + ? 'other' + : VehiclesCubit.get(context) + .vehicleList[index] + .destinationCity! + .title, + fontSize: 8.sp, + align: TextAlign.start, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: VehiclesCubit.get(context) + .vehicleList[index] + .destinationState == + null + ? 'other' + : VehiclesCubit.get(context) + .vehicleList[index] + .destinationState! + .title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( +// height: 30.h, + width: 0.2.sw, + text: VehiclesCubit.get(context) + .vehicleList[index] + .equipmentTypes2! + .isEmpty + ? 'other' + : VehiclesCubit.get(context) + .vehicleList[index] + .equipmentTypes2! + .toString(), + align: TextAlign.end, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: VehiclesCubit.get(context) + .vehicleList[index] + .vehicleSizes2! + .isEmpty + ? 'other' + : VehiclesCubit.get(context) + .vehicleList[index] + .vehicleSizes2! + .toString(), + align: TextAlign.end, + color: Colors.green, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + ], ), - ))), - DataCell(Center( - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 16.0), - child: Center( - child: ListView.builder( - physics: - const NeverScrollableScrollPhysics(), - itemCount: VehiclesCubit.get(context) - .vehicleList[index] - .vehicleSizes - ?.length, - itemBuilder: (context, i) => Center( - child: Text( - VehiclesCubit.get(context) - .vehicleList[index] - .vehicleSizes == - null - ? 'other' - : VehiclesCubit.get(context) - .vehicleList[index] - .vehicleSizes![i] - .title!))), + ), + ), + ); + }); + } + }, + listener: (BuildContext context, Object? state) {}, + ), + ) + ], + ), + ], + ), + ), + ); + } +} +/* +class Body extends StatelessWidget { + Body({Key? key}) : super(key: key); + List titlesList=[ + 'Available', + 'Origin', + 'State', + 'Destination', + 'State', + 'Type', + 'Size' + ]; + @override + Widget build(BuildContext context) { + return + Expanded( + child: ListView( + children: [ + Container( + height: 0.7.sh, + + child: ListView( + physics: const BouncingScrollPhysics(), + shrinkWrap: true, + scrollDirection: Axis.horizontal, + children: [ + Column( + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0.w), + child: Container( + height: 43.h, + width: 0.2.sw*7, + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(15), + topRight: Radius.circular(15))), + child: ListView.builder( + scrollDirection: Axis.horizontal, + physics:const NeverScrollableScrollPhysics(), + itemCount: 7, + itemBuilder: (context,index){ + return SizedBox( + width: 0.2.sw, + child: CustomText( + text: titlesList[index], + fontSize: 9.sp, + align: TextAlign.start, + fontWeight: FontWeight.w700, ), - ))), - ]))), + ); + } + ), + ), + ), + Expanded( + child: Container( + width:0.2.sw*7 , + child: BlocConsumer( + builder: (context,state) { + if(state is GetSearchFailed){ + return + Center(child: CustomText(text: state.msg)); + }else if(state is GetSearchSuccess){ + return ListView.builder( + physics: const NeverScrollableScrollPhysics(), + itemCount: state.vehicleList.length, + itemBuilder: (context, index) { + + print(state.vehicleList[index].equipmentTypes2!.toString()); + print('nnnnnnnnnnnnn'); + + return + Container( + color: index.isEven ? Colors.grey[300] : Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 5), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CustomText( + width: 0.2.sw, + text: state.vehicleList[index].availabilityDate, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + CustomText( +// height: 20.h,o + width: 0.2.sw, + text: state.vehicleList[index].originCity==null?'other': + state.vehicleList[index].originCity!.title, + // text: '', + + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + + CustomText( +// height: 20.h, + width: 0.2.sw, + text: state.vehicleList[index].originState==null?'other': + state.vehicleList[index].originState!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + + CustomText( + width:0.2.sw , + text: state.vehicleList[index].destinationCity==null?'other': + state.vehicleList[index].destinationCity!.title, + + fontSize: 8.sp, + align: TextAlign.start, + fontWeight: FontWeight.w500), + + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state.vehicleList[index].destinationState==null?'other': + state.vehicleList[index].destinationState!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + + CustomText( +// height: 30.h, + width: 0.2.sw, + text: state.vehicleList[index].equipmentTypes2.toString(), + align: TextAlign.end, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: state.vehicleList[index].vehicleSizes2!.toString(), + + align: TextAlign.end, + color: + Colors.green , + fontSize: 8.sp, + fontWeight: FontWeight.w500), + ], + ), + ), + ); + + } + ); + + }else{ + return ListView.builder( + physics: const NeverScrollableScrollPhysics(), + itemCount: VehiclesCubit.get(context).vehicleList.length, + itemBuilder: (context, index) { + + print(VehiclesCubit.get(context).vehicleList[index].equipmentTypes2!.toString()); + print('nnnnnnnnnnnnn'); + + return + Container( + color: index.isEven ? Colors.grey[300] : Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 5), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CustomText( + width: 0.2.sw, + text: VehiclesCubit.get(context).vehicleList[index].availabilityDate, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + CustomText( +// height: 20.h,o + width: 0.2.sw, + text: VehiclesCubit.get(context).vehicleList[index].originCity==null?'other': + VehiclesCubit.get(context).vehicleList[index].originCity!.title, + // text: '', + + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + + CustomText( +// height: 20.h, + width: 0.2.sw, + text: VehiclesCubit.get(context).vehicleList[index].originState==null?'other': + VehiclesCubit.get(context).vehicleList[index].originState!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + + CustomText( + width:0.2.sw , + text: VehiclesCubit.get(context).vehicleList[index].destinationCity==null?'other': + VehiclesCubit.get(context).vehicleList[index].destinationCity!.title, + + fontSize: 8.sp, + align: TextAlign.start, + fontWeight: FontWeight.w500), + + CustomText( + width: 0.2.sw, +// height: 20.h, + text: VehiclesCubit.get(context).vehicleList[index].destinationState==null?'other': + VehiclesCubit.get(context).vehicleList[index].destinationState!.title, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + + CustomText( +// height: 30.h, + width: 0.2.sw, + text: VehiclesCubit.get(context).vehicleList[index].equipmentTypes2.toString(), + align: TextAlign.end, + fontSize: 8.sp, + fontWeight: FontWeight.w500), + CustomText( + width: 0.2.sw, +// height: 20.h, + text: VehiclesCubit.get(context).vehicleList[index].vehicleSizes2!.toString(), + + align: TextAlign.end, + color: + Colors.green , + fontSize: 8.sp, + fontWeight: FontWeight.w500), + ], + ), + ), + ); + + } + ); + } + }, listener: (BuildContext context, Object? state) { }, + ), + ), + ) + + ], + ), + + + ], + ), + ), - ); - } - }); + ]), + ); + } } + + */ diff --git a/lib/features/vehicles/units/details.dart b/lib/features/vehicles/units/details.dart new file mode 100644 index 0000000..7af166f --- /dev/null +++ b/lib/features/vehicles/units/details.dart @@ -0,0 +1,35 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import '../../../core/data/models/vehicle/vehicles.dart'; +import '../../../widgets/widgets/custom_appbar.dart'; +import '../../../widgets/widgets/custom_container_vehicle_detail.dart'; +import '../../../widgets/widgets/custom_scaffold.dart'; +class Detail extends StatefulWidget { + Detail(this.vehicle, {super.key}) ; + Vehicles? vehicle; + + @override + State createState() => _DetailState(); +} + +class _DetailState extends State { + @override + Widget build(BuildContext context) { + return CustomScaffold( + body: + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + CustomAppbar(title: 'View Vehicles'), + Expanded(child: Column( + children: [ + Expanded(child: CustomContainerVehicle(widget.vehicle!)), + ], + )), + SizedBox(height: 22.h,) + ], + ), + ); + } +} diff --git a/lib/features/vehicles/upload_vehicles/units/button.dart b/lib/features/vehicles/upload_vehicles/units/button.dart new file mode 100644 index 0000000..e517a99 --- /dev/null +++ b/lib/features/vehicles/upload_vehicles/units/button.dart @@ -0,0 +1,25 @@ +part of '../view.dart'; + +class Button extends StatelessWidget { + + Button({super.key,this.isUpgradeMember=false}); + bool isUpgradeMember; + + @override + Widget build(BuildContext context) { + return Padding( + padding: EdgeInsets.only(bottom: 27.h), + child: Align( + alignment: Alignment.bottomCenter, + child: CustomButton(text: isUpgradeMember?"Upgrade MemberShip": + '+ Add',icon: Icons.add, color: ColorManager.yellow, + function: (){ + isUpgradeMember? MagicRouter.navigateTo( PlanView()): + MagicRouter.navigateTo(AddVehiclesView()); + + }, + ), + ), + ); + } +} diff --git a/lib/features/vehicles/upload_vehicles/units/my_table.dart b/lib/features/vehicles/upload_vehicles/units/my_table.dart new file mode 100644 index 0000000..760ae83 --- /dev/null +++ b/lib/features/vehicles/upload_vehicles/units/my_table.dart @@ -0,0 +1,43 @@ +part of '../view.dart'; +class MyTable extends StatelessWidget { + const MyTable({super.key}); + + @override + Widget build(BuildContext context) { + return UploadedTableTitle( + child: BlocConsumer( + listener: (BuildContext context, Object? state) { }, + builder: (context,state) { + return ListView.builder( + itemCount: VehiclesCubit.get(context).myVehicleList.length, + + itemBuilder: (context, index) { + return Container( + color: index.isEven ? Colors.grey[300] : Colors.white, + child: UploadedTableDataRow( + origin:"${VehiclesCubit.get(context).myVehicleList[index].originCity!.title??"other"}" + " (${VehiclesCubit.get(context).myVehicleList[index].originState!.title??"other"} , " + "${VehiclesCubit.get(context).myVehicleList[index].originCountry!.title??"other"}) " + " → ""${VehiclesCubit.get(context).myVehicleList[index].destinationCity!.title??"other"}" + " (${VehiclesCubit.get(context).myVehicleList[index].destinationState!.title??"other"} , " + "${VehiclesCubit.get(context).myVehicleList[index].destinationCountry!.title??"other"}) ", + editFunc:(){ + MagicRouter.navigateTo( AddVehiclesView(isEdit: true,vehiclesModel: + VehiclesCubit.get(context).myVehicleList[index],index:index)); + //VehiclesCubit.get(context).editVehicleCubit(context:context,vehicleId:VehiclesCubit.get(context).vehicleList[index].id); + + } , + deleteFunc:(){ + VehiclesCubit.get(context).deleteVehicleCubit(VehiclesCubit.get(context).myVehicleList[index].id); + } , + tableWeight:"${VehiclesCubit.get(context).myVehicleList[index].weight}" , + tableNumber: "${index+1}", + ), + ); + } + ); + } + ), + ); + } +} diff --git a/lib/features/vehicles/upload_vehicles/units/uploaded.dart b/lib/features/vehicles/upload_vehicles/units/uploaded.dart new file mode 100644 index 0000000..08a7d43 --- /dev/null +++ b/lib/features/vehicles/upload_vehicles/units/uploaded.dart @@ -0,0 +1,60 @@ +part of '../view.dart'; + +class Uploaded extends StatefulWidget { + const Uploaded({Key? key}) : super(key: key); + + @override + State createState() => _UploadedState(); +} + +class _UploadedState extends State { + @override + void initState() { + // TODO: implement initState + super.initState(); + VehiclesCubit.get(context).addVehicleCubitTest(); + } + @override + Widget build(BuildContext context) { + return BlocConsumer( + listener: (BuildContext context, Object? state) { + + }, + builder: (context,state) { + print("is access token ${VehiclesCubit.get(context).isAccessToken}"); + + return VehiclesCubit.get(context).testLoading? + const Expanded(child: Center(child: CircularProgressIndicator(color: ColorManager.yellow,))): + + VehiclesCubit.get(context).isAccessToken?CustomCard( + widget: Padding( + padding: EdgeInsets.symmetric(horizontal: 11.sp), + child: Column( + children: [ + SizedBox(height: 18.h,), + CustomCardTitle(text: 'UPLOADED Vehicles',), + VehiclesCubit.get(context).myVehiclesLoading? + const Expanded(child: Center(child: CircularProgressIndicator(color: ColorManager.yellow,))): + VehiclesCubit.get(context).myVehicleList.isEmpty?Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + CustomNoContainer(text: 'vehicles'), + ], + ), + ): + const MyTable(), + Button() + + + ], + ), + ), + ): UpgradeMember(); + + + } + ); + + } +} diff --git a/lib/features/vehicles/upload_vehicles/view.dart b/lib/features/vehicles/upload_vehicles/view.dart new file mode 100644 index 0000000..5a41a05 --- /dev/null +++ b/lib/features/vehicles/upload_vehicles/view.dart @@ -0,0 +1,52 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:hoga_load/core/color_manager/color_manager.dart'; +import 'package:hoga_load/core/router/router.dart'; +import 'package:hoga_load/features/plans/view.dart'; +import 'package:hoga_load/widgets/widgets/upgrade_member_ship.dart'; +import '../../../core/widgets/custom_card.dart'; +import '../../../core/widgets/custom_card_title.dart'; +import '../../../core/widgets/custom_no_container.dart'; +import '../add_vehicle/view.dart'; +import '../get_vehicles/cubit/vehicle_cubit.dart'; +import '../get_vehicles/cubit/vehicle_states.dart'; +import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; +import 'package:hoga_load/widgets/widgets/custom_button.dart'; +import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; +import 'package:hoga_load/widgets/widgets/uploaded_table_row.dart'; +import 'package:hoga_load/widgets/widgets/uploaded_table_title.dart'; +part '../upload_vehicles/units/uploaded.dart'; +part '../upload_vehicles/units/button.dart'; +part '../upload_vehicles/units/my_table.dart'; + + +class UploadVehiclesView extends StatefulWidget { + const UploadVehiclesView({Key? key}) : super(key: key); + + @override + State createState() => _UploadVehiclesViewState(); +} + +class _UploadVehiclesViewState extends State { + + @override + void initState() { + super.initState(); + VehiclesCubit.get(context).getVehicleCubit(self: 1); + } + @override + Widget build(BuildContext context) { + return CustomScaffold( + body: + Column( + children: [ + CustomAppbar(title: 'Uploaded VEHICLES'.toUpperCase()), + const Expanded(child: Uploaded()), + //MyTable(), + + ], + ), + ); + } +} \ No newline at end of file diff --git a/lib/features/vehicles/view.dart b/lib/features/vehicles/view.dart deleted file mode 100644 index 1f25dd4..0000000 --- a/lib/features/vehicles/view.dart +++ /dev/null @@ -1,35 +0,0 @@ -import 'package:data_table_2/data_table_2.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:hoga_load/widgets/widgets/custom_appbar.dart'; -import 'package:hoga_load/widgets/widgets/custom_row.dart'; -import 'package:hoga_load/widgets/widgets/custom_scaffold.dart'; -import 'package:hoga_load/widgets/widgets/custom_text.dart'; - -import '../add_vehicle/cubit/getVehicle_cubit.dart'; -import '../add_vehicle/cubit/getVehicle_states.dart'; - -part 'units/body.dart'; -class VehiclesView extends StatelessWidget { - const VehiclesView({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return CustomScaffold( - body: - Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - CustomAppbar(title: 'Vehicles'), - SizedBox(height: 22.h,), - CustomSearchRow(1), - SizedBox(height: 21.h,), - Expanded(child: Body()) - ], - ), - ); - } -} \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 0b18c9e..38822df 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -3,28 +3,37 @@ import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:hoga_load/core/data/local/cacheHelper.dart'; +import 'package:hoga_load/core/data/repository/plans_repo.dart'; import 'package:hoga_load/core/keys/keys.dart'; import 'package:hoga_load/core/router/router.dart'; import 'package:hoga_load/features/auth/domain/auth_cubit.dart'; import 'package:hoga_load/features/home/controller.dart'; import 'package:hoga_load/features/jobs/cubit/getJop_cubit.dart'; import 'package:hoga_load/features/loads/cubit/getLoad_cubit.dart'; -import 'package:hoga_load/features/loads/view.dart'; +import 'package:hoga_load/features/plans/cubit/plans_cubit.dart'; import 'package:hoga_load/features/search_product/cubit/getProduct_cubit.dart'; import 'package:hoga_load/features/splash/splash_view.dart'; import 'package:provider/provider.dart'; -import 'features/add_vehicle/cubit/getDataForm_cubit.dart'; -import 'features/add_vehicle/cubit/getVehicle_cubit.dart'; +import 'core/bloc_observer.dart'; +import 'core/master_cubit/getDataForm_cubit.dart'; import 'features/blogs/bloc/blog_cubit.dart'; import 'features/change_password/cubit/changePass_cubit.dart'; import 'features/dashboard/cubit/updateProfile_cubit.dart'; import 'features/packages/cubit/package_cubit.dart'; +import 'features/vehicles/get_vehicles/cubit/vehicle_cubit.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); await CacheHelper.init(); - runApp(const MyApp()); + BlocOverrides.runZoned((){ + runApp(const MyApp()); + + }, + blocObserver: SimpleBlocObserver() + + ); + } class MyApp extends StatelessWidget { @@ -35,7 +44,9 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) { return MultiProvider( providers: [ + BlocProvider(create: (_) => HomeCubit()), + BlocProvider(create: (_) => PlansCubit()..getPlansCubit()), BlocProvider(create: (_) => AuthCubit()), BlocProvider( create: (_) => VehiclesCubit() @@ -43,24 +54,26 @@ class MyApp extends StatelessWidget { ..getEquipmentsCubit() ..getVehicleSizesCubit() ..getVehicleTypesCubit() - ..getVehicleCubit() + // ..getVehicleCubit() ), BlocProvider( create: (_) => DataFormCubit() - ..getCity() - ..getCountry() - ..getState() - ..getProduct()), + ..getCountry()..cityList..countryList..stateList + ..getProduct()..getJopCategory()..getJopType()), BlocProvider( create: (_) => LoadsCubit()..getLoad()), BlocProvider( create: (_) => ProductsCubit()..getProduct()), BlocProvider( +<<<<<<< HEAD create: (_) => JopCubit()..getJop()), +======= + create: (_) => JopCubit()..getJop()..addJopCubit), +>>>>>>> nada BlocProvider(create: (_) => PackageCubit()..getPackageCubit()), BlocProvider(create: (_)=>ChangePassCubit()), - BlocProvider(create: (_)=>UpdateProfileCubit()), + BlocProvider(create: (_)=>UpdateProfileCubit()..updateProfile..getVehicleTypesCubit()), BlocProvider( create: (_) => BlogsCubit() ..getBlogsCubit(CacheHelper.getString(SharedKeys.token))..blogList), diff --git a/lib/widgets/widgets/custom_appbar.dart b/lib/widgets/widgets/custom_appbar.dart index 576e81c..7035c92 100644 --- a/lib/widgets/widgets/custom_appbar.dart +++ b/lib/widgets/widgets/custom_appbar.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:hoga_load/core/app_images/app_images.dart'; +import 'package:hoga_load/features/dashboard/view.dart'; import 'package:hoga_load/features/home/view.dart'; import 'package:hoga_load/widgets/widgets/custom_text.dart'; @@ -31,7 +32,8 @@ class CustomAppbar extends StatelessWidget { children: [ InkWell( onTap: (){ - MagicRouter.navigateTo( const OnDrawer()); + Scaffold.of(context).openDrawer(); + //MagicRouter.navigateTo( const OnDrawer()); }, child: SvgPicture.asset(AppImages.menu)), @@ -43,7 +45,11 @@ class CustomAppbar extends StatelessWidget { ), ), - icon==null?const Icon(Icons.account_circle_outlined):icon, + icon ?? InkWell( + onTap: (){ + MagicRouter.navigateTo( const DashboardView()); + }, + child: const Icon(Icons.account_circle_outlined)), ], ), ), diff --git a/lib/widgets/widgets/custom_button.dart b/lib/widgets/widgets/custom_button.dart index ba389ca..bfc855a 100644 --- a/lib/widgets/widgets/custom_button.dart +++ b/lib/widgets/widgets/custom_button.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import '../../core/color_manager/color_manager.dart'; + import 'custom_text.dart'; class CustomButton extends StatelessWidget { @@ -28,8 +28,8 @@ class CustomButton extends StatelessWidget { return InkWell( onTap: function, child: Container( - width: 320.w, - height: 48.h, + width: 1.sw, + // height: 48.h, decoration: BoxDecoration( color: color, borderRadius: BorderRadius.circular(10.r), @@ -37,18 +37,23 @@ class CustomButton extends StatelessWidget { color: colorborder == null ? Colors.transparent : colorborder)), child: Center( - child: Row( + child: Padding( + padding: EdgeInsets.symmetric(vertical: 10.sp), + child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(icon), - CustomText( - text: text, - color: colortext == null ? Colors.black : colortext, - fontSize: font == null ? 20.sp : font, - fontWeight: FontWeight.w600, - ), + // Icon(icon), + Expanded( + child: CustomText( + text: text, + color: colortext == null ? Colors.black : colortext, + fontSize: font == null ? 20.sp : font, + fontWeight: FontWeight.w600, + ), + ), ], - ))), + ), + ))), ); } } diff --git a/lib/widgets/widgets/custom_checkbox.dart b/lib/widgets/widgets/custom_checkbox.dart index f55e836..c57b54f 100644 --- a/lib/widgets/widgets/custom_checkbox.dart +++ b/lib/widgets/widgets/custom_checkbox.dart @@ -1,13 +1,15 @@ -import 'dart:ffi'; - import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:hoga_load/widgets/widgets/custom_text.dart'; +import '../../features/vehicles/get_vehicles/cubit/vehicle_cubit.dart'; + class CustomCheckBox extends StatefulWidget { - CustomCheckBox({Key? key, this.value,this.text}) : super(key: key); - var value; -var text; + CustomCheckBox({Key? key, this.value,this.text, this.index, this.boxKey}) : super(key: key); + bool? value; +String? text; +int? index; +String? boxKey; @override State createState() => _CustomCheckBoxState(); } @@ -29,6 +31,7 @@ class _CustomCheckBoxState extends State { setState(() { widget.value =val ; }); + VehiclesCubit.get(context).changeCheckBox(widget.boxKey, widget.index,val); }), CustomText(text: widget.text, fontSize: 14.sp,fontWeight: FontWeight.w500,color: const Color(0xFFAEAEB2),) ], diff --git a/lib/widgets/widgets/custom_container_blog.dart b/lib/widgets/widgets/custom_container_blog.dart index a547ed5..77fa190 100644 --- a/lib/widgets/widgets/custom_container_blog.dart +++ b/lib/widgets/widgets/custom_container_blog.dart @@ -7,7 +7,7 @@ import 'package:hoga_load/core/widgets/custom_card.dart'; import 'package:hoga_load/features/blogs/blog_details.dart'; import 'package:hoga_load/widgets/widgets/custom_text.dart'; -import '../../core/data/models/blogs.dart'; +import '../../core/data/models/blogs/blogs.dart'; import '../../core/router/router.dart'; class CustomContainerBlog extends StatelessWidget { @@ -27,7 +27,7 @@ bottomPadding: 0, children: [ Container( height: 166.h, - width: double.infinity, + width: 1.sw, decoration: BoxDecoration( borderRadius: BorderRadius.only( topLeft: Radius.circular(12.r), @@ -51,7 +51,7 @@ fit: BoxFit.cover, ), ), Padding( - padding: EdgeInsets.only(top: 8.h, left: 13.w), + padding: EdgeInsets.only(top: 8.h, left: 6.w), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -62,14 +62,14 @@ fit: BoxFit.cover, Icons.person_outline, color: Colors.grey, ), - const SizedBox(width: 6,), + const SizedBox(width: 2,), CustomText( text: 'Admin', fontSize: 12.sp, fontWeight: FontWeight.w600, color: Colors.grey, ), - const SizedBox(width: 6,), + const SizedBox(width: 2,), ], ), @@ -83,19 +83,17 @@ fit: BoxFit.cover, Icons.access_time_outlined, color: Colors.grey, ), - Expanded( - - child: CustomText( - align: TextAlign.start, - text: blogs.createdAt!.substring(0, blogs.createdAt!.indexOf('T')), - fontSize: 12.sp, - fontWeight: FontWeight.w600, - color: Colors.grey, - ), + CustomText( + align: TextAlign.start, + text: blogs.createdAt!.substring(0, blogs.createdAt!.indexOf('T')), + fontSize: 12.sp, + fontWeight: FontWeight.w600, + color: Colors.grey, ) ], ), ), + Expanded( child: Row( mainAxisAlignment: MainAxisAlignment.start, diff --git a/lib/widgets/widgets/custom_container_jop_detail.dart b/lib/widgets/widgets/custom_container_jop_detail.dart new file mode 100644 index 0000000..a6061c0 --- /dev/null +++ b/lib/widgets/widgets/custom_container_jop_detail.dart @@ -0,0 +1,218 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:hoga_load/core/app_images/app_images.dart'; +import 'package:hoga_load/core/color_manager/color_manager.dart'; +import 'package:hoga_load/core/widgets/custom_card.dart'; +import 'package:hoga_load/features/blogs/blog_details.dart'; +import 'package:hoga_load/widgets/widgets/custom_text.dart'; + +import '../../core/data/models/jobs/GetJop_model.dart'; +import '../../core/data/models/loads/GetLoads_model.dart'; +import '../../core/data/models/vehicle/vehicles.dart'; +import '../../core/router/router.dart'; + +class CustomContainerJop extends StatelessWidget { + final GetJopModel jop; + const CustomContainerJop(this.jop, {Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return CustomCard( + paddingInEnd: 0, + paddingInStart: 0, + bottomPadding: 0, + widget: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(left: 12.w, top: 25.h, bottom: 25.h), + child: Row( + children: [ + CustomText( + text: jop.title == null ? 'other' : jop.title.toString(), + fontSize: 18.sp, + align: TextAlign.start, + fontWeight: FontWeight.w600, + color: ColorManager.primaryColor, + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0, top: 8), + child: Row( + // mainAxisAlignment: MainAxisAlignment.start, + children: [ + Row( + children: [ + const Icon( + Icons.person_outline, + color: ColorManager.primaryColor, + ), + const SizedBox( + width: 2, + ), + CustomText( + text: jop.user == null + ? 'other' + : jop.user!.username.toString(), + fontSize: 12.sp, + fontWeight: FontWeight.w600, + color: Colors.grey, + ), + ], + ), + Expanded( + child: Row( + // mainAxisAlignment: MainAxisAlignment.start, + children: [ + const Icon( + Icons.access_time_outlined, + color: ColorManager.primaryColor, + ), + Expanded( + child: CustomText( + align: TextAlign.start, + text: 'createdAt ', + fontSize: 12.sp, + fontWeight: FontWeight.w600, + color: Colors.grey, + ), + ) + ], + ), + ), + Expanded( + child: Row( + // mainAxisAlignment: MainAxisAlignment.start, + children: [ + SvgPicture.asset( + 'assets/images/Chat_Circle_Dots.svg', + height: 25.h, + width: 25.w, + fit: BoxFit.cover, + color: ColorManager.primaryColor, + ), + Expanded( + child: CustomText( + text: + '${jop.category?.title} → ${jop.jobType!.title}' ?? + 'other', + fontSize: 12.sp, + fontWeight: FontWeight.w600, + color: Colors.grey, + ), + ) + ], + ), + ), + ], + ), + ), + if(jop.description !=null) + Padding( + padding: const EdgeInsets.only(left: 8.0,right: 8, top: 8), + child: CustomText( + text: jop.description, + color: Colors.black45, + fontWeight: FontWeight.w500, + align: TextAlign.start, + fontSize: 16.sp, + )), + Padding( + padding: const EdgeInsets.all(12.0), + child: SizedBox( + height: 7.h, + width: 1.sw, + child: const Divider(), + ), + ), + Padding( +<<<<<<< HEAD + padding: EdgeInsets.only(top: 20.h, left: 12.r), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + CustomText( + text: 'CONTACT DETAILS', + fontWeight: FontWeight.w500, + fontSize: 18.sp, + color: Colors.black38, + ), +======= + padding: EdgeInsets.only(top: 15.h), + child: Column( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Padding( + padding: EdgeInsets.only(left: 33.w, bottom: 15.h, top: 15.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + CustomText(text: 'CONTACT DETAILS'), + ], + ), + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Expanded( + child: Row( + children: [ + const Icon( + Icons.email_outlined, + color: ColorManager.primaryColor, + ), + const SizedBox( + width: 6, + ), + CustomText( + text: jop.user == null + ? 'other' + : jop.user!.email.toString(), + fontSize: 12.sp, + fontWeight: FontWeight.w600, + color: Colors.grey, + ), + const SizedBox( + width: 6, + ), + ], + ), + ), + + Row( + children: [ + const Icon( + Icons.phone_callback, + color: ColorManager.primaryColor, + ), + const SizedBox( + width: 6, + ), + CustomText( + text: jop.user == null + ? 'other' + : jop.user!.contactNumber.toString(), + fontSize: 12.sp, + fontWeight: FontWeight.w600, + color: Colors.grey, + ), + const SizedBox( + width: 6, + ), + ], + ), + + ], + ) +>>>>>>> nada + ], + ), + ) + ], + ), + ); + } +} diff --git a/lib/widgets/widgets/custom_container_load_detail.dart b/lib/widgets/widgets/custom_container_load_detail.dart new file mode 100644 index 0000000..4fcc343 --- /dev/null +++ b/lib/widgets/widgets/custom_container_load_detail.dart @@ -0,0 +1,309 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:hoga_load/core/app_images/app_images.dart'; +import 'package:hoga_load/core/color_manager/color_manager.dart'; +import 'package:hoga_load/core/widgets/custom_card.dart'; +import 'package:hoga_load/features/blogs/blog_details.dart'; +import 'package:hoga_load/widgets/widgets/custom_text.dart'; + +import '../../core/data/models/loads/GetLoads_model.dart'; +import '../../core/data/models/vehicle/vehicles.dart'; +import '../../core/router/router.dart'; + +class CustomContainerLoad extends StatelessWidget { + final GetLoadsModel load; + const CustomContainerLoad(this.load, {Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return CustomCard( +<<<<<<< HEAD + paddingInEnd: 0, + paddingInStart: 0, + bottomPadding: 0, +======= + +>>>>>>> nada + widget: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + top: 15.h, +<<<<<<< HEAD + left: 8.r, + right: 8.r, +======= + left: 8.sp, + right: 8.sp, +>>>>>>> nada + ), + child: Container( + height: 100.h, + width: 1.sw, + child: Column( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Row( + children: [ + CustomText( + text: load.originCity == null + ? 'other' + : load.originCity!.title.toString(), +<<<<<<< HEAD + fontSize: 18.sp, +======= + fontSize: 17.sp, +>>>>>>> nada + fontWeight: FontWeight.w600, + color: ColorManager.primaryColor, + ), + CustomText( + text: load.originState == null + ? 'other' + : ' (${'${load.originState!.title!.toString()},${load.originCountry!.title!.toString()}'})', +<<<<<<< HEAD + fontSize: 16.sp, +======= + fontSize: 15.sp, +>>>>>>> nada + fontWeight: FontWeight.w600, + color: ColorManager.primaryColor, + ), + ], + ), + Row( + children: [ + const Icon( + Icons.arrow_right_alt, + color: ColorManager.primaryColor, + ), + CustomText( + text: load.destinationCity == null + ? 'other' + : '${load.destinationCity!.title!.toString()} City ', +<<<<<<< HEAD + fontSize: 18.sp, + fontWeight: FontWeight.w600, + color: ColorManager.primaryColor, + ), + CustomText( + text: load.destinationState == null + ? 'other' + : '(${'${load.destinationState!.title!.toString()},${load.destinationCountry!.title!.toString()}'})', + fontSize: 16.sp, + fontWeight: FontWeight.w600, + color: ColorManager.primaryColor, +======= + fontSize: 17.sp, + fontWeight: FontWeight.w600, + color: ColorManager.primaryColor, + ), + Expanded( + child: CustomText( + // height: 38.h, + text: load.destinationState == null + ? 'other' + : '(${'${load.destinationState!.title!.toString()},${load.destinationCountry!.title!.toString()}'})', + fontSize: 15.sp, + fontWeight: FontWeight.w600, + color: ColorManager.primaryColor, + ), +>>>>>>> nada + ), + ], + ) + ], + ), + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Row( + children: [ + const Icon( + Icons.person_outline, + color: ColorManager.primaryColor, + ), + const SizedBox( + width: 6, + ), + CustomText( + text: load.user == null + ? 'other' + : load.user!.username.toString(), + fontSize: 12.sp, + fontWeight: FontWeight.w600, + color: Colors.grey, + ), + const SizedBox( + width: 6, + ), + ], + ), + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + const Icon( + Icons.access_time_outlined, + color: ColorManager.primaryColor, + ), + Expanded( + child: CustomText( + align: TextAlign.start, + text: 'createdAt ', + fontSize: 12.sp, + fontWeight: FontWeight.w600, + color: Colors.grey, + ), + ) + ], + ), + ), + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SvgPicture.asset( + 'assets/images/Chat_Circle_Dots.svg', + height: 25.h, + width: 25.w, + fit: BoxFit.cover, + color: ColorManager.primaryColor, + ), + Expanded( + child: CustomText( + text: '${load.weight} Kg(s)' ?? 'other', + fontSize: 12.sp, + fontWeight: FontWeight.w600, + color: Colors.grey, + ), + ) + ], + ), + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.all(12.0), + child: SizedBox( + height: 7.h, + width: 1.sw, + child: const Divider(), + ), + ), + Padding( + padding: EdgeInsets.only(top: 15.h), + child: Column( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Padding( + padding: EdgeInsets.only(left: 33.w, bottom: 15.h, top: 15.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + CustomText(text: 'CONTACT DETAILS'), + ], + ), + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ +<<<<<<< HEAD + Padding( + padding: EdgeInsets.only( + left: 20.w, bottom: 15.h, right: 20.w, top: 15.h), +======= + + Padding( + padding: EdgeInsets.only( + left: 5.w, bottom: 15.h, right: 5.w, top: 15.h), +>>>>>>> nada + child: Row( + children: [ + const Icon( + Icons.phone_callback, + color: ColorManager.primaryColor, + ), + const SizedBox( + width: 6, + ), + CustomText( + text: load.user == null + ? 'other' + : load.user!.contactNumber.toString(), + fontSize: 12.sp, + fontWeight: FontWeight.w600, + color: Colors.grey, + ), + const SizedBox( + width: 6, + ), + ], + ), + ), +<<<<<<< HEAD + Row( + children: [ + const Icon( + Icons.email_outlined, + color: ColorManager.primaryColor, + ), + const SizedBox( + width: 6, + ), + CustomText( + text: load.user == null + ? 'other' + : load.user!.email.toString(), + fontSize: 12.sp, + fontWeight: FontWeight.w600, + color: Colors.grey, + ), + const SizedBox( + width: 6, + ), + ], +======= + + Expanded( + child: Row( + children: [ + const Icon( + Icons.email_outlined, + color: ColorManager.primaryColor, + ), + const SizedBox( + width: 6, + ), + CustomText( + text: load.user == null + ? 'other' + : load.user!.email.toString(), + fontSize: 12.sp, + fontWeight: FontWeight.w600, + color: Colors.grey, + ), + const SizedBox( + width: 6, + ), + ], + ), +>>>>>>> nada + ), + ], + ) + ], + ), + ) + ], + ), + ); + } +} diff --git a/lib/widgets/widgets/custom_container_product_detail.dart b/lib/widgets/widgets/custom_container_product_detail.dart new file mode 100644 index 0000000..3d6695a --- /dev/null +++ b/lib/widgets/widgets/custom_container_product_detail.dart @@ -0,0 +1,166 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:hoga_load/core/app_images/app_images.dart'; +import 'package:hoga_load/core/color_manager/color_manager.dart'; +import 'package:hoga_load/core/widgets/custom_card.dart'; +import 'package:hoga_load/features/blogs/blog_details.dart'; +import 'package:hoga_load/widgets/widgets/custom_text.dart'; + +import '../../core/data/models/loads/GetLoads_model.dart'; +import '../../core/data/models/product/GetProduct_model.dart'; +import '../../core/data/models/vehicle/vehicles.dart'; +import '../../core/router/router.dart'; + +class CustomContainerProduct extends StatelessWidget { + final GetProductModel product; + const CustomContainerProduct(this.product, {Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return CustomCard( + paddingInEnd: 0, + paddingInStart: 0, + bottomPadding: 0, + widget: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + width: 1.sw, + height: 200.h, + child: Image(image: NetworkImage(product.productImage!)), + ), + Padding( + padding: EdgeInsets.only( + top: 15.h, + left: 8.r, + right: 8.r, + ), + child: Center( + child: CustomText( + align: TextAlign.center, + fontSize: 18.sp, + fontWeight: FontWeight.w600, + color: Colors.black87, + text: product.productName, + )), + ), + SizedBox( + height: 10.h, + child: const Divider(), + ), + Padding( + padding: EdgeInsets.all(12.r), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 8.0.w), + child: Row( + children: [ + CustomText( + align: TextAlign.center, + fontSize: 18.sp, + fontWeight: FontWeight.w600, + color: Colors.black87, + text: ' productType', + ), + CustomText( + align: TextAlign.center, + fontSize: 18.sp, + fontWeight: FontWeight.w500, + color: Colors.black38, + text: ': ${product.productType!.title}', + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 8.0.w), + child: Row( + children: [ + CustomText( + align: TextAlign.center, + fontSize: 18.sp, + fontWeight: FontWeight.w600, + color: Colors.black87, + text: ' Purpose', + ), + CustomText( + align: TextAlign.center, + fontSize: 18.sp, + fontWeight: FontWeight.w500, + color: Colors.black38, + text: ': For ${product.buyOrSell}', + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 8.0.w), + child: Row( + children: [ + CustomText( + align: TextAlign.center, + fontSize: 18.sp, + fontWeight: FontWeight.w600, + color: Colors.black87, + text: ' Posted On', + ), + CustomText( + align: TextAlign.center, + fontSize: 18.sp, + fontWeight: FontWeight.w500, + color: Colors.black38, + text: ': ${product.status.toString()}', + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 8.0.w), + child: Row( + children: [ + CustomText( + align: TextAlign.center, + fontSize: 18.sp, + fontWeight: FontWeight.w600, + color: Colors.black87, + text: ' Price', + ), + CustomText( + align: TextAlign.center, + fontSize: 18.sp, + fontWeight: FontWeight.w500, + color: Colors.black38, + text: ': \$ ${product.price}', + ), + ], + ), + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.all(12.0), + child: SizedBox( + height: 7.h, + width: 1.sw, + child: const Divider(), + ), + ), + Padding( + padding: EdgeInsets.only(top: 20.h,left:12.r), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + CustomText(text: 'CONTACT DETAILS',fontWeight: FontWeight.w500,fontSize: 18.sp, + color: Colors.black38,), + ], + ), + ) + ], + ), + ); + } +} diff --git a/lib/widgets/widgets/custom_container_vehicle_detail.dart b/lib/widgets/widgets/custom_container_vehicle_detail.dart new file mode 100644 index 0000000..034f0d6 --- /dev/null +++ b/lib/widgets/widgets/custom_container_vehicle_detail.dart @@ -0,0 +1,233 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:hoga_load/core/app_images/app_images.dart'; +import 'package:hoga_load/core/color_manager/color_manager.dart'; +import 'package:hoga_load/core/widgets/custom_card.dart'; +import 'package:hoga_load/features/blogs/blog_details.dart'; +import 'package:hoga_load/widgets/widgets/custom_text.dart'; + + +import '../../core/data/models/vehicle/vehicles.dart'; +import '../../core/router/router.dart'; + +class CustomContainerVehicle extends StatelessWidget { + final Vehicles vehicle; + CustomContainerVehicle(this.vehicle, {Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return CustomCard( + paddingInEnd: 0, + paddingInStart: 0, + bottomPadding: 0, + widget: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(top: 25.h,left: 8.r,right: 8.r,), + child: Container( + height: 80.h, + width: 1.sw, + child: Column( + children: [ + + Row( + children: [ + CustomText( + text: vehicle.originCity ==null ?'other':'${vehicle.originCity!.title}', + fontSize: 18.sp, + fontWeight: FontWeight.w600, + color: ColorManager.primaryColor, + ), + Expanded( + child: CustomText( + text: vehicle.originState ==null ?'other':' (${vehicle.originState!.title},${vehicle.originCountry!.title})' , + fontSize: 16.sp, + fontWeight: FontWeight.w600, + color: ColorManager.primaryColor, + ), + ), + ], + ), + Row( + children: [ + const Icon(Icons.arrow_right_alt,color: ColorManager.primaryColor,), + CustomText( + text: vehicle.destinationCity ==null ? 'other':vehicle.destinationCity!.title.toString(), + fontSize: 18.sp, + fontWeight: FontWeight.w600, + color: ColorManager.primaryColor, + ), + + Expanded( + child: CustomText( + text: vehicle.destinationState ==null ? 'other':' (${vehicle.destinationState!.title}, ${vehicle.destinationCountry!.title})', + fontSize: 16.sp, + fontWeight: FontWeight.w600, + + color: ColorManager.primaryColor, + ), + ), + ], + ), + ], + ), + ), + ), + + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Row( + children: [ + const Icon( + Icons.person_outline, + color: ColorManager.primaryColor, + ), + const SizedBox( + width: 6, + ), + CustomText( + text: vehicle.user == null + ? 'other' + : vehicle.user!.username.toString(), + fontSize: 12.sp, + fontWeight: FontWeight.w600, + color: Colors.grey, + ), + const SizedBox( + width: 6, + ), + ], + ), + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + const Icon( + Icons.access_time_outlined, + color: ColorManager.primaryColor, + ), + Expanded( + child: CustomText( + align: TextAlign.start, + text: vehicle.createdAt! + .substring(0, vehicle.createdAt!.indexOf('T')), + fontSize: 12.sp, + fontWeight: FontWeight.w600, + color: Colors.grey, + ), + ) + ], + ), + ), + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SvgPicture.asset( + 'assets/images/Chat_Circle_Dots.svg', + height: 25.h, + width: 25.w, + fit: BoxFit.cover, + color: ColorManager.primaryColor, + ), + Expanded( + child: CustomText( + text: '${vehicle.weight} Kg(s)'??'other Kg(s)', + fontSize: 12.sp, + fontWeight: FontWeight.w600, + color: Colors.grey, + ), + ) + ], + ), + ), + ], + ), + ), + + Padding( + padding: const EdgeInsets.all(12.0), + child: SizedBox( + height: 7.h, + width: 1.sw, + child: const Divider(), + ), + ), + + Padding( + padding: EdgeInsets.only(top: 15.h), + child: Column( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Padding( + padding: EdgeInsets.only(left: 33.w,bottom: 15.h,top: 15.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + CustomText(text: 'CONTACT DETAILS'), + ], + ), + ), + + + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 15.h,top: 15.h), + child: Row( + children: [ + const Icon( + Icons.phone_callback, + color: ColorManager.primaryColor, + ), + const SizedBox( + width: 6, + ), + CustomText( + text: vehicle.user == null + ? 'other' + : vehicle.user!.contactNumber.toString(), + fontSize: 12.sp, + fontWeight: FontWeight.w600, + color: Colors.grey, + ), + + ], + ), + ), + Row( + children: [ + const Icon( + Icons.email_outlined, + color: ColorManager.primaryColor, + ), + + CustomText( + text: vehicle.user == null + ? 'other' + : vehicle.user!.email.toString(), + fontSize: 10.sp, + fontWeight: FontWeight.w600, + color: Colors.grey, + ), + const SizedBox( + width: 6, + ), + ], + ), + ], + ) + ], + ), + ) + ], + ), + ); + } +} \ No newline at end of file diff --git a/lib/widgets/widgets/custom_logo.dart b/lib/widgets/widgets/custom_logo.dart index 1e9827e..f9ab9e0 100644 --- a/lib/widgets/widgets/custom_logo.dart +++ b/lib/widgets/widgets/custom_logo.dart @@ -1,8 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import '../../core/app_images/app_images.dart'; - class CustomLogo extends StatelessWidget { const CustomLogo({Key? key}) : super(key: key); diff --git a/lib/widgets/widgets/custom_package.dart b/lib/widgets/widgets/custom_package.dart index ff0dcc0..2921363 100644 --- a/lib/widgets/widgets/custom_package.dart +++ b/lib/widgets/widgets/custom_package.dart @@ -1,9 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:hoga_load/core/color_manager/color_manager.dart'; +import 'package:hoga_load/core/router/router.dart'; +import 'package:hoga_load/features/add_update_card/view.dart'; import 'package:hoga_load/widgets/widgets/custom_button.dart'; import 'package:hoga_load/widgets/widgets/custom_text.dart'; -import 'package:hoga_load/widgets/widgets/custom_text_field.dart'; class CustomPackage extends StatefulWidget { CustomPackage({ @@ -234,6 +235,7 @@ class _CustomPackageState extends State { Padding( padding: EdgeInsets.only(left: 41.w,right: 13.w), child: CustomButton( + function: ()=>MagicRouter.navigateTo(const AddUpdateCardView()), text: 'BUY NOW', colortext: const Color(0xFFFDC52F), colorborder: const Color(0xFFFDC52F), color: Colors.white, diff --git a/lib/widgets/widgets/custom_row.dart b/lib/widgets/widgets/custom_row.dart index 312db5e..0d05a25 100644 --- a/lib/widgets/widgets/custom_row.dart +++ b/lib/widgets/widgets/custom_row.dart @@ -3,15 +3,18 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:hoga_load/core/app_images/app_images.dart'; import 'package:hoga_load/core/color_manager/color_manager.dart'; +import 'package:hoga_load/core/data/models/product/GetProduct_model.dart'; import 'package:hoga_load/features/jobs/cubit/getJop_cubit.dart'; import 'package:hoga_load/features/loads/cubit/getLoad_cubit.dart'; import 'package:hoga_load/features/search_product/cubit/getProduct_cubit.dart'; -import '../../features/add_vehicle/cubit/getVehicle_cubit.dart'; +import '../../features/vehicles/get_vehicles/cubit/vehicle_cubit.dart'; class CustomSearchRow extends StatelessWidget { - var index; - CustomSearchRow(this.index, {super.key}); + int index; + var function; + + CustomSearchRow(this.index, {super.key,this.function}); @override Widget build(BuildContext context) { @@ -33,13 +36,13 @@ class CustomSearchRow extends StatelessWidget { index == 1 ? VehiclesCubit.get(context) - .searchVehicles(val.trim(), context) + .searchVehicles(context,val:val.trim()) : index == 2 ? LoadsCubit.get(context) - .searchLoads(val.trim(), context) + .searchLoads(val:val.trim(), context) : index == 3 ? ProductsCubit.get(context) - .searchProducts(val.trim(), context) + .searchProducts(GetProductModel(search:val.trim() )) : index == 4 ? JopCubit.get(context) .searchJop(val.trim(), context) @@ -59,14 +62,17 @@ class CustomSearchRow extends StatelessWidget { SizedBox( width: 10.sp, ), - Container( - height: 50.h, - width: 50.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12.r), - color: Colors.orangeAccent), - child: Center( - child: SvgPicture.asset(AppImages.slider), + InkWell( + onTap: function, + child: Container( + height: 50.h, + width: 50.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12.r), + color: Colors.orangeAccent), + child: Center( + child: SvgPicture.asset(AppImages.slider), + ), ), ) ], diff --git a/lib/widgets/widgets/custom_scaffold.dart b/lib/widgets/widgets/custom_scaffold.dart index b8d8c0e..2af089a 100644 --- a/lib/widgets/widgets/custom_scaffold.dart +++ b/lib/widgets/widgets/custom_scaffold.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import '../../core/color_manager/color_manager.dart'; class CustomScaffold extends StatelessWidget { diff --git a/lib/widgets/widgets/custom_text.dart b/lib/widgets/widgets/custom_text.dart index ed09528..96fc936 100644 --- a/lib/widgets/widgets/custom_text.dart +++ b/lib/widgets/widgets/custom_text.dart @@ -1,6 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:google_fonts/google_fonts.dart'; import '../../core/color_manager/color_manager.dart'; diff --git a/lib/widgets/widgets/custom_text_field.dart b/lib/widgets/widgets/custom_text_field.dart index bd5ba92..4790d36 100644 --- a/lib/widgets/widgets/custom_text_field.dart +++ b/lib/widgets/widgets/custom_text_field.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import '../../core/color_manager/color_manager.dart'; -import 'custom_text.dart'; // ignore: must_be_immutable class CustomTextField extends StatelessWidget { diff --git a/lib/widgets/widgets/upgrade_member_ship.dart b/lib/widgets/widgets/upgrade_member_ship.dart new file mode 100644 index 0000000..9a86374 --- /dev/null +++ b/lib/widgets/widgets/upgrade_member_ship.dart @@ -0,0 +1,40 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import '../../core/widgets/custom_card.dart'; +import '../../core/widgets/custom_card_title.dart'; +import '../../core/widgets/custom_no_container.dart'; +import '../../features/vehicles/upload_vehicles/view.dart'; + +class UpgradeMember extends StatelessWidget { + UpgradeMember({super.key}); + bool isUpgradeMember = true; + @override + Widget build(BuildContext context) { + return CustomCard( + widget: Padding( + padding: EdgeInsets.symmetric(horizontal: 11.sp), + child: Column( + children: [ + SizedBox( + height: 18.h, + ), + CustomCardTitle( + text: 'UPLOADED Vehicles', + ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + CustomNoContainer( + text: 'vehicles', isUpgradeMember: isUpgradeMember), + ], + ), + ), + Button(isUpgradeMember: isUpgradeMember), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/widgets/uploaded_table_row.dart b/lib/widgets/widgets/uploaded_table_row.dart new file mode 100644 index 0000000..ab13fb0 --- /dev/null +++ b/lib/widgets/widgets/uploaded_table_row.dart @@ -0,0 +1,89 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:hoga_load/core/color_manager/color_manager.dart'; +import 'package:hoga_load/core/dialoges/delete_dialoge.dart'; + +import 'custom_text.dart'; +class UploadedTableDataRow extends StatelessWidget { + UploadedTableDataRow({super.key,required this.deleteFunc, + required this.editFunc,required this.tableWeight,required this.origin,required this.tableNumber}); + String? tableNumber; + String? tableWeight; + String? origin; + var editFunc; + var deleteFunc; + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 5), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: 1, + child: CustomText( + text: tableNumber, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + ), + Expanded( + flex: 8, + child: CustomText( + text: origin, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + ), + Expanded( + flex: 2, + child: CustomText( + text: tableWeight, + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w500, + ), + ), + Expanded( + flex: 3, + child: Row( + children: [ + InkWell( + onTap:(){ + showDialog(context: context, builder:(context)=> DeleteEditDialog(function: editFunc,btnText: 'Edit',)); + + }, + child: CustomText( + text: 'Edit', + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w200, + color: ColorManager.primaryColor, + ), + ), + SizedBox(width: 5.sp,), + InkWell( + onTap:(){ + showDialog(context: context, builder:(context)=> DeleteEditDialog(function: deleteFunc,btnText: 'Delete',)); + }, + child: CustomText( + text: 'Delete', + align: TextAlign.start, + fontSize: 8.sp, + fontWeight: FontWeight.w200, + color: Colors.red, + ), + ), + + ], + ), + ), + + ], + ), + ); + } +} diff --git a/lib/widgets/widgets/uploaded_table_title.dart b/lib/widgets/widgets/uploaded_table_title.dart new file mode 100644 index 0000000..6c16bf1 --- /dev/null +++ b/lib/widgets/widgets/uploaded_table_title.dart @@ -0,0 +1,83 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'custom_text.dart'; +class UploadedTableTitle extends StatelessWidget { + UploadedTableTitle({super.key, required this.child}); + Widget child; + + @override + Widget build(BuildContext context) { + return Expanded( + child: ListView( + children: [ + SizedBox( + height: 0.7.sh, + + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0.w), + child: Container( + height: 43.h, + width: 1.sw, + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(15), + topRight: Radius.circular(15))), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex:1, + child: CustomText( + text: "#", + fontSize: 9.sp, + align: TextAlign.start, + fontWeight: FontWeight.w700, + ), + ), + Expanded( + flex:8, + child: CustomText( + text: "Origin&Destintion", + fontSize: 9.sp, + align: TextAlign.start, + fontWeight: FontWeight.w700, + ), + ), + Expanded( + flex:2, + child: CustomText( + text: "Weight", + fontSize: 9.sp, + align: TextAlign.start, + fontWeight: FontWeight.w700, + ), + ), + Expanded( + flex:3, + child: CustomText( + text: "View(s)", + fontSize: 9.sp, + align: TextAlign.start, + fontWeight: FontWeight.w700, + ), + ), + + ], + ) + + ), + ), + Expanded(child: child) + + ], + ), + + ), + ]), + ); + } +} diff --git a/pubspec.lock b/pubspec.lock index 014c374..3deb2c3 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -36,6 +36,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.0" + cached_network_image: + dependency: "direct main" + description: + name: cached_network_image + url: "https://pub.dartlang.org" + source: hosted + version: "3.2.2" + cached_network_image_platform_interface: + dependency: transitive + description: + name: cached_network_image_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + cached_network_image_web: + dependency: transitive + description: + name: cached_network_image_web + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" characters: dependency: transitive description: @@ -148,6 +169,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.0.6" + expandable: + dependency: "direct main" + description: + name: expandable + url: "https://pub.dartlang.org" + source: hosted + version: "5.0.1" fake_async: dependency: transitive description: @@ -181,6 +209,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "8.1.1" + flutter_blurhash: + dependency: transitive + description: + name: flutter_blurhash + url: "https://pub.dartlang.org" + source: hosted + version: "0.7.0" + flutter_cache_manager: + dependency: transitive + description: + name: flutter_cache_manager + url: "https://pub.dartlang.org" + source: hosted + version: "3.3.0" flutter_lints: dependency: "direct dev" description: @@ -209,6 +251,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.5" + flutter_swiper_view: + dependency: "direct main" + description: + name: flutter_swiper_view + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.8" flutter_test: dependency: "direct dev" description: flutter @@ -345,6 +394,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.5.0" + octo_image: + dependency: transitive + description: + name: octo_image + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" page_transition: dependency: transitive description: @@ -422,6 +478,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.3" + pedantic: + dependency: transitive + description: + name: pedantic + url: "https://pub.dartlang.org" + source: hosted + version: "1.11.1" petitparser: dependency: transitive description: @@ -457,6 +520,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "6.0.3" + rxdart: + dependency: transitive + description: + name: rxdart + url: "https://pub.dartlang.org" + source: hosted + version: "0.27.5" shared_preferences: dependency: "direct main" description: @@ -525,6 +595,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.9.0" + sqflite: + dependency: transitive + description: + name: sqflite + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.0+3" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + url: "https://pub.dartlang.org" + source: hosted + version: "2.4.0+2" stack_trace: dependency: transitive description: @@ -546,6 +630,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.1" + synchronized: + dependency: transitive + description: + name: synchronized + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.0+3" term_glyph: dependency: transitive description: @@ -623,6 +714,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.0.1" + uuid: + dependency: transitive + description: + name: uuid + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.6" vector_math: dependency: transitive description: @@ -652,5 +750,5 @@ packages: source: hosted version: "6.1.0" sdks: - dart: ">=2.17.6 <3.0.0" - flutter: ">=3.0.0" + dart: ">=2.18.0 <3.0.0" + flutter: ">=3.3.0" diff --git a/pubspec.yaml b/pubspec.yaml index 50a05c8..6bc26a7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -51,7 +51,9 @@ dependencies: url_launcher: ^6.1.6 date_time_picker: "^2.1.0" data_table_2: ^2.3.8 - + expandable: ^5.0.1 + flutter_swiper_view: ^1.1.8 + cached_network_image: ^3.2.2 dev_dependencies: flutter_test: