feat :
1 - search location and conditions 2 - parse list in isolate
This commit is contained in:
@@ -57,3 +57,5 @@ export 'utils/map_utils.dart';
|
|||||||
export 'utils/network/network.dart';
|
export 'utils/network/network.dart';
|
||||||
export 'utils/route_utils.dart';
|
export 'utils/route_utils.dart';
|
||||||
export 'utils/separator_input_formatter.dart';
|
export 'utils/separator_input_formatter.dart';
|
||||||
|
|
||||||
|
export 'utils/utils.dart';
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ class DioRemote implements IHttpClient {
|
|||||||
ProgressCallback? onReceiveProgress,
|
ProgressCallback? onReceiveProgress,
|
||||||
T Function(Map<String, dynamic> json)? fromJson,
|
T Function(Map<String, dynamic> json)? fromJson,
|
||||||
T Function(List<dynamic> json)? fromJsonList,
|
T Function(List<dynamic> json)? fromJsonList,
|
||||||
|
Future<T> Function(List<dynamic> json)? fromJsonListAsync,
|
||||||
}) async {
|
}) async {
|
||||||
final response = await dio.get(
|
final response = await dio.get(
|
||||||
path,
|
path,
|
||||||
@@ -45,6 +46,10 @@ class DioRemote implements IHttpClient {
|
|||||||
onReceiveProgress: onReceiveProgress,
|
onReceiveProgress: onReceiveProgress,
|
||||||
cancelToken: ApiHandler.globalCancelToken,
|
cancelToken: ApiHandler.globalCancelToken,
|
||||||
);
|
);
|
||||||
|
if (fromJsonListAsync != null && response.data is List) {
|
||||||
|
response.data = await fromJsonListAsync(response.data);
|
||||||
|
return DioResponse<T>(response);
|
||||||
|
}
|
||||||
if (fromJsonList != null && response.data is List) {
|
if (fromJsonList != null && response.data is List) {
|
||||||
response.data = fromJsonList(response.data);
|
response.data = fromJsonList(response.data);
|
||||||
return DioResponse<T>(response);
|
return DioResponse<T>(response);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
|
|
||||||
import 'dart:typed_data';
|
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
|
|
||||||
import 'i_form_data.dart';
|
import 'i_form_data.dart';
|
||||||
import 'i_http_response.dart';
|
import 'i_http_response.dart';
|
||||||
|
|
||||||
@@ -12,9 +11,11 @@ abstract class IHttpClient {
|
|||||||
Map<String, dynamic>? queryParameters,
|
Map<String, dynamic>? queryParameters,
|
||||||
Map<String, String>? headers,
|
Map<String, String>? headers,
|
||||||
ProgressCallback? onReceiveProgress,
|
ProgressCallback? onReceiveProgress,
|
||||||
|
T Function(Map<String, dynamic> json)? fromJson,
|
||||||
|
T Function(List<dynamic> json)? fromJsonList,
|
||||||
|
Future<T> Function(List<dynamic> json)? fromJsonListAsync,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Future<IHttpResponse<T>> post<T>(
|
Future<IHttpResponse<T>> post<T>(
|
||||||
String path, {
|
String path, {
|
||||||
dynamic data,
|
dynamic data,
|
||||||
@@ -40,10 +41,7 @@ abstract class IHttpClient {
|
|||||||
Map<String, String>? headers,
|
Map<String, String>? headers,
|
||||||
});
|
});
|
||||||
|
|
||||||
Future<IHttpResponse<T>> download<T>(
|
Future<IHttpResponse<T>> download<T>(String url, {ProgressCallback? onReceiveProgress});
|
||||||
String url, {
|
|
||||||
ProgressCallback? onReceiveProgress,
|
|
||||||
});
|
|
||||||
|
|
||||||
Future<IHttpResponse<T>> upload<T>(
|
Future<IHttpResponse<T>> upload<T>(
|
||||||
String path, {
|
String path, {
|
||||||
|
|||||||
16
packages/core/lib/utils/parser.dart
Normal file
16
packages/core/lib/utils/parser.dart
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
|
List<T> _parserList<T>(Map<String, dynamic> args) {
|
||||||
|
final list = args['list'] as List<dynamic>;
|
||||||
|
final T Function(Map<String, dynamic>) fromJson =
|
||||||
|
args['fromJson'] as T Function(Map<String, dynamic>);
|
||||||
|
|
||||||
|
return list.map<T>((e) => fromJson(e as Map<String, dynamic>)).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<T>> parseListInIsolate<T>(
|
||||||
|
List<dynamic> list,
|
||||||
|
T Function(Map<String, dynamic>) fromJson,
|
||||||
|
) async {
|
||||||
|
return compute(_parserList<T>, {'list': list, 'fromJson': fromJson});
|
||||||
|
}
|
||||||
@@ -1,17 +1,12 @@
|
|||||||
export 'mixins/pagination_controller_mixin.dart';
|
export 'apk_updater.dart';
|
||||||
|
|
||||||
export 'network/network.dart';
|
|
||||||
|
|
||||||
export 'extension/date_time_utils.dart';
|
export 'extension/date_time_utils.dart';
|
||||||
export 'extension/num_utils.dart';
|
export 'extension/num_utils.dart';
|
||||||
export 'extension/string_utils.dart';
|
export 'extension/string_utils.dart';
|
||||||
|
export 'local/local_utils.dart';
|
||||||
export 'apk_updater.dart';
|
|
||||||
export 'logger_utils.dart';
|
export 'logger_utils.dart';
|
||||||
export 'map_utils.dart';
|
export 'map_utils.dart';
|
||||||
|
export 'mixins/pagination_controller_mixin.dart';
|
||||||
|
export 'network/network.dart';
|
||||||
|
export 'parser.dart';
|
||||||
export 'route_utils.dart';
|
export 'route_utils.dart';
|
||||||
export 'separator_input_formatter.dart';
|
export 'separator_input_formatter.dart';
|
||||||
|
|
||||||
|
|
||||||
export 'local/local_utils.dart';
|
|
||||||
|
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ class InspectionRemoteDataSourceImp implements InspectionRemoteDataSource {
|
|||||||
value: value,
|
value: value,
|
||||||
),
|
),
|
||||||
headers: {'Content-Type': 'application/json'},
|
headers: {'Content-Type': 'application/json'},
|
||||||
fromJsonList: (json) =>
|
fromJsonListAsync: (json) async =>
|
||||||
json.map((item) => PoultryLocationModel.fromJson(item as Map<String, dynamic>)).toList(),
|
parseListInIsolate(json, (json) => PoultryLocationModel.fromJson(json)),
|
||||||
);
|
);
|
||||||
|
|
||||||
return res.data;
|
return res.data;
|
||||||
|
|||||||
@@ -57,8 +57,9 @@ class InspectionMapLogic extends GetxController {
|
|||||||
allPoultryLocation.value = Resource<List<PoultryLocationModel>>.loading();
|
allPoultryLocation.value = Resource<List<PoultryLocationModel>>.loading();
|
||||||
await safeCall(
|
await safeCall(
|
||||||
call: () => inspectionRepository.getNearbyLocation(),
|
call: () => inspectionRepository.getNearbyLocation(),
|
||||||
onSuccess: (result) {
|
onSuccess: (result) async{
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
|
||||||
allPoultryLocation.value = Resource<List<PoultryLocationModel>>.success(result);
|
allPoultryLocation.value = Resource<List<PoultryLocationModel>>.success(result);
|
||||||
mapLogic.allLocations.value = Resource<List<PoultryLocationModel>>.success(result);
|
mapLogic.allLocations.value = Resource<List<PoultryLocationModel>>.success(result);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ class InspectionMapPage extends GetView<InspectionMapLogic> {
|
|||||||
filteringWidget: filterWidget(showIndex: 3.obs, filterIndex: 5.obs),
|
filteringWidget: filterWidget(showIndex: 3.obs, filterIndex: 5.obs),
|
||||||
widgets: [
|
widgets: [
|
||||||
MapPage(),
|
MapPage(),
|
||||||
ObxValue((p0) => Text(p0.toString()), controller.showIndex),
|
|
||||||
ObxValue((data) {
|
ObxValue((data) {
|
||||||
if (data.value) {
|
if (data.value) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
@@ -66,7 +65,7 @@ class InspectionMapPage extends GetView<InspectionMapLogic> {
|
|||||||
controller.baseLogic.searchTextController.clear();
|
controller.baseLogic.searchTextController.clear();
|
||||||
controller.baseLogic.searchValue.value = null;
|
controller.baseLogic.searchValue.value = null;
|
||||||
controller.baseLogic.isSearchSelected.value = false;
|
controller.baseLogic.isSearchSelected.value = false;
|
||||||
controller. mapLogic.hasFilterOrSearch.value = false;
|
controller.mapLogic.hasFilterOrSearch.value = false;
|
||||||
controller.searchedPoultryLocation.value = Resource.initial();
|
controller.searchedPoultryLocation.value = Resource.initial();
|
||||||
},
|
},
|
||||||
enableFeedback: true,
|
enableFeedback: true,
|
||||||
@@ -92,7 +91,6 @@ class InspectionMapPage extends GetView<InspectionMapLogic> {
|
|||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|
||||||
Get.back();
|
Get.back();
|
||||||
},
|
},
|
||||||
child: Assets.vec.mapSvg.svg(
|
child: Assets.vec.mapSvg.svg(
|
||||||
|
|||||||
@@ -74,6 +74,8 @@ class MapLogic extends GetxController with GetTickerProviderStateMixin {
|
|||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double _deg2rad(double deg) => deg * (pi / 180);
|
||||||
|
|
||||||
Future<void> determineCurrentPosition() async {
|
Future<void> determineCurrentPosition() async {
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
final position = await Geolocator.getCurrentPosition(
|
final position = await Geolocator.getCurrentPosition(
|
||||||
@@ -95,7 +97,8 @@ class MapLogic extends GetxController with GetTickerProviderStateMixin {
|
|||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* void debouncedUpdateVisibleMarkers({required LatLng center, required double zoom}) {
|
/*
|
||||||
|
void debouncedUpdateVisibleMarkers({required LatLng center, required double zoom}) {
|
||||||
_debounceTimer?.cancel();
|
_debounceTimer?.cancel();
|
||||||
_debounceTimer = Timer(const Duration(milliseconds: 300), () {
|
_debounceTimer = Timer(const Duration(milliseconds: 300), () {
|
||||||
final radius = getVisibleRadiusKm(
|
final radius = getVisibleRadiusKm(
|
||||||
@@ -105,7 +108,7 @@ class MapLogic extends GetxController with GetTickerProviderStateMixin {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final filtered = filterNearbyMarkers(
|
final filtered = filterNearbyMarkers(
|
||||||
allPoultryLocation.value.data ?? [],
|
all.value.data ?? [],
|
||||||
center.latitude,
|
center.latitude,
|
||||||
center.longitude,
|
center.longitude,
|
||||||
radius,
|
radius,
|
||||||
@@ -114,7 +117,8 @@ class MapLogic extends GetxController with GetTickerProviderStateMixin {
|
|||||||
final uniqueFiltered = filtered.where((e) => !existingIds.contains(e.id)).toList();
|
final uniqueFiltered = filtered.where((e) => !existingIds.contains(e.id)).toList();
|
||||||
markers2.addAll(uniqueFiltered);
|
markers2.addAll(uniqueFiltered);
|
||||||
});
|
});
|
||||||
}*/
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
List<LatLng> filterNearbyMarkers(
|
List<LatLng> filterNearbyMarkers(
|
||||||
List<LatLng> allMarkers,
|
List<LatLng> allMarkers,
|
||||||
@@ -127,13 +131,27 @@ class MapLogic extends GetxController with GetTickerProviderStateMixin {
|
|||||||
return allMarkers.where((marker) => distance(center, marker) <= radiusInMeters).toList();
|
return allMarkers.where((marker) => distance(center, marker) <= radiusInMeters).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
double getVisibleRadiusKm({
|
double getVisibleRadiusKm({required LatLng center, required LatLng corner}) {
|
||||||
required double zoom,
|
const earthRadius = 6371; // Km
|
||||||
required double screenWidthPx,
|
|
||||||
required double latitude,
|
final dLat = _deg2rad(corner.latitude - center.latitude);
|
||||||
}) {
|
final dLng = _deg2rad(corner.longitude - center.longitude);
|
||||||
double metersPerPixel = 156543.03392 * cos(latitude * pi / 180) / pow(2, zoom);
|
|
||||||
double visibleWidthInMeters = metersPerPixel * screenWidthPx;
|
final a =
|
||||||
return (visibleWidthInMeters / 2); // radius in Meter
|
sin(dLat / 2) * sin(dLat / 2) +
|
||||||
|
cos(_deg2rad(center.latitude)) *
|
||||||
|
cos(_deg2rad(corner.latitude)) *
|
||||||
|
sin(dLng / 2) *
|
||||||
|
sin(dLng / 2);
|
||||||
|
|
||||||
|
final c = 2 * atan2(sqrt(a), sqrt(1 - a));
|
||||||
|
return earthRadius * c;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isInVisibleBounds(LatLng point, LatLngBounds bounds) {
|
||||||
|
return point.latitude <= bounds.north &&
|
||||||
|
point.latitude >= bounds.south &&
|
||||||
|
point.longitude >= bounds.west &&
|
||||||
|
point.longitude <= bounds.east;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,11 @@ class MapPage extends GetView<MapLogic> {
|
|||||||
),
|
),
|
||||||
initialZoom: 15,
|
initialZoom: 15,
|
||||||
onPositionChanged: (camera, hasGesture) {
|
onPositionChanged: (camera, hasGesture) {
|
||||||
//controller.debouncedUpdateVisibleMarkers(center: camera.center, zoom: camera.zoom);
|
controller.currentZoom.value = camera.zoom;
|
||||||
|
/* controller.debouncedUpdateVisibleMarkers(
|
||||||
|
center: camera.center,
|
||||||
|
zoom: camera.zoom,
|
||||||
|
);*/
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -34,35 +38,14 @@ class MapPage extends GetView<MapLogic> {
|
|||||||
),
|
),
|
||||||
|
|
||||||
ObxValue((markers) {
|
ObxValue((markers) {
|
||||||
if (markers.value.status == ResourceStatus.success) {
|
|
||||||
return MarkerLayer(
|
|
||||||
markers: List.generate(markers.value.data?.length ?? 0, (index) {
|
|
||||||
final location = markers.value.data![index];
|
|
||||||
return markerWidget(
|
|
||||||
marker: location.latLng ?? LatLng(0, 0),
|
|
||||||
onTap: () {
|
|
||||||
controller.isSelectedDetailsLocation.value = true;
|
|
||||||
controller.animatedMapController.animateTo(
|
|
||||||
dest: location.latLng ?? LatLng(0, 0),
|
|
||||||
zoom: 18,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Container(width: 20, height: 20, color: Colors.lightGreen);
|
|
||||||
}, controller.markerLocations),
|
|
||||||
|
|
||||||
/* ObxValue((markers) {
|
|
||||||
return MarkerClusterLayerWidget(
|
return MarkerClusterLayerWidget(
|
||||||
options: MarkerClusterLayerOptions(
|
options: MarkerClusterLayerOptions(
|
||||||
maxClusterRadius: 80,
|
maxClusterRadius: 80,
|
||||||
size: const Size(40, 40),
|
size: const Size(40, 40),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
padding: const EdgeInsets.all(50),
|
padding: const EdgeInsets.all(50),
|
||||||
maxZoom: 15,
|
maxZoom: 18,
|
||||||
markers: buildMarkers(markers),
|
markers: buildMarkers(markers.value.data ?? []),
|
||||||
builder: (context, clusterMarkers) {
|
builder: (context, clusterMarkers) {
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@@ -79,27 +62,11 @@ class MapPage extends GetView<MapLogic> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}, controller.allLocations),*/
|
}, controller.markerLocations),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}, controller.currentLocation),
|
}, controller.currentLocation),
|
||||||
|
|
||||||
/* 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
|
// Uncomment the following lines to enable the search widget
|
||||||
/* Positioned(
|
/* Positioned(
|
||||||
top: 10,
|
top: 10,
|
||||||
@@ -133,21 +100,23 @@ class MapPage extends GetView<MapLogic> {
|
|||||||
}, controller.isLoading);
|
}, controller.isLoading);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Marker> buildMarkers(RxList<PoultryLocationModel> markers) {
|
List<Marker> buildMarkers(List<PoultryLocationModel> markers) {
|
||||||
final visibleBounds = controller.animatedMapController.mapController.camera.visibleBounds;
|
final visibleBounds = controller.animatedMapController.mapController.camera.visibleBounds;
|
||||||
final isZoomedIn = controller.currentZoom > 17;
|
final isZoomedIn = controller.currentZoom > 17;
|
||||||
|
|
||||||
final updatedMarkers = markers.map((location) {
|
final updatedMarkers = markers.map((location) {
|
||||||
final point = LatLng(location.lat ?? 0, location.long ?? 0);
|
final point = LatLng(location.lat ?? 0, location.long ?? 0);
|
||||||
final isVisible = visibleBounds.contains(point);
|
final isVisible = controller.isInVisibleBounds(point, visibleBounds);
|
||||||
|
|
||||||
|
if (isZoomedIn && isVisible) {
|
||||||
return Marker(
|
return Marker(
|
||||||
point: point,
|
point: point,
|
||||||
width: isZoomedIn && isVisible ? 180.w : 40.h,
|
width: 180.w,
|
||||||
height: isZoomedIn && isVisible ? 50.h : 50.h,
|
height: 50.h,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
bool hasHatching = location.hatching != null && location.hatching!.isNotEmpty;
|
bool hasHatching = location.hatching != null && location.hatching!.isNotEmpty;
|
||||||
|
iLog(hasHatching);
|
||||||
Get.bottomSheet(
|
Get.bottomSheet(
|
||||||
ObxValue((data) {
|
ObxValue((data) {
|
||||||
return BaseBottomSheet(
|
return BaseBottomSheet(
|
||||||
@@ -174,7 +143,9 @@ class MapPage extends GetView<MapLogic> {
|
|||||||
Text(
|
Text(
|
||||||
location.unitName ?? 'N/A',
|
location.unitName ?? 'N/A',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
|
style: AppFonts.yekan16.copyWith(
|
||||||
|
color: AppColor.greenDark,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -418,14 +389,17 @@ class MapPage extends GetView<MapLogic> {
|
|||||||
|
|
||||||
Text(
|
Text(
|
||||||
location.hatching?.first.date?.formattedJalaliDate ?? 'N/A',
|
location.hatching?.first.date?.formattedJalaliDate ?? 'N/A',
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
style: AppFonts.yekan14.copyWith(
|
||||||
|
color: AppColor.blueNormal,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
buildRow(
|
buildRow(
|
||||||
title: 'باقیمانده',
|
title: 'باقیمانده',
|
||||||
value: location.hatching?.first.leftOver.separatedByComma ?? 'N/A',
|
value:
|
||||||
|
location.hatching?.first.leftOver.separatedByComma ?? 'N/A',
|
||||||
),
|
),
|
||||||
buildRow(
|
buildRow(
|
||||||
title: 'سن جوجه ریزی',
|
title: 'سن جوجه ریزی',
|
||||||
@@ -447,8 +421,7 @@ class MapPage extends GetView<MapLogic> {
|
|||||||
isDismissible: true,
|
isDismissible: true,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: isZoomedIn && isVisible
|
child: Container(
|
||||||
? Container(
|
|
||||||
height: 30.h,
|
height: 30.h,
|
||||||
padding: EdgeInsets.all(5.r),
|
padding: EdgeInsets.all(5.r),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@@ -470,10 +443,324 @@ class MapPage extends GetView<MapLogic> {
|
|||||||
Text(location.user?.fullname ?? '', style: AppFonts.yekan12),
|
Text(location.user?.fullname ?? '', style: AppFonts.yekan12),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
: Assets.vec.chickenMapMarkerSvg.svg(width: 24.w, height: 24.h),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
return Marker(
|
||||||
|
point: point,
|
||||||
|
width: 40.h,
|
||||||
|
height: 50.h,
|
||||||
|
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(
|
||||||
|
'جوجه ریزی فعال',
|
||||||
|
style: AppFonts.yekan14.copyWith(
|
||||||
|
color: AppColor.textColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
Text(
|
||||||
|
hasHatching ? 'دارد' : 'ندارد',
|
||||||
|
style: AppFonts.yekan14.copyWith(
|
||||||
|
color: AppColor.blueNormal,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
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(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
if (hasHatching) ...{
|
||||||
|
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),
|
||||||
|
),
|
||||||
|
|
||||||
|
Text(
|
||||||
|
location.hatching?.first.date?.formattedJalaliDate ?? 'N/A',
|
||||||
|
style: AppFonts.yekan14.copyWith(
|
||||||
|
color: AppColor.blueNormal,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
buildRow(
|
||||||
|
title: 'باقیمانده',
|
||||||
|
value:
|
||||||
|
'${location.hatching?.first.leftOver.separatedByComma ?? 'N/A'} عدد',
|
||||||
|
),
|
||||||
|
buildRow(
|
||||||
|
title: 'سن جوجه ریزی',
|
||||||
|
value: '${location.hatching?.first.chickenAge ?? 'N/A'} روز',
|
||||||
|
),
|
||||||
|
buildRow(
|
||||||
|
title: 'شماره مجوز جوجه ریزی',
|
||||||
|
value: location.hatching?.first.licenceNumber.toString() ?? 'N/A',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}, controller.isSelectedDetailsLocation),
|
||||||
|
isScrollControlled: true,
|
||||||
|
isDismissible: true,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Assets.vec.chickenMapMarkerSvg.svg(width: 24.w, height: 24.h),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
||||||
return updatedMarkers;
|
return updatedMarkers;
|
||||||
|
|||||||
Reference in New Issue
Block a user