feat : live stock batch
This commit is contained in:
6
packages/livestock/build.yaml
Normal file
6
packages/livestock/build.yaml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
targets:
|
||||||
|
$default:
|
||||||
|
builders:
|
||||||
|
json_serializable:
|
||||||
|
options:
|
||||||
|
field_rename: snake
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
import 'package:rasadyar_livestock/data/model/response/address/address.dart';
|
import 'package:rasadyar_livestock/data/model/response/address/address.dart';
|
||||||
|
import 'package:rasadyar_livestock/data/model/response/live_tmp/livestock_model.dart';
|
||||||
|
|
||||||
abstract class LivestockRemoteDataSource {
|
abstract class LivestockRemoteDataSource {
|
||||||
Future<LocationDetails> getLocationDetailsByLatLng({required double latitude, required double longitude});
|
Future<LocationDetails> getLocationDetailsByLatLng({
|
||||||
|
required double latitude,
|
||||||
|
required double longitude,
|
||||||
|
});
|
||||||
|
|
||||||
|
Future<bool> createTaggingLiveStock({required LivestockData data});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
import 'package:rasadyar_livestock/data/data_source/remote/livestock/livestock_remote.dart';
|
import 'package:rasadyar_livestock/data/data_source/remote/livestock/livestock_remote.dart';
|
||||||
import 'package:rasadyar_livestock/data/model/response/address/address.dart';
|
import 'package:rasadyar_livestock/data/model/response/address/address.dart';
|
||||||
|
import 'package:rasadyar_livestock/data/model/response/live_tmp/livestock_model.dart';
|
||||||
|
|
||||||
class LivestockRemoteDataSourceImp implements LivestockRemoteDataSource {
|
class LivestockRemoteDataSourceImp implements LivestockRemoteDataSource {
|
||||||
@override
|
@override
|
||||||
@@ -26,4 +27,29 @@ class LivestockRemoteDataSourceImp implements LivestockRemoteDataSource {
|
|||||||
rethrow;
|
rethrow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<bool> createTaggingLiveStock({required LivestockData data}) async {
|
||||||
|
try {
|
||||||
|
Dio dio = Dio();
|
||||||
|
dio.interceptors.add(PrettyDioLogger(
|
||||||
|
requestBody: true,
|
||||||
|
responseBody: true,
|
||||||
|
requestHeader: true,
|
||||||
|
responseHeader: true,
|
||||||
|
error: true,
|
||||||
|
compact: true,
|
||||||
|
));
|
||||||
|
dio.options.baseUrl = 'https://everestacademy.ir/live/';
|
||||||
|
final response = await dio.post('api.php', data: data.toJson());
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
final data = response.data;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
throw Exception('Failed to load address');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ _LoginRequestModel _$LoginRequestModelFromJson(Map<String, dynamic> json) =>
|
|||||||
_LoginRequestModel(
|
_LoginRequestModel(
|
||||||
username: json['username'] as String?,
|
username: json['username'] as String?,
|
||||||
password: json['password'] as String?,
|
password: json['password'] as String?,
|
||||||
captchaCode: json['captchaCode'] as String?,
|
captchaCode: json['captcha_code'] as String?,
|
||||||
captchaKey: json['captchaKey'] as String?,
|
captchaKey: json['captcha_key'] as String?,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$LoginRequestModelToJson(_LoginRequestModel instance) =>
|
Map<String, dynamic> _$LoginRequestModelToJson(_LoginRequestModel instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'username': instance.username,
|
'username': instance.username,
|
||||||
'password': instance.password,
|
'password': instance.password,
|
||||||
'captchaCode': instance.captchaCode,
|
'captcha_code': instance.captchaCode,
|
||||||
'captchaKey': instance.captchaKey,
|
'captcha_key': instance.captchaKey,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ _Address _$AddressFromJson(Map<String, dynamic> json) => _Address(
|
|||||||
district: json['district'] as String?,
|
district: json['district'] as String?,
|
||||||
county: json['county'] as String?,
|
county: json['county'] as String?,
|
||||||
province: json['province'] as String?,
|
province: json['province'] as String?,
|
||||||
ISO3166_2_lvl4: json['ISO3166_2_lvl4'] as String?,
|
ISO3166_2_lvl4: json['i_s_o3166_2_lvl4'] as String?,
|
||||||
postcode: json['postcode'] as String?,
|
postcode: json['postcode'] as String?,
|
||||||
country: json['country'] as String?,
|
country: json['country'] as String?,
|
||||||
country_code: json['country_code'] as String?,
|
country_code: json['country_code'] as String?,
|
||||||
@@ -32,7 +32,7 @@ Map<String, dynamic> _$AddressToJson(_Address instance) => <String, dynamic>{
|
|||||||
'district': instance.district,
|
'district': instance.district,
|
||||||
'county': instance.county,
|
'county': instance.county,
|
||||||
'province': instance.province,
|
'province': instance.province,
|
||||||
'ISO3166_2_lvl4': instance.ISO3166_2_lvl4,
|
'i_s_o3166_2_lvl4': instance.ISO3166_2_lvl4,
|
||||||
'postcode': instance.postcode,
|
'postcode': instance.postcode,
|
||||||
'country': instance.country,
|
'country': instance.country,
|
||||||
'country_code': instance.country_code,
|
'country_code': instance.country_code,
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ _AuthResponseModel _$AuthResponseModelFromJson(Map<String, dynamic> json) =>
|
|||||||
_AuthResponseModel(
|
_AuthResponseModel(
|
||||||
refresh: json['refresh'] as String?,
|
refresh: json['refresh'] as String?,
|
||||||
access: json['access'] as String?,
|
access: json['access'] as String?,
|
||||||
otpStatus: json['otpStatus'] as bool?,
|
otpStatus: json['otp_status'] as bool?,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$AuthResponseModelToJson(_AuthResponseModel instance) =>
|
Map<String, dynamic> _$AuthResponseModelToJson(_AuthResponseModel instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'refresh': instance.refresh,
|
'refresh': instance.refresh,
|
||||||
'access': instance.access,
|
'access': instance.access,
|
||||||
'otpStatus': instance.otpStatus,
|
'otp_status': instance.otpStatus,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,17 +9,17 @@ part of 'captcha_response_model.dart';
|
|||||||
_CaptchaResponseModel _$CaptchaResponseModelFromJson(
|
_CaptchaResponseModel _$CaptchaResponseModelFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => _CaptchaResponseModel(
|
) => _CaptchaResponseModel(
|
||||||
captchaKey: json['captchaKey'] as String?,
|
captchaKey: json['captcha_key'] as String?,
|
||||||
captchaImage: json['captchaImage'] as String?,
|
captchaImage: json['captcha_image'] as String?,
|
||||||
imageType: json['imageType'] as String?,
|
imageType: json['image_type'] as String?,
|
||||||
imageDecode: json['imageDecode'] as String?,
|
imageDecode: json['image_decode'] as String?,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$CaptchaResponseModelToJson(
|
Map<String, dynamic> _$CaptchaResponseModelToJson(
|
||||||
_CaptchaResponseModel instance,
|
_CaptchaResponseModel instance,
|
||||||
) => <String, dynamic>{
|
) => <String, dynamic>{
|
||||||
'captchaKey': instance.captchaKey,
|
'captcha_key': instance.captchaKey,
|
||||||
'captchaImage': instance.captchaImage,
|
'captcha_image': instance.captchaImage,
|
||||||
'imageType': instance.imageType,
|
'image_type': instance.imageType,
|
||||||
'imageDecode': instance.imageDecode,
|
'image_decode': instance.imageDecode,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
part 'livestock_model.freezed.dart';
|
||||||
|
part 'livestock_model.g.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class LivestockData with _$LivestockData {
|
||||||
|
const factory LivestockData({Rancher? rancher, Herd? herd, List<Livestock>? livestock}) =
|
||||||
|
_LivestockData;
|
||||||
|
|
||||||
|
factory LivestockData.fromJson(Map<String, dynamic> json) => _$LivestockDataFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class Rancher with _$Rancher {
|
||||||
|
const factory Rancher({String? name, String? phone, String? image}) = _Rancher;
|
||||||
|
|
||||||
|
factory Rancher.fromJson(Map<String, dynamic> json) => _$RancherFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class Herd with _$Herd {
|
||||||
|
const factory Herd({Location? location, String? address, String? image}) = _Herd;
|
||||||
|
|
||||||
|
factory Herd.fromJson(Map<String, dynamic> json) => _$HerdFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class Location with _$Location {
|
||||||
|
const factory Location({double? lat, double? lng}) = _Location;
|
||||||
|
|
||||||
|
factory Location.fromJson(Map<String, dynamic> json) => _$LocationFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class Livestock with _$Livestock {
|
||||||
|
const factory Livestock({
|
||||||
|
String? species,
|
||||||
|
String? breed,
|
||||||
|
String? dateOfBirth,
|
||||||
|
String? sex,
|
||||||
|
String? motherTag,
|
||||||
|
String? fatherTag,
|
||||||
|
String? tagNumber,
|
||||||
|
String? tagType,
|
||||||
|
String? image,
|
||||||
|
}) = _Livestock;
|
||||||
|
|
||||||
|
factory Livestock.fromJson(Map<String, dynamic> json) => _$LivestockFromJson(json);
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,88 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'livestock_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_LivestockData _$LivestockDataFromJson(Map<String, dynamic> json) =>
|
||||||
|
_LivestockData(
|
||||||
|
rancher: json['rancher'] == null
|
||||||
|
? null
|
||||||
|
: Rancher.fromJson(json['rancher'] as Map<String, dynamic>),
|
||||||
|
herd: json['herd'] == null
|
||||||
|
? null
|
||||||
|
: Herd.fromJson(json['herd'] as Map<String, dynamic>),
|
||||||
|
livestock: (json['livestock'] as List<dynamic>?)
|
||||||
|
?.map((e) => Livestock.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$LivestockDataToJson(_LivestockData instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'rancher': instance.rancher,
|
||||||
|
'herd': instance.herd,
|
||||||
|
'livestock': instance.livestock,
|
||||||
|
};
|
||||||
|
|
||||||
|
_Rancher _$RancherFromJson(Map<String, dynamic> json) => _Rancher(
|
||||||
|
name: json['name'] as String?,
|
||||||
|
phone: json['phone'] as String?,
|
||||||
|
image: json['image'] as String?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$RancherToJson(_Rancher instance) => <String, dynamic>{
|
||||||
|
'name': instance.name,
|
||||||
|
'phone': instance.phone,
|
||||||
|
'image': instance.image,
|
||||||
|
};
|
||||||
|
|
||||||
|
_Herd _$HerdFromJson(Map<String, dynamic> json) => _Herd(
|
||||||
|
location: json['location'] == null
|
||||||
|
? null
|
||||||
|
: Location.fromJson(json['location'] as Map<String, dynamic>),
|
||||||
|
address: json['address'] as String?,
|
||||||
|
image: json['image'] as String?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$HerdToJson(_Herd instance) => <String, dynamic>{
|
||||||
|
'location': instance.location,
|
||||||
|
'address': instance.address,
|
||||||
|
'image': instance.image,
|
||||||
|
};
|
||||||
|
|
||||||
|
_Location _$LocationFromJson(Map<String, dynamic> json) => _Location(
|
||||||
|
lat: (json['lat'] as num?)?.toDouble(),
|
||||||
|
lng: (json['lng'] as num?)?.toDouble(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$LocationToJson(_Location instance) => <String, dynamic>{
|
||||||
|
'lat': instance.lat,
|
||||||
|
'lng': instance.lng,
|
||||||
|
};
|
||||||
|
|
||||||
|
_Livestock _$LivestockFromJson(Map<String, dynamic> json) => _Livestock(
|
||||||
|
species: json['species'] as String?,
|
||||||
|
breed: json['breed'] as String?,
|
||||||
|
dateOfBirth: json['date_of_birth'] as String?,
|
||||||
|
sex: json['sex'] as String?,
|
||||||
|
motherTag: json['mother_tag'] as String?,
|
||||||
|
fatherTag: json['father_tag'] as String?,
|
||||||
|
tagNumber: json['tag_number'] as String?,
|
||||||
|
tagType: json['tag_type'] as String?,
|
||||||
|
image: json['image'] as String?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$LivestockToJson(_Livestock instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'species': instance.species,
|
||||||
|
'breed': instance.breed,
|
||||||
|
'date_of_birth': instance.dateOfBirth,
|
||||||
|
'sex': instance.sex,
|
||||||
|
'mother_tag': instance.motherTag,
|
||||||
|
'father_tag': instance.fatherTag,
|
||||||
|
'tag_number': instance.tagNumber,
|
||||||
|
'tag_type': instance.tagType,
|
||||||
|
'image': instance.image,
|
||||||
|
};
|
||||||
@@ -26,12 +26,12 @@ _User _$UserFromJson(Map<String, dynamic> json) => _User(
|
|||||||
id: (json['id'] as num).toInt(),
|
id: (json['id'] as num).toInt(),
|
||||||
username: json['username'] as String,
|
username: json['username'] as String,
|
||||||
password: json['password'] as String,
|
password: json['password'] as String,
|
||||||
firstName: json['firstName'] as String,
|
firstName: json['first_name'] as String,
|
||||||
lastName: json['lastName'] as String,
|
lastName: json['last_name'] as String,
|
||||||
isActive: json['isActive'] as bool,
|
isActive: json['is_active'] as bool,
|
||||||
mobile: json['mobile'] as String,
|
mobile: json['mobile'] as String,
|
||||||
phone: json['phone'] as String,
|
phone: json['phone'] as String,
|
||||||
nationalCode: json['nationalCode'] as String,
|
nationalCode: json['national_code'] as String,
|
||||||
birthdate: DateTime.parse(json['birthdate'] as String),
|
birthdate: DateTime.parse(json['birthdate'] as String),
|
||||||
nationality: json['nationality'] as String,
|
nationality: json['nationality'] as String,
|
||||||
ownership: json['ownership'] as String,
|
ownership: json['ownership'] as String,
|
||||||
@@ -39,21 +39,21 @@ _User _$UserFromJson(Map<String, dynamic> json) => _User(
|
|||||||
photo: json['photo'] as String,
|
photo: json['photo'] as String,
|
||||||
province: (json['province'] as num).toInt(),
|
province: (json['province'] as num).toInt(),
|
||||||
city: (json['city'] as num).toInt(),
|
city: (json['city'] as num).toInt(),
|
||||||
otpStatus: json['otpStatus'] as bool,
|
otpStatus: json['otp_status'] as bool,
|
||||||
cityName: json['cityName'] as String,
|
cityName: json['city_name'] as String,
|
||||||
provinceName: json['provinceName'] as String,
|
provinceName: json['province_name'] as String,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$UserToJson(_User instance) => <String, dynamic>{
|
Map<String, dynamic> _$UserToJson(_User instance) => <String, dynamic>{
|
||||||
'id': instance.id,
|
'id': instance.id,
|
||||||
'username': instance.username,
|
'username': instance.username,
|
||||||
'password': instance.password,
|
'password': instance.password,
|
||||||
'firstName': instance.firstName,
|
'first_name': instance.firstName,
|
||||||
'lastName': instance.lastName,
|
'last_name': instance.lastName,
|
||||||
'isActive': instance.isActive,
|
'is_active': instance.isActive,
|
||||||
'mobile': instance.mobile,
|
'mobile': instance.mobile,
|
||||||
'phone': instance.phone,
|
'phone': instance.phone,
|
||||||
'nationalCode': instance.nationalCode,
|
'national_code': instance.nationalCode,
|
||||||
'birthdate': instance.birthdate.toIso8601String(),
|
'birthdate': instance.birthdate.toIso8601String(),
|
||||||
'nationality': instance.nationality,
|
'nationality': instance.nationality,
|
||||||
'ownership': instance.ownership,
|
'ownership': instance.ownership,
|
||||||
@@ -61,14 +61,14 @@ Map<String, dynamic> _$UserToJson(_User instance) => <String, dynamic>{
|
|||||||
'photo': instance.photo,
|
'photo': instance.photo,
|
||||||
'province': instance.province,
|
'province': instance.province,
|
||||||
'city': instance.city,
|
'city': instance.city,
|
||||||
'otpStatus': instance.otpStatus,
|
'otp_status': instance.otpStatus,
|
||||||
'cityName': instance.cityName,
|
'city_name': instance.cityName,
|
||||||
'provinceName': instance.provinceName,
|
'province_name': instance.provinceName,
|
||||||
};
|
};
|
||||||
|
|
||||||
_Role _$RoleFromJson(Map<String, dynamic> json) => _Role(
|
_Role _$RoleFromJson(Map<String, dynamic> json) => _Role(
|
||||||
id: (json['id'] as num).toInt(),
|
id: (json['id'] as num).toInt(),
|
||||||
roleName: json['roleName'] as String,
|
roleName: json['role_name'] as String,
|
||||||
description: json['description'] as String,
|
description: json['description'] as String,
|
||||||
type: RoleType.fromJson(json['type'] as Map<String, dynamic>),
|
type: RoleType.fromJson(json['type'] as Map<String, dynamic>),
|
||||||
permissions: json['permissions'] as List<dynamic>,
|
permissions: json['permissions'] as List<dynamic>,
|
||||||
@@ -76,7 +76,7 @@ _Role _$RoleFromJson(Map<String, dynamic> json) => _Role(
|
|||||||
|
|
||||||
Map<String, dynamic> _$RoleToJson(_Role instance) => <String, dynamic>{
|
Map<String, dynamic> _$RoleToJson(_Role instance) => <String, dynamic>{
|
||||||
'id': instance.id,
|
'id': instance.id,
|
||||||
'roleName': instance.roleName,
|
'role_name': instance.roleName,
|
||||||
'description': instance.description,
|
'description': instance.description,
|
||||||
'type': instance.type,
|
'type': instance.type,
|
||||||
'permissions': instance.permissions,
|
'permissions': instance.permissions,
|
||||||
@@ -91,14 +91,14 @@ Map<String, dynamic> _$RoleTypeToJson(_RoleType instance) => <String, dynamic>{
|
|||||||
};
|
};
|
||||||
|
|
||||||
_Permission _$PermissionFromJson(Map<String, dynamic> json) => _Permission(
|
_Permission _$PermissionFromJson(Map<String, dynamic> json) => _Permission(
|
||||||
pageName: json['pageName'] as String,
|
pageName: json['page_name'] as String,
|
||||||
pageAccess: (json['pageAccess'] as List<dynamic>)
|
pageAccess: (json['page_access'] as List<dynamic>)
|
||||||
.map((e) => e as String)
|
.map((e) => e as String)
|
||||||
.toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$PermissionToJson(_Permission instance) =>
|
Map<String, dynamic> _$PermissionToJson(_Permission instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'pageName': instance.pageName,
|
'page_name': instance.pageName,
|
||||||
'pageAccess': instance.pageAccess,
|
'page_access': instance.pageAccess,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:rasadyar_livestock/data/model/response/address/address.dart';
|
import 'package:rasadyar_livestock/data/model/response/address/address.dart';
|
||||||
import 'package:rasadyar_livestock/data/model/response/auth/auth_response_model.dart';
|
import 'package:rasadyar_livestock/data/model/response/auth/auth_response_model.dart';
|
||||||
import 'package:rasadyar_livestock/data/model/response/captcha/captcha_response_model.dart';
|
import 'package:rasadyar_livestock/data/model/response/captcha/captcha_response_model.dart';
|
||||||
|
import 'package:rasadyar_livestock/data/model/response/live_tmp/livestock_model.dart';
|
||||||
|
|
||||||
abstract class LivestockRepository {
|
abstract class LivestockRepository {
|
||||||
Future<LocationDetails?> getLocationDetails({
|
Future<LocationDetails?> getLocationDetails({
|
||||||
@@ -8,4 +9,6 @@ abstract class LivestockRepository {
|
|||||||
required double longitude,
|
required double longitude,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Future<bool> createTaggingLiveStock({required LivestockData data});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:rasadyar_livestock/data/data_source/remote/livestock/livestock_remote.dart';
|
import 'package:rasadyar_livestock/data/data_source/remote/livestock/livestock_remote.dart';
|
||||||
import 'package:rasadyar_livestock/data/model/response/address/address.dart';
|
import 'package:rasadyar_livestock/data/model/response/address/address.dart';
|
||||||
|
import 'package:rasadyar_livestock/data/model/response/live_tmp/livestock_model.dart';
|
||||||
|
|
||||||
import 'livestock_repository.dart';
|
import 'livestock_repository.dart';
|
||||||
|
|
||||||
@@ -9,10 +10,18 @@ class LivestockRepositoryImp implements LivestockRepository {
|
|||||||
LivestockRepositoryImp({required this.livestockRemote});
|
LivestockRepositoryImp({required this.livestockRemote});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<LocationDetails?> getLocationDetails({required double latitude, required double longitude}) async {
|
Future<LocationDetails?> getLocationDetails({
|
||||||
|
required double latitude,
|
||||||
|
required double longitude,
|
||||||
|
}) async {
|
||||||
return await livestockRemote.getLocationDetailsByLatLng(
|
return await livestockRemote.getLocationDetailsByLatLng(
|
||||||
latitude: latitude,
|
latitude: latitude,
|
||||||
longitude: longitude,
|
longitude: longitude,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<bool> createTaggingLiveStock({required LivestockData data}) async {
|
||||||
|
return await livestockRemote.createTaggingLiveStock(data: data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,11 +136,11 @@ class AuthPage extends GetView<AuthLogic> {
|
|||||||
})
|
})
|
||||||
: null,
|
: null,
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value == null || value.isEmpty) {
|
/* if (value == null || value.isEmpty) {
|
||||||
return '⚠️ شماره موبایل را وارد کنید';
|
return '⚠️ شماره موبایل را وارد کنید';
|
||||||
} else if (value.length < 10) {
|
} else if (value.length < 10) {
|
||||||
return '⚠️ شماره موبایل باید 11 رقم باشد';
|
return '⚠️ شماره موبایل باید 11 رقم باشد';
|
||||||
}
|
}*/
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
style: AppFonts.yekan13,
|
style: AppFonts.yekan13,
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -42,12 +42,10 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
|||||||
flex: 2,
|
flex: 2,
|
||||||
child: RElevated(
|
child: RElevated(
|
||||||
height: 40.h,
|
height: 40.h,
|
||||||
onPressed: () {
|
|
||||||
controller.currentIndex.value++;
|
|
||||||
},
|
|
||||||
enabled: data.value,
|
enabled: data.value,
|
||||||
// onPressed: controller.onNext,
|
onPressed: controller.onNext,
|
||||||
child: Text('بعدی'),
|
isLoading: controller.isLoading.value,
|
||||||
|
child: Text(controller.currentIndex.value == 2 ? 'ثبت' : 'بعدی'),
|
||||||
backgroundColor: AppColor.blueNormal,
|
backgroundColor: AppColor.blueNormal,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -186,7 +184,7 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
|||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await controller.pickImage();
|
await controller.pickImage(controller.rancherImage);
|
||||||
await showCropDialog();
|
await showCropDialog();
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -284,7 +282,8 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
|||||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.textColor),
|
style: AppFonts.yekan16Bold.copyWith(color: AppColor.textColor),
|
||||||
),
|
),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: controller.addressLocationValue.string ?? 'N/A',
|
text:
|
||||||
|
'${controller.addressLocationValue.value?.latitude} , ${controller.addressLocationValue.value?.longitude}',
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -337,7 +336,7 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
|||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await controller.pickImage();
|
await controller.pickImage(controller.herdImage);
|
||||||
await showCropDialog();
|
await showCropDialog();
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -392,24 +391,11 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
|||||||
_buildSearchWidget(),
|
_buildSearchWidget(),
|
||||||
_buildInfoDetails(),
|
_buildInfoDetails(),
|
||||||
_buildListContent(),
|
_buildListContent(),
|
||||||
SizedBox(height: 10),
|
|
||||||
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(35, 0, 35, 20),
|
|
||||||
child: RElevated(
|
|
||||||
text: 'ثبت نهایی و ارسال به اتحادیه',
|
|
||||||
textStyle: AppFonts.yekan18,
|
|
||||||
height: 40,
|
|
||||||
backgroundColor: AppColor.greenNormal,
|
|
||||||
onPressed: () {},
|
|
||||||
isFullWidth: true,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
right: 10,
|
right: 10,
|
||||||
bottom: 75,
|
bottom: 5,
|
||||||
child: RFab.add(
|
child: RFab.add(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Get.bottomSheet(_buildBottomSheet(), isScrollControlled: true);
|
Get.bottomSheet(_buildBottomSheet(), isScrollControlled: true);
|
||||||
@@ -436,26 +422,28 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
|||||||
|
|
||||||
Expanded _buildListContent() {
|
Expanded _buildListContent() {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: RListView.separated(
|
child: ObxValue((data) {
|
||||||
itemCount: 20,
|
return RListView.separated(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8.w),
|
itemCount: data.length,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
padding: EdgeInsets.symmetric(horizontal: 8.w),
|
||||||
return ObxValue((val) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
return ExpandableListItem2(
|
return ObxValue((val) {
|
||||||
isTag: true,
|
return ExpandableListItem2(
|
||||||
selected: val.contains(index),
|
isTag: true,
|
||||||
onTap: () => controller.isExpandedList.toggle(index),
|
selected: val.contains(index),
|
||||||
index: index,
|
onTap: () => controller.isExpandedList.toggle(index),
|
||||||
child: itemListWidget(index),
|
index: index,
|
||||||
secondChild: itemListExpandedWidget(index),
|
child: itemListWidget(index),
|
||||||
labelColor: AppColor.blueLight,
|
secondChild: itemListExpandedWidget(index),
|
||||||
labelIcon: Assets.vec.virtualSvg.path,
|
labelColor: AppColor.blueLight,
|
||||||
);
|
labelIcon: Assets.vec.virtualSvg.path,
|
||||||
}, controller.isExpandedList);
|
);
|
||||||
},
|
}, controller.isExpandedList);
|
||||||
resource: Resource.success(List.generate(20, (i) => i)),
|
},
|
||||||
separatorBuilder: (BuildContext context, int index) => SizedBox(height: 8.h),
|
resource: Resource.success(List.generate(data.length, (i) => i)),
|
||||||
),
|
separatorBuilder: (BuildContext context, int index) => SizedBox(height: 8.h),
|
||||||
|
);
|
||||||
|
}, controller.livestockList),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -521,12 +509,13 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 8.0),
|
padding: const EdgeInsets.only(top: 8.0),
|
||||||
child: RElevated(
|
child: RElevated(
|
||||||
text: 'افزودن دام به گله',
|
text: 'افزودن دام به گله',
|
||||||
textStyle: AppFonts.yekan18.copyWith(color: Colors.white),
|
textStyle: AppFonts.yekan18.copyWith(color: Colors.white),
|
||||||
width: Get.width,
|
width: Get.width,
|
||||||
backgroundColor: AppColor.greenNormal,
|
backgroundColor: AppColor.greenNormal,
|
||||||
height: 40,
|
height: 40,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
controller.addLiveStock();
|
||||||
Get.back();
|
Get.back();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -712,45 +701,61 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
|||||||
SizedBox _buildLiveStockImage() {
|
SizedBox _buildLiveStockImage() {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: Get.width,
|
width: Get.width,
|
||||||
height: 350,
|
height: 356.h,
|
||||||
child: Card(
|
child: Container(
|
||||||
color: Colors.white,
|
padding: EdgeInsets.all(8.r),
|
||||||
child: Padding(
|
decoration: BoxDecoration(
|
||||||
padding: const EdgeInsets.all(16.0),
|
border: Border.all(color: AppColor.lightGreyNormal, width: 1.w),
|
||||||
child: Column(
|
borderRadius: BorderRadius.circular(8.r),
|
||||||
children: [
|
),
|
||||||
Expanded(
|
child: Column(
|
||||||
child: Container(
|
spacing: 8,
|
||||||
width: Get.width,
|
children: [
|
||||||
decoration: BoxDecoration(
|
Row(children: [Text('تصویر دام', style: AppFonts.yekan16Bold)]),
|
||||||
color: AppColor.lightGreyNormal,
|
Expanded(
|
||||||
borderRadius: BorderRadius.circular(8),
|
child: Container(
|
||||||
),
|
width: Get.width,
|
||||||
child: Center(child: Assets.images.placeHolder.image(height: 150, width: 200)),
|
decoration: BoxDecoration(
|
||||||
|
color: AppColor.lightGreyNormal,
|
||||||
|
borderRadius: BorderRadius.circular(8.r),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: ObxValue((tmpImage) {
|
||||||
|
if (tmpImage.value == null) {
|
||||||
|
return Assets.vec.placeHolderSvg.svg(height: 150.h, width: 200.w);
|
||||||
|
} else {
|
||||||
|
return Image.file(File(tmpImage.value!.path), fit: BoxFit.cover);
|
||||||
|
}
|
||||||
|
}, controller.taggingImage),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 15),
|
),
|
||||||
Container(
|
GestureDetector(
|
||||||
|
onTap: () async {
|
||||||
|
await controller.pickImage(controller.taggingImage);
|
||||||
|
await showCropDialog();
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
width: Get.width,
|
width: Get.width,
|
||||||
height: 40,
|
height: 40.h,
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
decoration: ShapeDecoration(
|
decoration: ShapeDecoration(
|
||||||
color: AppColor.blueNormal,
|
color: AppColor.blueNormal,
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(10.0),
|
padding: EdgeInsets.all(10.r),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text('تصویر دام', style: AppFonts.yekan14.copyWith(color: Colors.white)),
|
Text(' دوربین', style: AppFonts.yekan14.copyWith(color: Colors.white)),
|
||||||
Icon(CupertinoIcons.arrow_up_doc, color: Colors.white),
|
Icon(CupertinoIcons.arrow_up_doc, color: Colors.white),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -760,7 +765,7 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
|||||||
return OverlayDropdownWidget(
|
return OverlayDropdownWidget(
|
||||||
items: ['نوع پلاک 1', 'نوع پلاک 2', 'نوع پلاک 3'],
|
items: ['نوع پلاک 1', 'نوع پلاک 2', 'نوع پلاک 3'],
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
print('Selected Breed: $value');
|
controller.tagType.value = value;
|
||||||
},
|
},
|
||||||
itemBuilder: (item) => Text(item),
|
itemBuilder: (item) => Text(item),
|
||||||
labelBuilder: (item) => Text(item ?? 'نوع پلاک'),
|
labelBuilder: (item) => Text(item ?? 'نوع پلاک'),
|
||||||
@@ -769,6 +774,7 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
|||||||
|
|
||||||
TextFiledFixedHint _buildTagNumber() {
|
TextFiledFixedHint _buildTagNumber() {
|
||||||
return TextFiledFixedHint(
|
return TextFiledFixedHint(
|
||||||
|
controller: controller.herdTagController,
|
||||||
inputType: InputType.number,
|
inputType: InputType.number,
|
||||||
hintText: 'پلاک دام',
|
hintText: 'پلاک دام',
|
||||||
onChanged: (String value) {
|
onChanged: (String value) {
|
||||||
@@ -779,21 +785,19 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
|||||||
|
|
||||||
TextFiledFixedHint _buildFatherTagNumber() {
|
TextFiledFixedHint _buildFatherTagNumber() {
|
||||||
return TextFiledFixedHint(
|
return TextFiledFixedHint(
|
||||||
|
controller: controller.fatherTagNumberController,
|
||||||
inputType: InputType.number,
|
inputType: InputType.number,
|
||||||
hintText: 'پلاک پدر ',
|
hintText: 'پلاک پدر ',
|
||||||
onChanged: (String value) {
|
onChanged: (String value) {},
|
||||||
eLog('father Tag: $value');
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextFiledFixedHint _buildMotherTagNumber() {
|
TextFiledFixedHint _buildMotherTagNumber() {
|
||||||
return TextFiledFixedHint(
|
return TextFiledFixedHint(
|
||||||
|
controller: controller.motherTagNumberController,
|
||||||
inputType: InputType.number,
|
inputType: InputType.number,
|
||||||
hintText: 'پلاک مادر ',
|
hintText: 'پلاک مادر ',
|
||||||
onChanged: (String value) {
|
onChanged: (value) {},
|
||||||
eLog('Mother Tag: $value');
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -801,7 +805,8 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
|||||||
return OverlayDropdownWidget(
|
return OverlayDropdownWidget(
|
||||||
items: ['نوع نژاد 1', 'نوع نژاد 2', 'نوع نژاد 3'],
|
items: ['نوع نژاد 1', 'نوع نژاد 2', 'نوع نژاد 3'],
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
print('Selected Breed: $value');
|
controller.breed.value = value;
|
||||||
|
eLog('Selected Breed: $value');
|
||||||
},
|
},
|
||||||
itemBuilder: (item) => Text(item),
|
itemBuilder: (item) => Text(item),
|
||||||
labelBuilder: (item) => Text(item ?? 'نژاد'),
|
labelBuilder: (item) => Text(item ?? 'نژاد'),
|
||||||
@@ -846,24 +851,39 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Container _buildLivestockBirthday() {
|
Widget _buildLivestockBirthday() {
|
||||||
return Container(
|
return GestureDetector(
|
||||||
height: 40,
|
onTap: () {
|
||||||
width: Get.width,
|
Get.bottomSheet(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
modalDatePicker((value) {
|
||||||
decoration: BoxDecoration(
|
controller.dateOfBirth.value = value;
|
||||||
border: Border.all(color: AppColor.darkGreyLight),
|
}),
|
||||||
borderRadius: BorderRadius.circular(8),
|
isScrollControlled: true,
|
||||||
),
|
isDismissible: true,
|
||||||
child: Row(
|
ignoreSafeArea: false,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
);
|
||||||
children: [
|
},
|
||||||
Text(
|
child: Container(
|
||||||
'تاریخ تولد',
|
height: 40,
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyNormalActive),
|
width: Get.width,
|
||||||
),
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||||
Text('1404/5/5', style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyNormalActive)),
|
decoration: BoxDecoration(
|
||||||
],
|
border: Border.all(color: AppColor.darkGreyLight),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'تاریخ تولد',
|
||||||
|
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyNormalActive),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'1404/5/5',
|
||||||
|
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyNormalActive),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -872,7 +892,7 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
|||||||
return OverlayDropdownWidget(
|
return OverlayDropdownWidget(
|
||||||
items: ['گوسفند ماده', 'گوسفند نر', 'بز ماده', 'بز نر', 'گوساله ماده', 'گوساله نر'],
|
items: ['گوسفند ماده', 'گوسفند نر', 'بز ماده', 'بز نر', 'گوساله ماده', 'گوساله نر'],
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
print('Selected: $value');
|
controller.species.value = value;
|
||||||
},
|
},
|
||||||
itemBuilder: (item) => Text(item),
|
itemBuilder: (item) => Text(item),
|
||||||
labelBuilder: (item) => Text(item ?? 'گونه دام'),
|
labelBuilder: (item) => Text(item ?? 'گونه دام'),
|
||||||
|
|||||||
Reference in New Issue
Block a user