1 - search in map with api
2 - show details in selected location
This commit is contained in:
2025-07-30 12:31:47 +03:30
parent 2806301367
commit f563c6188e
25 changed files with 3960 additions and 337 deletions

View File

@@ -23,7 +23,7 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
itemBuilder: (context, index) {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ListItem2(
return ExpandableListItem2(
selected: val.contains(index),
onTap: () => controller.isExpandedList.toggle(index),
index: index,

View File

@@ -24,7 +24,7 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
itemBuilder: (context, index) {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ListItem2(
return ExpandableListItem2(
selected: val.contains(index),
onTap: () => controller.isExpandedList.toggle(index),
index: index,

View File

@@ -36,7 +36,7 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
itemBuilder: (context, index) {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ListItem2(
return ExpandableListItem2(
selected: val.contains(index),
onTap: () => controller.isExpandedList.toggle(index),
index: index,

View File

@@ -45,7 +45,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
itemBuilder: (context, index) {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ListItem2(
return ExpandableListItem2(
selected: val.contains(index),
onTap: () => controller.isExpandedList.toggle(index),
index: index,

View File

@@ -42,7 +42,7 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
itemBuilder: (context, index) {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ListItem2(
return ExpandableListItem2(
selected: val.contains(index),
onTap: () => controller.isExpandedList.toggle(index),
index: index,

View File

@@ -36,7 +36,7 @@ class SalesOutOfProvinceBuyersPage extends GetView<SalesOutOfProvinceBuyersLogic
itemBuilder: (context, index) {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ListItem2(
return ExpandableListItem2(
selected: val.contains(index),
onTap: () => controller.isExpandedList.toggle(index),
index: index,

View File

@@ -31,7 +31,7 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
itemBuilder: (context, index) {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ListItem2(
return ExpandableListItem2(
selected: val.contains(index),
onTap: () => controller.isExpandedList.toggle(index),
index: index,

View File

@@ -35,7 +35,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
itemBuilder: (context, index) {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ListItem2(
return ExpandableListItem2(
selected: val.contains(index),
onTap: () => controller.isExpandedList.toggle(index),
index: index,

View File

@@ -3,9 +3,16 @@ import 'package:flutter/material.dart';
import 'package:rasadyar_core/presentation/common/app_color.dart';
class BaseBottomSheet extends StatelessWidget {
const BaseBottomSheet({super.key, required this.child, this.height, this.bgColor});
const BaseBottomSheet({
super.key,
this.child,
this.height,
this.bgColor,
this.rootChild,
}):assert(child==null || rootChild==null, 'You can only provide one of child or rootChild');
final Widget child;
final Widget? child;
final Widget? rootChild;
final double? height;
final Color? bgColor;
@@ -51,8 +58,8 @@ class BaseBottomSheet extends StatelessWidget {
],
),
),
SizedBox(height:8),
Expanded(child: SingleChildScrollView(child: child)),
SizedBox(height: 8),
Expanded(child: rootChild ?? SingleChildScrollView(child: child)),
],
),
),

View File

@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
class ListItem2 extends StatelessWidget {
const ListItem2({
class ExpandableListItem2 extends StatelessWidget {
const ExpandableListItem2({
super.key,
required this.index,
required this.child,
@@ -115,3 +115,98 @@ class ListItem2 extends StatelessWidget {
);
}
}
class ListItem2 extends StatelessWidget {
const ListItem2({
super.key,
required this.index,
required this.child,
required this.labelColor,
required this.labelIcon,
this.onTap,
this.labelIconColor = AppColor.mediumGreyDarkHover,
});
final int index;
final Widget child;
final Color labelColor;
final String labelIcon;
final Color? labelIconColor;
final VoidCallback? onTap;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: Container(
width: Get.width,
margin: const EdgeInsets.fromLTRB(0, 0, 10, 0),
decoration: BoxDecoration(
color: labelColor,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 1, color: AppColor.lightGreyNormalHover),
),
child: Stack(
clipBehavior: Clip.none,
alignment: Alignment.centerRight,
children: [
Row(
children: [
Expanded(
child: Container(
height: 75,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.zero,
bottomRight: Radius.circular(8),
topLeft: Radius.zero,
topRight: Radius.circular(8),
),
),
clipBehavior: Clip.antiAlias,
child: child,
),
),
Container(
width: 20,
child: Center(
child: SvgGenImage.vec(labelIcon).svg(
width: 16.w,
height: 16.h,
//TODO
colorFilter: ColorFilter.mode(
labelIconColor ?? AppColor.mediumGreyDarkActive,
BlendMode.srcIn,
),
),
),
),
],
),
Positioned(
right: -12,
child: Container(
width: index < 999 ? 24 : null,
height: index < 999 ? 24 : null,
padding: EdgeInsets.all(2),
decoration: BoxDecoration(
color: AppColor.greenLightHover,
borderRadius: BorderRadius.circular(4),
border: Border.all(width: 0.50, color: AppColor.greenDarkActive),
),
alignment: Alignment.center,
child: Text(
(index + 1).toString(),
style: AppFonts.yekan12.copyWith(color: Colors.black),
),
),
),
],
),
),
);
}
}

View File

@@ -10,12 +10,8 @@ Map<String, dynamic> buildQueryParams({
DateTime? toDate,
String? role,
String? state,
}) {
final params = <String, dynamic>{};
if (fromDate != null) {
params['date1'] = fromDate.formattedDashedGregorian;
}
@@ -30,7 +26,6 @@ Map<String, dynamic> buildQueryParams({
params['value'] = value ?? '';
if (page != null) {
params['page'] = page;
}
@@ -53,3 +48,69 @@ Map<String, dynamic> buildQueryParams({
return params;
}
Map<String, dynamic>? buildRawQueryParams({
Map<String, dynamic>? queryParams,
String? search,
String? value,
int? page,
int? pageSize,
DateTime? fromDate,
DateTime? toDate,
String? role,
String? state,
double? centerLat,
double? centerLng,
double? radius,
}) {
final params = <String, dynamic>{};
if (fromDate != null) {
params['date1'] = fromDate.formattedDashedGregorian;
}
if (toDate != null) {
params['date2'] = toDate.formattedDashedGregorian;
}
if (search != null && search.isNotEmpty) {
params['search'] = search;
}
if (value != null) {
params['value'] = value ?? '';
}
if (page != null) {
params['page'] = page;
}
if (pageSize != null) {
params['page_size'] = pageSize;
}
if (role != null && role.isNotEmpty) {
params['role'] = role;
}
if (state != null && state.isNotEmpty) {
params['state'] = state;
}
if (queryParams != null) {
params.addAll(queryParams);
}
if (centerLat != null) {
params['center_lat'] = centerLat ?? '';
}
if (centerLng != null) {
params['center_lon'] = centerLng ?? '';
}
if (radius != null) {
params['radius'] = radius ?? '';
}
return params.keys.isEmpty ? null : params;
}

View File

@@ -13,10 +13,10 @@ abstract class InspectionRemoteDataSource {
/// containing the list of inspections.
Future<List<Map<String, dynamic>>> fetchInspections(String userId);
Future<List<PoultryLocationModel>?> getNearbyLocation({
double? centerLat,
double? centerLng,
double? radius,
double? centerLat,
double? centerLng,
double? radius,
String? value,
});
}

View File

@@ -25,13 +25,19 @@ class InspectionRemoteDataSourceImp implements InspectionRemoteDataSource {
double? centerLat,
double? centerLng,
double? radius,
String? value,
}) async {
DioRemote dioRemote = DioRemote(baseUrl: 'https://habackend.rasadyaar.ir/');
await dioRemote.init();
var res = await dioRemote.get<List<PoultryLocationModel>>(
'poultry-loc/',
queryParameters: {'center_lat': centerLat, 'center_lng': centerLng, 'radius': radius},
queryParameters: buildRawQueryParams(
centerLat: centerLat,
centerLng: centerLng,
radius: radius,
value: value,
),
headers: {'Content-Type': 'application/json'},
fromJsonList: (json) =>
json.map((item) => PoultryLocationModel.fromJson(item as Map<String, dynamic>)).toList(),

View File

@@ -0,0 +1,210 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'hatching_details.freezed.dart';
part 'hatching_details.g.dart';
@freezed
abstract class HatchingDetails with _$HatchingDetails {
const factory HatchingDetails({
required int id,
String? chainCompany,
int? age,
dynamic inspectionLosses,
VetFarm? vetFarm,
ActiveKill? activeKill,
KillingInfo? killingInfo,
FreeGovernmentalInfo? freeGovernmentalInfo,
String? key,
DateTime? createDate,
DateTime? modifyDate,
bool? trash,
bool? hasChainCompany,
dynamic poultryIdForeignKey,
dynamic poultryHatchingIdKey,
int? quantity,
int? losses,
int? leftOver,
int? killedQuantity,
int? extraKilledQuantity,
double? governmentalKilledQuantity,
double? governmentalQuantity,
double? freeKilledQuantity,
double? freeQuantity,
double? chainKilledQuantity,
double? chainKilledWeight,
double? outProvinceKilledWeight,
double? outProvinceKilledQuantity,
double? exportKilledWeight,
double? exportKilledQuantity,
double? totalCommitment,
String? commitmentType,
double? totalCommitmentQuantity,
double? totalFreeCommitmentQuantity,
double? totalFreeCommitmentWeight,
double? totalKilledWeight,
double? totalAverageKilledWeight,
int? requestLeftOver,
int? hall,
DateTime? date,
DateTime? predicateDate,
String? chickenBreed,
int? period,
String? allowHatching,
String? state,
bool? archive,
bool? violation,
dynamic message,
dynamic registrar,
List<Breed>? breed,
int? cityNumber,
String? cityName,
int? provinceNumber,
String? provinceName,
LastChange? lastChange,
int? chickenAge,
int? nowAge,
LatestHatchingChange? latestHatchingChange,
dynamic violationReport,
String? violationMessage,
dynamic violationImage,
dynamic violationReporter,
dynamic violationReportDate,
dynamic violationReportEditor,
dynamic violationReportEditDate,
int? totalLosses,
int? directLosses,
dynamic directLossesInputer,
dynamic directLossesDate,
dynamic directLossesEditor,
dynamic directLossesLastEditDate,
dynamic endPeriodLossesInputer,
dynamic endPeriodLossesDate,
dynamic endPeriodLossesEditor,
dynamic endPeriodLossesLastEditDate,
String? breedingUniqueId,
String? licenceNumber,
bool? temporaryTrash,
bool? temporaryDeleted,
dynamic firstDateInputArchive,
dynamic secondDateInputArchive,
dynamic inputArchiver,
dynamic outputArchiveDate,
dynamic outputArchiver,
double? barDifferenceRequestWeight,
double? barDifferenceRequestQuantity,
dynamic healthCertificate,
int? samasatDischargePercentage,
String? personTypeName,
String? interactTypeName,
String? unionTypeName,
String? certId,
int? increaseQuantity,
dynamic tenantFullname,
dynamic tenantNationalCode,
dynamic tenantMobile,
dynamic tenantCity,
bool? hasTenant,
dynamic createdBy,
dynamic modifiedBy,
int? poultry,
}) = _HatchingDetails;
factory HatchingDetails.fromJson(Map<String, dynamic> json) =>
_$HatchingDetailsFromJson(json);
}
@freezed
abstract class VetFarm with _$VetFarm {
const factory VetFarm({
String? vetFarmFullName,
String? vetFarmMobile,
}) = _VetFarm;
factory VetFarm.fromJson(Map<String, dynamic> json) =>
_$VetFarmFromJson(json);
}
@freezed
abstract class ActiveKill with _$ActiveKill {
const factory ActiveKill({
bool? activeKill,
int? countOfRequest,
}) = _ActiveKill;
factory ActiveKill.fromJson(Map<String, dynamic> json) =>
_$ActiveKillFromJson(json);
}
@freezed
abstract class KillingInfo with _$KillingInfo {
const factory KillingInfo({
String? violationMessage,
int? provinceKillRequests,
int? provinceKillRequestsQuantity,
double? provinceKillRequestsWeight,
int? killHouseRequests,
int? killHouseRequestsFirstQuantity,
double? killHouseRequestsFirstWeight,
int? barCompleteWithKillHouse,
int? acceptedRealQuantityFinal,
double? acceptedRealWightFinal,
int? wareHouseBars,
int? wareHouseBarsQuantity,
double? wareHouseBarsWeight,
double? wareHouseBarsWeightLose,
}) = _KillingInfo;
factory KillingInfo.fromJson(Map<String, dynamic> json) =>
_$KillingInfoFromJson(json);
}
@freezed
abstract class FreeGovernmentalInfo with _$FreeGovernmentalInfo {
const factory FreeGovernmentalInfo({
int? governmentalAllocatedQuantity,
double? totalCommitmentQuantity,
int? freeAllocatedQuantity,
double? totalFreeCommitmentQuantity,
int? leftTotalFreeCommitmentQuantity,
}) = _FreeGovernmentalInfo;
factory FreeGovernmentalInfo.fromJson(Map<String, dynamic> json) =>
_$FreeGovernmentalInfoFromJson(json);
}
@freezed
abstract class Breed with _$Breed {
const factory Breed({
String? breed,
int? mainQuantity,
int? remainQuantity,
}) = _Breed;
factory Breed.fromJson(Map<String, dynamic> json) =>
_$BreedFromJson(json);
}
@freezed
abstract class LastChange with _$LastChange {
const factory LastChange({
DateTime? date,
String? role,
String? type,
String? fullName,
}) = _LastChange;
factory LastChange.fromJson(Map<String, dynamic> json) =>
_$LastChangeFromJson(json);
}
@freezed
abstract class LatestHatchingChange with _$LatestHatchingChange {
const factory LatestHatchingChange({
DateTime? date,
String? role,
String? fullName,
}) = _LatestHatchingChange;
factory LatestHatchingChange.fromJson(Map<String, dynamic> json) =>
_$LatestHatchingChangeFromJson(json);
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,385 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'hatching_details.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_HatchingDetails _$HatchingDetailsFromJson(
Map<String, dynamic> json,
) => _HatchingDetails(
id: (json['id'] as num).toInt(),
chainCompany: json['chain_company'] as String?,
age: (json['age'] as num?)?.toInt(),
inspectionLosses: json['inspection_losses'],
vetFarm: json['vet_farm'] == null
? null
: VetFarm.fromJson(json['vet_farm'] as Map<String, dynamic>),
activeKill: json['active_kill'] == null
? null
: ActiveKill.fromJson(json['active_kill'] as Map<String, dynamic>),
killingInfo: json['killing_info'] == null
? null
: KillingInfo.fromJson(json['killing_info'] as Map<String, dynamic>),
freeGovernmentalInfo: json['free_governmental_info'] == null
? null
: FreeGovernmentalInfo.fromJson(
json['free_governmental_info'] as Map<String, dynamic>,
),
key: json['key'] as String?,
createDate: json['create_date'] == null
? null
: DateTime.parse(json['create_date'] as String),
modifyDate: json['modify_date'] == null
? null
: DateTime.parse(json['modify_date'] as String),
trash: json['trash'] as bool?,
hasChainCompany: json['has_chain_company'] as bool?,
poultryIdForeignKey: json['poultry_id_foreign_key'],
poultryHatchingIdKey: json['poultry_hatching_id_key'],
quantity: (json['quantity'] as num?)?.toInt(),
losses: (json['losses'] as num?)?.toInt(),
leftOver: (json['left_over'] as num?)?.toInt(),
killedQuantity: (json['killed_quantity'] as num?)?.toInt(),
extraKilledQuantity: (json['extra_killed_quantity'] as num?)?.toInt(),
governmentalKilledQuantity: (json['governmental_killed_quantity'] as num?)
?.toDouble(),
governmentalQuantity: (json['governmental_quantity'] as num?)?.toDouble(),
freeKilledQuantity: (json['free_killed_quantity'] as num?)?.toDouble(),
freeQuantity: (json['free_quantity'] as num?)?.toDouble(),
chainKilledQuantity: (json['chain_killed_quantity'] as num?)?.toDouble(),
chainKilledWeight: (json['chain_killed_weight'] as num?)?.toDouble(),
outProvinceKilledWeight: (json['out_province_killed_weight'] as num?)
?.toDouble(),
outProvinceKilledQuantity: (json['out_province_killed_quantity'] as num?)
?.toDouble(),
exportKilledWeight: (json['export_killed_weight'] as num?)?.toDouble(),
exportKilledQuantity: (json['export_killed_quantity'] as num?)?.toDouble(),
totalCommitment: (json['total_commitment'] as num?)?.toDouble(),
commitmentType: json['commitment_type'] as String?,
totalCommitmentQuantity: (json['total_commitment_quantity'] as num?)
?.toDouble(),
totalFreeCommitmentQuantity: (json['total_free_commitment_quantity'] as num?)
?.toDouble(),
totalFreeCommitmentWeight: (json['total_free_commitment_weight'] as num?)
?.toDouble(),
totalKilledWeight: (json['total_killed_weight'] as num?)?.toDouble(),
totalAverageKilledWeight: (json['total_average_killed_weight'] as num?)
?.toDouble(),
requestLeftOver: (json['request_left_over'] as num?)?.toInt(),
hall: (json['hall'] as num?)?.toInt(),
date: json['date'] == null ? null : DateTime.parse(json['date'] as String),
predicateDate: json['predicate_date'] == null
? null
: DateTime.parse(json['predicate_date'] as String),
chickenBreed: json['chicken_breed'] as String?,
period: (json['period'] as num?)?.toInt(),
allowHatching: json['allow_hatching'] as String?,
state: json['state'] as String?,
archive: json['archive'] as bool?,
violation: json['violation'] as bool?,
message: json['message'],
registrar: json['registrar'],
breed: (json['breed'] as List<dynamic>?)
?.map((e) => Breed.fromJson(e as Map<String, dynamic>))
.toList(),
cityNumber: (json['city_number'] as num?)?.toInt(),
cityName: json['city_name'] as String?,
provinceNumber: (json['province_number'] as num?)?.toInt(),
provinceName: json['province_name'] as String?,
lastChange: json['last_change'] == null
? null
: LastChange.fromJson(json['last_change'] as Map<String, dynamic>),
chickenAge: (json['chicken_age'] as num?)?.toInt(),
nowAge: (json['now_age'] as num?)?.toInt(),
latestHatchingChange: json['latest_hatching_change'] == null
? null
: LatestHatchingChange.fromJson(
json['latest_hatching_change'] as Map<String, dynamic>,
),
violationReport: json['violation_report'],
violationMessage: json['violation_message'] as String?,
violationImage: json['violation_image'],
violationReporter: json['violation_reporter'],
violationReportDate: json['violation_report_date'],
violationReportEditor: json['violation_report_editor'],
violationReportEditDate: json['violation_report_edit_date'],
totalLosses: (json['total_losses'] as num?)?.toInt(),
directLosses: (json['direct_losses'] as num?)?.toInt(),
directLossesInputer: json['direct_losses_inputer'],
directLossesDate: json['direct_losses_date'],
directLossesEditor: json['direct_losses_editor'],
directLossesLastEditDate: json['direct_losses_last_edit_date'],
endPeriodLossesInputer: json['end_period_losses_inputer'],
endPeriodLossesDate: json['end_period_losses_date'],
endPeriodLossesEditor: json['end_period_losses_editor'],
endPeriodLossesLastEditDate: json['end_period_losses_last_edit_date'],
breedingUniqueId: json['breeding_unique_id'] as String?,
licenceNumber: json['licence_number'] as String?,
temporaryTrash: json['temporary_trash'] as bool?,
temporaryDeleted: json['temporary_deleted'] as bool?,
firstDateInputArchive: json['first_date_input_archive'],
secondDateInputArchive: json['second_date_input_archive'],
inputArchiver: json['input_archiver'],
outputArchiveDate: json['output_archive_date'],
outputArchiver: json['output_archiver'],
barDifferenceRequestWeight: (json['bar_difference_request_weight'] as num?)
?.toDouble(),
barDifferenceRequestQuantity:
(json['bar_difference_request_quantity'] as num?)?.toDouble(),
healthCertificate: json['health_certificate'],
samasatDischargePercentage: (json['samasat_discharge_percentage'] as num?)
?.toInt(),
personTypeName: json['person_type_name'] as String?,
interactTypeName: json['interact_type_name'] as String?,
unionTypeName: json['union_type_name'] as String?,
certId: json['cert_id'] as String?,
increaseQuantity: (json['increase_quantity'] as num?)?.toInt(),
tenantFullname: json['tenant_fullname'],
tenantNationalCode: json['tenant_national_code'],
tenantMobile: json['tenant_mobile'],
tenantCity: json['tenant_city'],
hasTenant: json['has_tenant'] as bool?,
createdBy: json['created_by'],
modifiedBy: json['modified_by'],
poultry: (json['poultry'] as num?)?.toInt(),
);
Map<String, dynamic> _$HatchingDetailsToJson(_HatchingDetails instance) =>
<String, dynamic>{
'id': instance.id,
'chain_company': instance.chainCompany,
'age': instance.age,
'inspection_losses': instance.inspectionLosses,
'vet_farm': instance.vetFarm,
'active_kill': instance.activeKill,
'killing_info': instance.killingInfo,
'free_governmental_info': instance.freeGovernmentalInfo,
'key': instance.key,
'create_date': instance.createDate?.toIso8601String(),
'modify_date': instance.modifyDate?.toIso8601String(),
'trash': instance.trash,
'has_chain_company': instance.hasChainCompany,
'poultry_id_foreign_key': instance.poultryIdForeignKey,
'poultry_hatching_id_key': instance.poultryHatchingIdKey,
'quantity': instance.quantity,
'losses': instance.losses,
'left_over': instance.leftOver,
'killed_quantity': instance.killedQuantity,
'extra_killed_quantity': instance.extraKilledQuantity,
'governmental_killed_quantity': instance.governmentalKilledQuantity,
'governmental_quantity': instance.governmentalQuantity,
'free_killed_quantity': instance.freeKilledQuantity,
'free_quantity': instance.freeQuantity,
'chain_killed_quantity': instance.chainKilledQuantity,
'chain_killed_weight': instance.chainKilledWeight,
'out_province_killed_weight': instance.outProvinceKilledWeight,
'out_province_killed_quantity': instance.outProvinceKilledQuantity,
'export_killed_weight': instance.exportKilledWeight,
'export_killed_quantity': instance.exportKilledQuantity,
'total_commitment': instance.totalCommitment,
'commitment_type': instance.commitmentType,
'total_commitment_quantity': instance.totalCommitmentQuantity,
'total_free_commitment_quantity': instance.totalFreeCommitmentQuantity,
'total_free_commitment_weight': instance.totalFreeCommitmentWeight,
'total_killed_weight': instance.totalKilledWeight,
'total_average_killed_weight': instance.totalAverageKilledWeight,
'request_left_over': instance.requestLeftOver,
'hall': instance.hall,
'date': instance.date?.toIso8601String(),
'predicate_date': instance.predicateDate?.toIso8601String(),
'chicken_breed': instance.chickenBreed,
'period': instance.period,
'allow_hatching': instance.allowHatching,
'state': instance.state,
'archive': instance.archive,
'violation': instance.violation,
'message': instance.message,
'registrar': instance.registrar,
'breed': instance.breed,
'city_number': instance.cityNumber,
'city_name': instance.cityName,
'province_number': instance.provinceNumber,
'province_name': instance.provinceName,
'last_change': instance.lastChange,
'chicken_age': instance.chickenAge,
'now_age': instance.nowAge,
'latest_hatching_change': instance.latestHatchingChange,
'violation_report': instance.violationReport,
'violation_message': instance.violationMessage,
'violation_image': instance.violationImage,
'violation_reporter': instance.violationReporter,
'violation_report_date': instance.violationReportDate,
'violation_report_editor': instance.violationReportEditor,
'violation_report_edit_date': instance.violationReportEditDate,
'total_losses': instance.totalLosses,
'direct_losses': instance.directLosses,
'direct_losses_inputer': instance.directLossesInputer,
'direct_losses_date': instance.directLossesDate,
'direct_losses_editor': instance.directLossesEditor,
'direct_losses_last_edit_date': instance.directLossesLastEditDate,
'end_period_losses_inputer': instance.endPeriodLossesInputer,
'end_period_losses_date': instance.endPeriodLossesDate,
'end_period_losses_editor': instance.endPeriodLossesEditor,
'end_period_losses_last_edit_date': instance.endPeriodLossesLastEditDate,
'breeding_unique_id': instance.breedingUniqueId,
'licence_number': instance.licenceNumber,
'temporary_trash': instance.temporaryTrash,
'temporary_deleted': instance.temporaryDeleted,
'first_date_input_archive': instance.firstDateInputArchive,
'second_date_input_archive': instance.secondDateInputArchive,
'input_archiver': instance.inputArchiver,
'output_archive_date': instance.outputArchiveDate,
'output_archiver': instance.outputArchiver,
'bar_difference_request_weight': instance.barDifferenceRequestWeight,
'bar_difference_request_quantity': instance.barDifferenceRequestQuantity,
'health_certificate': instance.healthCertificate,
'samasat_discharge_percentage': instance.samasatDischargePercentage,
'person_type_name': instance.personTypeName,
'interact_type_name': instance.interactTypeName,
'union_type_name': instance.unionTypeName,
'cert_id': instance.certId,
'increase_quantity': instance.increaseQuantity,
'tenant_fullname': instance.tenantFullname,
'tenant_national_code': instance.tenantNationalCode,
'tenant_mobile': instance.tenantMobile,
'tenant_city': instance.tenantCity,
'has_tenant': instance.hasTenant,
'created_by': instance.createdBy,
'modified_by': instance.modifiedBy,
'poultry': instance.poultry,
};
_VetFarm _$VetFarmFromJson(Map<String, dynamic> json) => _VetFarm(
vetFarmFullName: json['vet_farm_full_name'] as String?,
vetFarmMobile: json['vet_farm_mobile'] as String?,
);
Map<String, dynamic> _$VetFarmToJson(_VetFarm instance) => <String, dynamic>{
'vet_farm_full_name': instance.vetFarmFullName,
'vet_farm_mobile': instance.vetFarmMobile,
};
_ActiveKill _$ActiveKillFromJson(Map<String, dynamic> json) => _ActiveKill(
activeKill: json['active_kill'] as bool?,
countOfRequest: (json['count_of_request'] as num?)?.toInt(),
);
Map<String, dynamic> _$ActiveKillToJson(_ActiveKill instance) =>
<String, dynamic>{
'active_kill': instance.activeKill,
'count_of_request': instance.countOfRequest,
};
_KillingInfo _$KillingInfoFromJson(Map<String, dynamic> json) => _KillingInfo(
violationMessage: json['violation_message'] as String?,
provinceKillRequests: (json['province_kill_requests'] as num?)?.toInt(),
provinceKillRequestsQuantity:
(json['province_kill_requests_quantity'] as num?)?.toInt(),
provinceKillRequestsWeight: (json['province_kill_requests_weight'] as num?)
?.toDouble(),
killHouseRequests: (json['kill_house_requests'] as num?)?.toInt(),
killHouseRequestsFirstQuantity:
(json['kill_house_requests_first_quantity'] as num?)?.toInt(),
killHouseRequestsFirstWeight:
(json['kill_house_requests_first_weight'] as num?)?.toDouble(),
barCompleteWithKillHouse: (json['bar_complete_with_kill_house'] as num?)
?.toInt(),
acceptedRealQuantityFinal: (json['accepted_real_quantity_final'] as num?)
?.toInt(),
acceptedRealWightFinal: (json['accepted_real_wight_final'] as num?)
?.toDouble(),
wareHouseBars: (json['ware_house_bars'] as num?)?.toInt(),
wareHouseBarsQuantity: (json['ware_house_bars_quantity'] as num?)?.toInt(),
wareHouseBarsWeight: (json['ware_house_bars_weight'] as num?)?.toDouble(),
wareHouseBarsWeightLose: (json['ware_house_bars_weight_lose'] as num?)
?.toDouble(),
);
Map<String, dynamic> _$KillingInfoToJson(
_KillingInfo instance,
) => <String, dynamic>{
'violation_message': instance.violationMessage,
'province_kill_requests': instance.provinceKillRequests,
'province_kill_requests_quantity': instance.provinceKillRequestsQuantity,
'province_kill_requests_weight': instance.provinceKillRequestsWeight,
'kill_house_requests': instance.killHouseRequests,
'kill_house_requests_first_quantity': instance.killHouseRequestsFirstQuantity,
'kill_house_requests_first_weight': instance.killHouseRequestsFirstWeight,
'bar_complete_with_kill_house': instance.barCompleteWithKillHouse,
'accepted_real_quantity_final': instance.acceptedRealQuantityFinal,
'accepted_real_wight_final': instance.acceptedRealWightFinal,
'ware_house_bars': instance.wareHouseBars,
'ware_house_bars_quantity': instance.wareHouseBarsQuantity,
'ware_house_bars_weight': instance.wareHouseBarsWeight,
'ware_house_bars_weight_lose': instance.wareHouseBarsWeightLose,
};
_FreeGovernmentalInfo _$FreeGovernmentalInfoFromJson(
Map<String, dynamic> json,
) => _FreeGovernmentalInfo(
governmentalAllocatedQuantity:
(json['governmental_allocated_quantity'] as num?)?.toInt(),
totalCommitmentQuantity: (json['total_commitment_quantity'] as num?)
?.toDouble(),
freeAllocatedQuantity: (json['free_allocated_quantity'] as num?)?.toInt(),
totalFreeCommitmentQuantity: (json['total_free_commitment_quantity'] as num?)
?.toDouble(),
leftTotalFreeCommitmentQuantity:
(json['left_total_free_commitment_quantity'] as num?)?.toInt(),
);
Map<String, dynamic> _$FreeGovernmentalInfoToJson(
_FreeGovernmentalInfo instance,
) => <String, dynamic>{
'governmental_allocated_quantity': instance.governmentalAllocatedQuantity,
'total_commitment_quantity': instance.totalCommitmentQuantity,
'free_allocated_quantity': instance.freeAllocatedQuantity,
'total_free_commitment_quantity': instance.totalFreeCommitmentQuantity,
'left_total_free_commitment_quantity':
instance.leftTotalFreeCommitmentQuantity,
};
_Breed _$BreedFromJson(Map<String, dynamic> json) => _Breed(
breed: json['breed'] as String?,
mainQuantity: (json['main_quantity'] as num?)?.toInt(),
remainQuantity: (json['remain_quantity'] as num?)?.toInt(),
);
Map<String, dynamic> _$BreedToJson(_Breed instance) => <String, dynamic>{
'breed': instance.breed,
'main_quantity': instance.mainQuantity,
'remain_quantity': instance.remainQuantity,
};
_LastChange _$LastChangeFromJson(Map<String, dynamic> json) => _LastChange(
date: json['date'] == null ? null : DateTime.parse(json['date'] as String),
role: json['role'] as String?,
type: json['type'] as String?,
fullName: json['full_name'] as String?,
);
Map<String, dynamic> _$LastChangeToJson(_LastChange instance) =>
<String, dynamic>{
'date': instance.date?.toIso8601String(),
'role': instance.role,
'type': instance.type,
'full_name': instance.fullName,
};
_LatestHatchingChange _$LatestHatchingChangeFromJson(
Map<String, dynamic> json,
) => _LatestHatchingChange(
date: json['date'] == null ? null : DateTime.parse(json['date'] as String),
role: json['role'] as String?,
fullName: json['full_name'] as String?,
);
Map<String, dynamic> _$LatestHatchingChangeToJson(
_LatestHatchingChange instance,
) => <String, dynamic>{
'date': instance.date?.toIso8601String(),
'role': instance.role,
'full_name': instance.fullName,
};

View File

@@ -15,6 +15,7 @@ abstract class PoultryLocationModel with _$PoultryLocationModel {
User? user,
List<Hatching>? hatching,
Address? address,
String? breedingUniqueId,
}) = _PoultryLocationModel;
factory PoultryLocationModel.fromJson(Map<String, dynamic> json) =>
@@ -34,13 +35,12 @@ abstract class User with _$User {
@freezed
abstract class Hatching with _$Hatching {
const factory Hatching({
int? quantity,
int? leftOver,
int? period,
int? chickenAge,
DateTime? date,
bool?violation,
bool?archive,
String? licenceNumber,
}) = _Hatching;
factory Hatching.fromJson(Map<String, dynamic> json) =>

View File

@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$PoultryLocationModel {
int? get id; String? get unitName;@JsonKey(name: 'Lat') double? get lat;@JsonKey(name: 'Long') double? get long; User? get user; List<Hatching>? get hatching; Address? get address;
int? get id; String? get unitName;@JsonKey(name: 'Lat') double? get lat;@JsonKey(name: 'Long') double? get long; User? get user; List<Hatching>? get hatching; Address? get address; String? get breedingUniqueId;
/// Create a copy of PoultryLocationModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -28,16 +28,16 @@ $PoultryLocationModelCopyWith<PoultryLocationModel> get copyWith => _$PoultryLoc
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is PoultryLocationModel&&(identical(other.id, id) || other.id == id)&&(identical(other.unitName, unitName) || other.unitName == unitName)&&(identical(other.lat, lat) || other.lat == lat)&&(identical(other.long, long) || other.long == long)&&(identical(other.user, user) || other.user == user)&&const DeepCollectionEquality().equals(other.hatching, hatching)&&(identical(other.address, address) || other.address == address));
return identical(this, other) || (other.runtimeType == runtimeType&&other is PoultryLocationModel&&(identical(other.id, id) || other.id == id)&&(identical(other.unitName, unitName) || other.unitName == unitName)&&(identical(other.lat, lat) || other.lat == lat)&&(identical(other.long, long) || other.long == long)&&(identical(other.user, user) || other.user == user)&&const DeepCollectionEquality().equals(other.hatching, hatching)&&(identical(other.address, address) || other.address == address)&&(identical(other.breedingUniqueId, breedingUniqueId) || other.breedingUniqueId == breedingUniqueId));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,id,unitName,lat,long,user,const DeepCollectionEquality().hash(hatching),address);
int get hashCode => Object.hash(runtimeType,id,unitName,lat,long,user,const DeepCollectionEquality().hash(hatching),address,breedingUniqueId);
@override
String toString() {
return 'PoultryLocationModel(id: $id, unitName: $unitName, lat: $lat, long: $long, user: $user, hatching: $hatching, address: $address)';
return 'PoultryLocationModel(id: $id, unitName: $unitName, lat: $lat, long: $long, user: $user, hatching: $hatching, address: $address, breedingUniqueId: $breedingUniqueId)';
}
@@ -48,7 +48,7 @@ abstract mixin class $PoultryLocationModelCopyWith<$Res> {
factory $PoultryLocationModelCopyWith(PoultryLocationModel value, $Res Function(PoultryLocationModel) _then) = _$PoultryLocationModelCopyWithImpl;
@useResult
$Res call({
int? id, String? unitName,@JsonKey(name: 'Lat') double? lat,@JsonKey(name: 'Long') double? long, User? user, List<Hatching>? hatching, Address? address
int? id, String? unitName,@JsonKey(name: 'Lat') double? lat,@JsonKey(name: 'Long') double? long, User? user, List<Hatching>? hatching, Address? address, String? breedingUniqueId
});
@@ -65,7 +65,7 @@ class _$PoultryLocationModelCopyWithImpl<$Res>
/// Create a copy of PoultryLocationModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = freezed,Object? unitName = freezed,Object? lat = freezed,Object? long = freezed,Object? user = freezed,Object? hatching = freezed,Object? address = freezed,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? id = freezed,Object? unitName = freezed,Object? lat = freezed,Object? long = freezed,Object? user = freezed,Object? hatching = freezed,Object? address = freezed,Object? breedingUniqueId = freezed,}) {
return _then(_self.copyWith(
id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as int?,unitName: freezed == unitName ? _self.unitName : unitName // ignore: cast_nullable_to_non_nullable
@@ -74,7 +74,8 @@ as double?,long: freezed == long ? _self.long : long // ignore: cast_nullable_to
as double?,user: freezed == user ? _self.user : user // ignore: cast_nullable_to_non_nullable
as User?,hatching: freezed == hatching ? _self.hatching : hatching // ignore: cast_nullable_to_non_nullable
as List<Hatching>?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
as Address?,
as Address?,breedingUniqueId: freezed == breedingUniqueId ? _self.breedingUniqueId : breedingUniqueId // ignore: cast_nullable_to_non_nullable
as String?,
));
}
/// Create a copy of PoultryLocationModel
@@ -183,10 +184,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int? id, String? unitName, @JsonKey(name: 'Lat') double? lat, @JsonKey(name: 'Long') double? long, User? user, List<Hatching>? hatching, Address? address)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int? id, String? unitName, @JsonKey(name: 'Lat') double? lat, @JsonKey(name: 'Long') double? long, User? user, List<Hatching>? hatching, Address? address, String? breedingUniqueId)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _PoultryLocationModel() when $default != null:
return $default(_that.id,_that.unitName,_that.lat,_that.long,_that.user,_that.hatching,_that.address);case _:
return $default(_that.id,_that.unitName,_that.lat,_that.long,_that.user,_that.hatching,_that.address,_that.breedingUniqueId);case _:
return orElse();
}
@@ -204,10 +205,10 @@ return $default(_that.id,_that.unitName,_that.lat,_that.long,_that.user,_that.ha
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int? id, String? unitName, @JsonKey(name: 'Lat') double? lat, @JsonKey(name: 'Long') double? long, User? user, List<Hatching>? hatching, Address? address) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int? id, String? unitName, @JsonKey(name: 'Lat') double? lat, @JsonKey(name: 'Long') double? long, User? user, List<Hatching>? hatching, Address? address, String? breedingUniqueId) $default,) {final _that = this;
switch (_that) {
case _PoultryLocationModel():
return $default(_that.id,_that.unitName,_that.lat,_that.long,_that.user,_that.hatching,_that.address);case _:
return $default(_that.id,_that.unitName,_that.lat,_that.long,_that.user,_that.hatching,_that.address,_that.breedingUniqueId);case _:
throw StateError('Unexpected subclass');
}
@@ -224,10 +225,10 @@ return $default(_that.id,_that.unitName,_that.lat,_that.long,_that.user,_that.ha
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int? id, String? unitName, @JsonKey(name: 'Lat') double? lat, @JsonKey(name: 'Long') double? long, User? user, List<Hatching>? hatching, Address? address)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int? id, String? unitName, @JsonKey(name: 'Lat') double? lat, @JsonKey(name: 'Long') double? long, User? user, List<Hatching>? hatching, Address? address, String? breedingUniqueId)? $default,) {final _that = this;
switch (_that) {
case _PoultryLocationModel() when $default != null:
return $default(_that.id,_that.unitName,_that.lat,_that.long,_that.user,_that.hatching,_that.address);case _:
return $default(_that.id,_that.unitName,_that.lat,_that.long,_that.user,_that.hatching,_that.address,_that.breedingUniqueId);case _:
return null;
}
@@ -239,7 +240,7 @@ return $default(_that.id,_that.unitName,_that.lat,_that.long,_that.user,_that.ha
@JsonSerializable()
class _PoultryLocationModel implements PoultryLocationModel {
const _PoultryLocationModel({this.id, this.unitName, @JsonKey(name: 'Lat') this.lat, @JsonKey(name: 'Long') this.long, this.user, final List<Hatching>? hatching, this.address}): _hatching = hatching;
const _PoultryLocationModel({this.id, this.unitName, @JsonKey(name: 'Lat') this.lat, @JsonKey(name: 'Long') this.long, this.user, final List<Hatching>? hatching, this.address, this.breedingUniqueId}): _hatching = hatching;
factory _PoultryLocationModel.fromJson(Map<String, dynamic> json) => _$PoultryLocationModelFromJson(json);
@override final int? id;
@@ -257,6 +258,7 @@ class _PoultryLocationModel implements PoultryLocationModel {
}
@override final Address? address;
@override final String? breedingUniqueId;
/// Create a copy of PoultryLocationModel
/// with the given fields replaced by the non-null parameter values.
@@ -271,16 +273,16 @@ Map<String, dynamic> toJson() {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PoultryLocationModel&&(identical(other.id, id) || other.id == id)&&(identical(other.unitName, unitName) || other.unitName == unitName)&&(identical(other.lat, lat) || other.lat == lat)&&(identical(other.long, long) || other.long == long)&&(identical(other.user, user) || other.user == user)&&const DeepCollectionEquality().equals(other._hatching, _hatching)&&(identical(other.address, address) || other.address == address));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PoultryLocationModel&&(identical(other.id, id) || other.id == id)&&(identical(other.unitName, unitName) || other.unitName == unitName)&&(identical(other.lat, lat) || other.lat == lat)&&(identical(other.long, long) || other.long == long)&&(identical(other.user, user) || other.user == user)&&const DeepCollectionEquality().equals(other._hatching, _hatching)&&(identical(other.address, address) || other.address == address)&&(identical(other.breedingUniqueId, breedingUniqueId) || other.breedingUniqueId == breedingUniqueId));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,id,unitName,lat,long,user,const DeepCollectionEquality().hash(_hatching),address);
int get hashCode => Object.hash(runtimeType,id,unitName,lat,long,user,const DeepCollectionEquality().hash(_hatching),address,breedingUniqueId);
@override
String toString() {
return 'PoultryLocationModel(id: $id, unitName: $unitName, lat: $lat, long: $long, user: $user, hatching: $hatching, address: $address)';
return 'PoultryLocationModel(id: $id, unitName: $unitName, lat: $lat, long: $long, user: $user, hatching: $hatching, address: $address, breedingUniqueId: $breedingUniqueId)';
}
@@ -291,7 +293,7 @@ abstract mixin class _$PoultryLocationModelCopyWith<$Res> implements $PoultryLoc
factory _$PoultryLocationModelCopyWith(_PoultryLocationModel value, $Res Function(_PoultryLocationModel) _then) = __$PoultryLocationModelCopyWithImpl;
@override @useResult
$Res call({
int? id, String? unitName,@JsonKey(name: 'Lat') double? lat,@JsonKey(name: 'Long') double? long, User? user, List<Hatching>? hatching, Address? address
int? id, String? unitName,@JsonKey(name: 'Lat') double? lat,@JsonKey(name: 'Long') double? long, User? user, List<Hatching>? hatching, Address? address, String? breedingUniqueId
});
@@ -308,7 +310,7 @@ class __$PoultryLocationModelCopyWithImpl<$Res>
/// Create a copy of PoultryLocationModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = freezed,Object? unitName = freezed,Object? lat = freezed,Object? long = freezed,Object? user = freezed,Object? hatching = freezed,Object? address = freezed,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? id = freezed,Object? unitName = freezed,Object? lat = freezed,Object? long = freezed,Object? user = freezed,Object? hatching = freezed,Object? address = freezed,Object? breedingUniqueId = freezed,}) {
return _then(_PoultryLocationModel(
id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as int?,unitName: freezed == unitName ? _self.unitName : unitName // ignore: cast_nullable_to_non_nullable
@@ -317,7 +319,8 @@ as double?,long: freezed == long ? _self.long : long // ignore: cast_nullable_to
as double?,user: freezed == user ? _self.user : user // ignore: cast_nullable_to_non_nullable
as User?,hatching: freezed == hatching ? _self._hatching : hatching // ignore: cast_nullable_to_non_nullable
as List<Hatching>?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
as Address?,
as Address?,breedingUniqueId: freezed == breedingUniqueId ? _self.breedingUniqueId : breedingUniqueId // ignore: cast_nullable_to_non_nullable
as String?,
));
}
@@ -618,7 +621,7 @@ as String?,
/// @nodoc
mixin _$Hatching {
int? get quantity; int? get leftOver; int? get period; int? get chickenAge; DateTime? get date; bool? get violation; bool? get archive;
int? get leftOver; int? get chickenAge; DateTime? get date; String? get licenceNumber;
/// Create a copy of Hatching
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -631,16 +634,16 @@ $HatchingCopyWith<Hatching> get copyWith => _$HatchingCopyWithImpl<Hatching>(thi
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is Hatching&&(identical(other.quantity, quantity) || other.quantity == quantity)&&(identical(other.leftOver, leftOver) || other.leftOver == leftOver)&&(identical(other.period, period) || other.period == period)&&(identical(other.chickenAge, chickenAge) || other.chickenAge == chickenAge)&&(identical(other.date, date) || other.date == date)&&(identical(other.violation, violation) || other.violation == violation)&&(identical(other.archive, archive) || other.archive == archive));
return identical(this, other) || (other.runtimeType == runtimeType&&other is Hatching&&(identical(other.leftOver, leftOver) || other.leftOver == leftOver)&&(identical(other.chickenAge, chickenAge) || other.chickenAge == chickenAge)&&(identical(other.date, date) || other.date == date)&&(identical(other.licenceNumber, licenceNumber) || other.licenceNumber == licenceNumber));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,quantity,leftOver,period,chickenAge,date,violation,archive);
int get hashCode => Object.hash(runtimeType,leftOver,chickenAge,date,licenceNumber);
@override
String toString() {
return 'Hatching(quantity: $quantity, leftOver: $leftOver, period: $period, chickenAge: $chickenAge, date: $date, violation: $violation, archive: $archive)';
return 'Hatching(leftOver: $leftOver, chickenAge: $chickenAge, date: $date, licenceNumber: $licenceNumber)';
}
@@ -651,7 +654,7 @@ abstract mixin class $HatchingCopyWith<$Res> {
factory $HatchingCopyWith(Hatching value, $Res Function(Hatching) _then) = _$HatchingCopyWithImpl;
@useResult
$Res call({
int? quantity, int? leftOver, int? period, int? chickenAge, DateTime? date, bool? violation, bool? archive
int? leftOver, int? chickenAge, DateTime? date, String? licenceNumber
});
@@ -668,16 +671,13 @@ class _$HatchingCopyWithImpl<$Res>
/// Create a copy of Hatching
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? quantity = freezed,Object? leftOver = freezed,Object? period = freezed,Object? chickenAge = freezed,Object? date = freezed,Object? violation = freezed,Object? archive = freezed,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? leftOver = freezed,Object? chickenAge = freezed,Object? date = freezed,Object? licenceNumber = freezed,}) {
return _then(_self.copyWith(
quantity: freezed == quantity ? _self.quantity : quantity // ignore: cast_nullable_to_non_nullable
as int?,leftOver: freezed == leftOver ? _self.leftOver : leftOver // ignore: cast_nullable_to_non_nullable
as int?,period: freezed == period ? _self.period : period // ignore: cast_nullable_to_non_nullable
leftOver: freezed == leftOver ? _self.leftOver : leftOver // ignore: cast_nullable_to_non_nullable
as int?,chickenAge: freezed == chickenAge ? _self.chickenAge : chickenAge // ignore: cast_nullable_to_non_nullable
as int?,date: freezed == date ? _self.date : date // ignore: cast_nullable_to_non_nullable
as DateTime?,violation: freezed == violation ? _self.violation : violation // ignore: cast_nullable_to_non_nullable
as bool?,archive: freezed == archive ? _self.archive : archive // ignore: cast_nullable_to_non_nullable
as bool?,
as DateTime?,licenceNumber: freezed == licenceNumber ? _self.licenceNumber : licenceNumber // ignore: cast_nullable_to_non_nullable
as String?,
));
}
@@ -762,10 +762,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int? quantity, int? leftOver, int? period, int? chickenAge, DateTime? date, bool? violation, bool? archive)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int? leftOver, int? chickenAge, DateTime? date, String? licenceNumber)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _Hatching() when $default != null:
return $default(_that.quantity,_that.leftOver,_that.period,_that.chickenAge,_that.date,_that.violation,_that.archive);case _:
return $default(_that.leftOver,_that.chickenAge,_that.date,_that.licenceNumber);case _:
return orElse();
}
@@ -783,10 +783,10 @@ return $default(_that.quantity,_that.leftOver,_that.period,_that.chickenAge,_tha
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int? quantity, int? leftOver, int? period, int? chickenAge, DateTime? date, bool? violation, bool? archive) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int? leftOver, int? chickenAge, DateTime? date, String? licenceNumber) $default,) {final _that = this;
switch (_that) {
case _Hatching():
return $default(_that.quantity,_that.leftOver,_that.period,_that.chickenAge,_that.date,_that.violation,_that.archive);case _:
return $default(_that.leftOver,_that.chickenAge,_that.date,_that.licenceNumber);case _:
throw StateError('Unexpected subclass');
}
@@ -803,10 +803,10 @@ return $default(_that.quantity,_that.leftOver,_that.period,_that.chickenAge,_tha
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int? quantity, int? leftOver, int? period, int? chickenAge, DateTime? date, bool? violation, bool? archive)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int? leftOver, int? chickenAge, DateTime? date, String? licenceNumber)? $default,) {final _that = this;
switch (_that) {
case _Hatching() when $default != null:
return $default(_that.quantity,_that.leftOver,_that.period,_that.chickenAge,_that.date,_that.violation,_that.archive);case _:
return $default(_that.leftOver,_that.chickenAge,_that.date,_that.licenceNumber);case _:
return null;
}
@@ -818,16 +818,13 @@ return $default(_that.quantity,_that.leftOver,_that.period,_that.chickenAge,_tha
@JsonSerializable()
class _Hatching implements Hatching {
const _Hatching({this.quantity, this.leftOver, this.period, this.chickenAge, this.date, this.violation, this.archive});
const _Hatching({this.leftOver, this.chickenAge, this.date, this.licenceNumber});
factory _Hatching.fromJson(Map<String, dynamic> json) => _$HatchingFromJson(json);
@override final int? quantity;
@override final int? leftOver;
@override final int? period;
@override final int? chickenAge;
@override final DateTime? date;
@override final bool? violation;
@override final bool? archive;
@override final String? licenceNumber;
/// Create a copy of Hatching
/// with the given fields replaced by the non-null parameter values.
@@ -842,16 +839,16 @@ Map<String, dynamic> toJson() {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Hatching&&(identical(other.quantity, quantity) || other.quantity == quantity)&&(identical(other.leftOver, leftOver) || other.leftOver == leftOver)&&(identical(other.period, period) || other.period == period)&&(identical(other.chickenAge, chickenAge) || other.chickenAge == chickenAge)&&(identical(other.date, date) || other.date == date)&&(identical(other.violation, violation) || other.violation == violation)&&(identical(other.archive, archive) || other.archive == archive));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Hatching&&(identical(other.leftOver, leftOver) || other.leftOver == leftOver)&&(identical(other.chickenAge, chickenAge) || other.chickenAge == chickenAge)&&(identical(other.date, date) || other.date == date)&&(identical(other.licenceNumber, licenceNumber) || other.licenceNumber == licenceNumber));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,quantity,leftOver,period,chickenAge,date,violation,archive);
int get hashCode => Object.hash(runtimeType,leftOver,chickenAge,date,licenceNumber);
@override
String toString() {
return 'Hatching(quantity: $quantity, leftOver: $leftOver, period: $period, chickenAge: $chickenAge, date: $date, violation: $violation, archive: $archive)';
return 'Hatching(leftOver: $leftOver, chickenAge: $chickenAge, date: $date, licenceNumber: $licenceNumber)';
}
@@ -862,7 +859,7 @@ abstract mixin class _$HatchingCopyWith<$Res> implements $HatchingCopyWith<$Res>
factory _$HatchingCopyWith(_Hatching value, $Res Function(_Hatching) _then) = __$HatchingCopyWithImpl;
@override @useResult
$Res call({
int? quantity, int? leftOver, int? period, int? chickenAge, DateTime? date, bool? violation, bool? archive
int? leftOver, int? chickenAge, DateTime? date, String? licenceNumber
});
@@ -879,16 +876,13 @@ class __$HatchingCopyWithImpl<$Res>
/// Create a copy of Hatching
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? quantity = freezed,Object? leftOver = freezed,Object? period = freezed,Object? chickenAge = freezed,Object? date = freezed,Object? violation = freezed,Object? archive = freezed,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? leftOver = freezed,Object? chickenAge = freezed,Object? date = freezed,Object? licenceNumber = freezed,}) {
return _then(_Hatching(
quantity: freezed == quantity ? _self.quantity : quantity // ignore: cast_nullable_to_non_nullable
as int?,leftOver: freezed == leftOver ? _self.leftOver : leftOver // ignore: cast_nullable_to_non_nullable
as int?,period: freezed == period ? _self.period : period // ignore: cast_nullable_to_non_nullable
leftOver: freezed == leftOver ? _self.leftOver : leftOver // ignore: cast_nullable_to_non_nullable
as int?,chickenAge: freezed == chickenAge ? _self.chickenAge : chickenAge // ignore: cast_nullable_to_non_nullable
as int?,date: freezed == date ? _self.date : date // ignore: cast_nullable_to_non_nullable
as DateTime?,violation: freezed == violation ? _self.violation : violation // ignore: cast_nullable_to_non_nullable
as bool?,archive: freezed == archive ? _self.archive : archive // ignore: cast_nullable_to_non_nullable
as bool?,
as DateTime?,licenceNumber: freezed == licenceNumber ? _self.licenceNumber : licenceNumber // ignore: cast_nullable_to_non_nullable
as String?,
));
}

View File

@@ -22,6 +22,7 @@ _PoultryLocationModel _$PoultryLocationModelFromJson(
address: json['address'] == null
? null
: Address.fromJson(json['address'] as Map<String, dynamic>),
breedingUniqueId: json['breeding_unique_id'] as String?,
);
Map<String, dynamic> _$PoultryLocationModelToJson(
@@ -34,6 +35,7 @@ Map<String, dynamic> _$PoultryLocationModelToJson(
'user': instance.user,
'hatching': instance.hatching,
'address': instance.address,
'breeding_unique_id': instance.breedingUniqueId,
};
_User _$UserFromJson(Map<String, dynamic> json) => _User(
@@ -47,23 +49,17 @@ Map<String, dynamic> _$UserToJson(_User instance) => <String, dynamic>{
};
_Hatching _$HatchingFromJson(Map<String, dynamic> json) => _Hatching(
quantity: (json['quantity'] as num?)?.toInt(),
leftOver: (json['left_over'] as num?)?.toInt(),
period: (json['period'] as num?)?.toInt(),
chickenAge: (json['chicken_age'] as num?)?.toInt(),
date: json['date'] == null ? null : DateTime.parse(json['date'] as String),
violation: json['violation'] as bool?,
archive: json['archive'] as bool?,
licenceNumber: json['licence_number'] as String?,
);
Map<String, dynamic> _$HatchingToJson(_Hatching instance) => <String, dynamic>{
'quantity': instance.quantity,
'left_over': instance.leftOver,
'period': instance.period,
'chicken_age': instance.chickenAge,
'date': instance.date?.toIso8601String(),
'violation': instance.violation,
'archive': instance.archive,
'licence_number': instance.licenceNumber,
};
_Address _$AddressFromJson(Map<String, dynamic> json) => _Address(

View File

@@ -24,11 +24,13 @@ class InspectionRepositoryImp implements InspectionRepository {
double? centerLat,
double? centerLng,
double? radius,
String? value,
}) async {
return remoteDataSource.getNearbyLocation(
centerLat: centerLat,
centerLng: centerLng,
radius: radius,
value: value,
);
}
}

View File

@@ -8,14 +8,20 @@ import 'package:rasadyar_inspection/data/repositories/inspection/inspection_repo
import 'package:rasadyar_inspection/injection/inspection_di.dart';
import 'package:rasadyar_inspection/presentation/widget/base_page/logic.dart';
import '../filter/view.dart';
class InspectionMapLogic extends GetxController with GetTickerProviderStateMixin {
final BaseLogic baseLogic = Get.find<BaseLogic>();
InspectionRepositoryImp inspectionRepository = diInspection.get<InspectionRepositoryImp>();
final distance = Distance();
Rx<LatLng> currentLocation = LatLng(34.798315281272544, 48.51479142983491).obs;
Rx<Resource<List<PoultryLocationModel>>> allPoultryLocation =
Resource<List<PoultryLocationModel>>.loading().obs;
Resource<List<PoultryLocationModel>>.initial().obs;
Rx<Resource<List<PoultryLocationModel>>> searchedPoultryLocation =
Resource<List<PoultryLocationModel>>.initial().obs;
RxList<Marker> markers = <Marker>[].obs;
RxList<PoultryLocationModel> markers2 = <PoultryLocationModel>[].obs;
@@ -28,19 +34,9 @@ class InspectionMapLogic extends GetxController with GetTickerProviderStateMixin
RxInt showIndex = 0.obs;
bool showSlideHint = true;
RxInt currentZoom = 15.obs;
late Rx<SlidableController> slidController;
Rx<MapController> mapController = MapController().obs;
late final AnimatedMapController animatedMapController;
late DraggableBottomSheetController filterBottomSheetController;
late DraggableBottomSheetController selectedLocationBottomSheetController;
late DraggableBottomSheetController detailsLocationBottomSheetController;
late final BottomSheetManager bottomSheetManager;
InspectionRepositoryImp inspectionRepository = diInspection.get<InspectionRepositoryImp>();
@override
void onInit() {
super.onInit();
@@ -50,38 +46,16 @@ class InspectionMapLogic extends GetxController with GetTickerProviderStateMixin
curve: Curves.easeInOut,
cancelPreviousAnimations: true,
);
fetchAllPoultryLocations();
filterBottomSheetController = DraggableBottomSheetController(
initialHeight: 350,
minHeight: 200,
maxHeight: Get.height * 0.5,
);
selectedLocationBottomSheetController = DraggableBottomSheetController(
initialHeight: 200,
minHeight: 100,
maxHeight: 200,
);
detailsLocationBottomSheetController = DraggableBottomSheetController(
initialHeight: Get.height * 0.5,
minHeight: Get.height * 0.37,
maxHeight: Get.height * 0.5,
);
slidController = SlidableController(this).obs;
bottomSheetManager = BottomSheetManager({
filterBottomSheetController: () =>
filterWidget(filterIndex: filterIndex, showIndex: showIndex),
selectedLocationBottomSheetController: () => selectedLocationWidget(
showHint: selectedLocationBottomSheetController.isVisible.value && showSlideHint,
sliderController: slidController.value,
trigger: triggerSlidableAnimation,
toggle: selectedLocationBottomSheetController.toggle,
),
detailsLocationBottomSheetController: () => markerDetailsWidget(),
});
debounce(baseLogic.searchValue, (callback) {
if (callback != null &&
callback.trim().isNotEmpty &&
searchedPoultryLocation.value.status != ResourceStatus.loading) {
searchPoultryLocations();
}
}, time: Duration(seconds: 2));
}
@override
@@ -92,7 +66,6 @@ class InspectionMapLogic extends GetxController with GetTickerProviderStateMixin
@override
void onClose() {
slidController.close();
super.onClose();
}
@@ -132,9 +105,9 @@ class InspectionMapLogic extends GetxController with GetTickerProviderStateMixin
center.longitude,
radius * 1000,
);
markers2.addAll(filtered);
final existingIds = markers2.map((e) => e.id).toSet();
final uniqueFiltered = filtered.where((e) => !existingIds.contains(e.id)).toList();
markers2.addAll(uniqueFiltered);
});
}
@@ -154,9 +127,9 @@ class InspectionMapLogic extends GetxController with GetTickerProviderStateMixin
Future<void> triggerSlidableAnimation() async {
await Future.delayed(Duration(milliseconds: 200));
await slidController.value.openEndActionPane();
//await slidController.value.openEndActionPane();
await Future.delayed(Duration(milliseconds: 200));
await slidController.value.close();
//await slidController.value.close();
showSlideHint = false;
}
@@ -184,6 +157,25 @@ class InspectionMapLogic extends GetxController with GetTickerProviderStateMixin
);
}
Future<void> searchPoultryLocations() async {
searchedPoultryLocation.value = Resource<List<PoultryLocationModel>>.loading();
await safeCall(
call: () => inspectionRepository.getNearbyLocation(value: baseLogic.searchValue.value),
onSuccess: (result) {
if (result != null || result!.isNotEmpty) {
searchedPoultryLocation.value = Resource<List<PoultryLocationModel>>.success(result);
} else {
searchedPoultryLocation.value = Resource<List<PoultryLocationModel>>.empty();
}
},
onError: (error, stackTrace) {
searchedPoultryLocation.value = Resource<List<PoultryLocationModel>>.error(
error.toString(),
);
},
);
}
double getVisibleRadiusKm({
required double zoom,
required double screenWidthPx,

View File

@@ -4,7 +4,6 @@ import 'package:rasadyar_inspection/data/model/response/poultry_location/poultry
import 'package:rasadyar_inspection/presentation/routes/app_routes.dart';
import 'package:rasadyar_inspection/presentation/widget/base_page/view.dart';
import 'package:rasadyar_inspection/presentation/widget/custom_chips.dart';
import 'package:rasadyar_inspection/presentation/widget/search.dart';
import 'logic.dart';
@@ -87,7 +86,24 @@ class InspectionMapPage extends GetView<InspectionMapLogic> {
);
}, controller.currentLocation),
Positioned(
Obx(() {
if (controller.baseLogic.isSearchSelected.value) {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (Get.isBottomSheetOpen != true) {
Get.bottomSheet(
searchWidget(),
isDismissible: true,
ignoreSafeArea: false,
isScrollControlled: true,
);
}
});
}
return const SizedBox.shrink();
}),
// Uncomment the following lines to enable the search widget
/* Positioned(
top: 10,
left: 20,
right: 20,
@@ -102,6 +118,126 @@ class InspectionMapPage extends GetView<InspectionMapLogic> {
return SizedBox.shrink();
}
}, controller.baseLogic.isSearchSelected),
),*/
],
),
);
}
BaseBottomSheet searchWidget() {
return BaseBottomSheet(
height: Get.height * 0.85,
rootChild: Column(
spacing: 8,
children: [
RTextField(
height: 40,
borderColor: AppColor.blackLight,
suffixIcon: ObxValue(
(data) => Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: (data.value == null)
? Assets.vec.searchSvg.svg(
width: 10,
height: 10,
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
)
: IconButton(
onPressed: () {
controller.baseLogic.searchTextController.clear();
controller.baseLogic.searchValue.value = null;
controller.baseLogic.isSearchSelected.value = false;
controller.searchedPoultryLocation.value = Resource.initial();
},
enableFeedback: true,
padding: EdgeInsets.zero,
iconSize: 24,
splashRadius: 50,
icon: Assets.vec.closeCircleSvg.svg(
width: 20,
height: 20,
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
),
),
),
controller.baseLogic.searchValue,
),
hintText: 'جستجو کنید ...',
hintStyle: AppFonts.yekan16.copyWith(color: AppColor.blueNormal),
filledColor: Colors.white,
filled: true,
controller: controller.baseLogic.searchTextController,
onChanged: (val) => controller.baseLogic.searchValue.value = val,
),
Expanded(
child: ObxValue((rxData) {
final resource = rxData.value;
final status = resource.status;
final items = resource.data;
final message = resource.message ?? 'خطا در بارگذاری';
if (status == ResourceStatus.initial) {
return Center(child: Text('ابتدا جستجو کنید'));
}
if (status == ResourceStatus.loading) {
return const Center(child: CircularProgressIndicator());
}
if (status == ResourceStatus.error) {
return Center(child: Text(message));
}
if (items == null || items.isEmpty) {
return Center(child: EmptyWidget());
}
return ListView.separated(
itemCount: items.length,
separatorBuilder: (context, index) => SizedBox(height: 8),
itemBuilder: (context, index) {
final item = items[index]; // اگر item استفاده نمیشه، می‌تونه حذف بشه
return ListItem2(
index: index,
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.cowSvg.path,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
item.unitName ?? 'N/A',
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
),
Text(
item.user?.fullname ?? '',
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'جوجه ریزی فعال',
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
),
Text(
(item.hatching != null && item.hatching!.isNotEmpty)
? 'دارد'
: 'ندراد',
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
],
),
);
},
);
}, controller.searchedPoultryLocation),
),
],
),
@@ -315,221 +451,310 @@ class InspectionMapPage extends GetView<InspectionMapLogic> {
point: point,
width: isZoomedIn && isVisible ? 180.w : 40.h,
height: isZoomedIn && isVisible ? 50.h : 50.h,
child: isZoomedIn && isVisible
? GestureDetector(
onTap: () {
Get.bottomSheet(
ObxValue((data) {
return BaseBottomSheet(
height: data.value ? 450.h : 150.h,
child: ListItemWithOutCounter(
secondChild: Column(
spacing: 8,
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 12.w),
child: Column(
spacing: 8,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
child: GestureDetector(
onTap: () {
bool hasHatching = location.hatching != null && location.hatching!.isNotEmpty;
Get.bottomSheet(
ObxValue((data) {
return BaseBottomSheet(
height: data.value
? hasHatching
? 550.h
: 400.h
: 150.h,
child: Column(
spacing: 12,
children: [
ListItemWithOutCounter(
secondChild: Column(
spacing: 8,
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 12.w),
child: Column(
spacing: 8,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
location.unitName ?? 'N/A',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
),
],
),
Container(
height: 32.h,
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: ShapeDecoration(
color: AppColor.blueLight,
shape: RoundedRectangleBorder(
side: BorderSide(
width: 1.w,
color: AppColor.blueLightHover,
),
borderRadius: BorderRadius.circular(8),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
spacing: 3,
children: [
Text(
'داوود خرم پور',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(
color: AppColor.greenDark,
'جوجه ریزی فعال',
style: AppFonts.yekan14.copyWith(
color: AppColor.textColor,
),
),
Text(
hasHatching ? 'دارد' : 'ندارد',
style: AppFonts.yekan14.copyWith(
color: AppColor.blueNormal,
),
),
],
),
Container(
height: 32.h,
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: ShapeDecoration(
color: AppColor.blueLight,
shape: RoundedRectangleBorder(
side: BorderSide(
width: 1.w,
color: AppColor.blueLightHover,
),
buildRow(
title: 'مشخصات خریدار',
value: location.user?.fullname ?? 'N/A',
),
buildRow(
title: 'تلفن خریدار',
value: location.user?.mobile ?? 'N/A',
valueStyle: AppFonts.yekan14.copyWith(
color: AppColor.blueNormal,
),
),
Visibility(
visible: location.address?.city?.name != null,
child: buildRow(
title: 'شهر',
value: location.address?.city?.name ?? 'N/A',
),
),
Visibility(
visible: location.address?.address != null,
child: buildRow(
title: 'آردس',
value: location.address?.address ?? 'N/A',
),
),
buildRow(
title: 'شناسه یکتا',
value: location.breedingUniqueId ?? 'N/A',
),
],
),
),
Row(
children: [
Expanded(
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
spacing: 7,
children: [
RElevated(
width: 40.h,
height: 38.h,
backgroundColor: AppColor.greenNormal,
child: Assets.vec.messageAddSvg.svg(
width: 24.w,
height: 24.h,
colorFilter: ColorFilter.mode(
Colors.white,
BlendMode.srcIn,
),
borderRadius: BorderRadius.circular(8),
),
onPressed: () {},
),
RElevated(
width: 150.w,
height: 40.h,
backgroundColor: AppColor.blueNormal,
onPressed: () {
/* controller.setEditData(item);
Get.bottomSheet(
addOrEditBottomSheet(true),
isScrollControlled: true,
backgroundColor: Colors.transparent,
).whenComplete(() {});*/
},
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
spacing: 8,
children: [
Assets.vec.mapSvg.svg(
width: 24.w,
height: 24.h,
colorFilter: ColorFilter.mode(
Colors.white,
BlendMode.srcIn,
),
),
Text(
'جزییات کامل',
style: AppFonts.yekan14Bold.copyWith(
color: Colors.white,
),
),
],
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
spacing: 3,
children: [
Text(
'تاریخ بازرسی',
style: AppFonts.yekan14.copyWith(
color: AppColor.textColor,
ROutlinedElevated(
width: 150.w,
height: 40.h,
onPressed: () {
buildDeleteDialog(
onConfirm: () async {},
onRefresh: () async {},
);
},
borderColor: AppColor.bgIcon,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 8,
children: [
Assets.vec.securityTimeSvg.svg(
width: 24.w,
height: 24.h,
colorFilter: ColorFilter.mode(
AppColor.bgIcon,
BlendMode.srcIn,
),
),
),
Text(
'1403/12/12',
style: AppFonts.yekan14.copyWith(
color: AppColor.blueNormal,
Text(
'سوابق بازرسی',
style: AppFonts.yekan14Bold.copyWith(
color: AppColor.bgIcon,
),
),
),
],
],
),
),
],
),
),
],
),
],
),
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.cowSvg.path,
labelIconColor: AppColor.bgIcon,
onTap: () => data.value = !data.value,
selected: data.value,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
location.unitName ?? 'N/A',
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
),
Text(
location.user?.fullname ?? '',
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'جوجه ریزی فعال',
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
),
Text(
(location.hatching != null && location.hatching!.isNotEmpty)
? 'دارد'
: 'ندراد',
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Assets.vec.scanBarcodeSvg.svg(),
],
),
),
Visibility(
visible: hasHatching,
child: Container(
width: Get.width,
margin: const EdgeInsets.fromLTRB(0, 0, 10, 0),
padding: EdgeInsets.all(8.r),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 1, color: AppColor.lightGreyNormalHover),
),
child: Column(
spacing: 8.h,
children: [
Container(
height: 32.h,
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: ShapeDecoration(
color: AppColor.blueLight,
shape: RoundedRectangleBorder(
side: BorderSide(width: 1.w, color: AppColor.blueLightHover),
borderRadius: BorderRadius.circular(8),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
spacing: 3,
children: [
Text(
'تاریخ',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
),
buildRow(
title: 'تلفن خریدار',
value: '0326598653',
valueStyle: AppFonts.yekan14.copyWith(
color: AppColor.blueNormal,
),
Text(
location.hatching?.first.date?.formattedJalaliDate ?? 'N/A',
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
buildRow(title: 'آخرین فعالیت', value: '1409/12/12'),
buildRow(title: 'موجودی', value: '5KG'),
buildRow(title: 'فروش رفته', value: '5KG'),
],
),
),
Row(
children: [
Expanded(
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
spacing: 7,
children: [
RElevated(
width: 40.h,
height: 38.h,
backgroundColor: AppColor.greenNormal,
child: Assets.vec.messageAddSvg.svg(
width: 24.w,
height: 24.h,
colorFilter: ColorFilter.mode(
Colors.white,
BlendMode.srcIn,
),
),
onPressed: () {},
),
RElevated(
width: 150.w,
height: 40.h,
backgroundColor: AppColor.blueNormal,
onPressed: () {
/* controller.setEditData(item);
Get.bottomSheet(
addOrEditBottomSheet(true),
isScrollControlled: true,
backgroundColor: Colors.transparent,
).whenComplete(() {});*/
},
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
spacing: 8,
children: [
Assets.vec.mapSvg.svg(
width: 24.w,
height: 24.h,
colorFilter: ColorFilter.mode(
Colors.white,
BlendMode.srcIn,
),
),
Text(
'مسیریابی',
style: AppFonts.yekan14Bold.copyWith(
color: Colors.white,
),
),
],
),
),
ROutlinedElevated(
width: 150.w,
height: 40.h,
onPressed: () {
buildDeleteDialog(
onConfirm: () async {},
onRefresh: () async {},
);
},
borderColor: AppColor.bgIcon,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 8,
children: [
Assets.vec.securityTimeSvg.svg(
width: 24.w,
height: 24.h,
colorFilter: ColorFilter.mode(
AppColor.bgIcon,
BlendMode.srcIn,
),
),
Text(
'سوابق بازرسی',
style: AppFonts.yekan14Bold.copyWith(
color: AppColor.bgIcon,
),
),
],
),
),
],
),
),
],
buildRow(
title: 'باقیمانده',
value: location.hatching?.first.leftOver.separatedByComma ?? 'N/A',
),
],
),
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.cowSvg.path,
labelIconColor: AppColor.bgIcon,
onTap: () => data.value = !data.value,
selected: data.value,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'داود خرم مهری پور',
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
),
Text(
'گوشت و مرغ',
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
buildRow(
title: 'سن جوجه ریزی',
value: '${location.hatching?.first.chickenAge ?? 'N/A'} روز',
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'باقی مانده',
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
),
Text(
'0 کیلوگرم',
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
buildRow(
title: 'شماره مجوز جوجه ریزی',
value: location.hatching?.first.licenceNumber.toString() ?? 'N/A',
),
Assets.vec.scanBarcodeSvg.svg(),
],
),
),
);
}, controller.isSelectedDetailsLocation),
);
},
child: Container(
),
],
),
);
}, controller.isSelectedDetailsLocation),
isScrollControlled: true,
isDismissible: true,
);
},
child: isZoomedIn && isVisible
? Container(
height: 30.h,
padding: EdgeInsets.all(5.r),
decoration: BoxDecoration(
@@ -551,9 +776,9 @@ class InspectionMapPage extends GetView<InspectionMapLogic> {
Text(location.user?.fullname ?? '', style: AppFonts.yekan12),
],
),
),
)
: Assets.vec.chickenMapMarkerSvg.svg(width: 24.w, height: 24.h),
)
: Assets.vec.chickenMapMarkerSvg.svg(width: 24.w, height: 24.h),
),
);
}).toList();

View File

@@ -29,7 +29,7 @@ class RecordsPage extends GetView<RecordsLogic> {
itemBuilder: (context, index) {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ListItem2(
return ExpandableListItem2(
selected: val.value == index,
onTap: () => controller.toggleExpandedList(index),
index: index,

View File

@@ -29,7 +29,7 @@ class UsersPage extends GetView<UsersLogic> {
itemBuilder: (context, index) {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ListItem2(
return ExpandableListItem2(
selected: val.value == index,
onTap: () => controller.toggleExpandedList(index),
index: index,

View File

@@ -1,8 +1,10 @@
import 'package:flutter/cupertino.dart';
import 'package:rasadyar_core/core.dart';
class BaseLogic extends GetxController {
final RxBool isFilterSelected = false.obs;
final RxBool isSearchSelected = false.obs;
final TextEditingController searchTextController = TextEditingController();
final RxnString searchValue = RxnString();
void setSearchCallback(void Function(String)? onSearchChanged) {