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/live_tmp/livestock_model.dart';
|
||||
|
||||
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_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/live_tmp/livestock_model.dart';
|
||||
|
||||
class LivestockRemoteDataSourceImp implements LivestockRemoteDataSource {
|
||||
@override
|
||||
@@ -26,4 +27,29 @@ class LivestockRemoteDataSourceImp implements LivestockRemoteDataSource {
|
||||
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(
|
||||
username: json['username'] as String?,
|
||||
password: json['password'] as String?,
|
||||
captchaCode: json['captchaCode'] as String?,
|
||||
captchaKey: json['captchaKey'] as String?,
|
||||
captchaCode: json['captcha_code'] as String?,
|
||||
captchaKey: json['captcha_key'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$LoginRequestModelToJson(_LoginRequestModel instance) =>
|
||||
<String, dynamic>{
|
||||
'username': instance.username,
|
||||
'password': instance.password,
|
||||
'captchaCode': instance.captchaCode,
|
||||
'captchaKey': instance.captchaKey,
|
||||
'captcha_code': instance.captchaCode,
|
||||
'captcha_key': instance.captchaKey,
|
||||
};
|
||||
|
||||
@@ -16,7 +16,7 @@ _Address _$AddressFromJson(Map<String, dynamic> json) => _Address(
|
||||
district: json['district'] as String?,
|
||||
county: json['county'] 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?,
|
||||
country: json['country'] as String?,
|
||||
country_code: json['country_code'] as String?,
|
||||
@@ -32,7 +32,7 @@ Map<String, dynamic> _$AddressToJson(_Address instance) => <String, dynamic>{
|
||||
'district': instance.district,
|
||||
'county': instance.county,
|
||||
'province': instance.province,
|
||||
'ISO3166_2_lvl4': instance.ISO3166_2_lvl4,
|
||||
'i_s_o3166_2_lvl4': instance.ISO3166_2_lvl4,
|
||||
'postcode': instance.postcode,
|
||||
'country': instance.country,
|
||||
'country_code': instance.country_code,
|
||||
|
||||
@@ -10,12 +10,12 @@ _AuthResponseModel _$AuthResponseModelFromJson(Map<String, dynamic> json) =>
|
||||
_AuthResponseModel(
|
||||
refresh: json['refresh'] as String?,
|
||||
access: json['access'] as String?,
|
||||
otpStatus: json['otpStatus'] as bool?,
|
||||
otpStatus: json['otp_status'] as bool?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$AuthResponseModelToJson(_AuthResponseModel instance) =>
|
||||
<String, dynamic>{
|
||||
'refresh': instance.refresh,
|
||||
'access': instance.access,
|
||||
'otpStatus': instance.otpStatus,
|
||||
'otp_status': instance.otpStatus,
|
||||
};
|
||||
|
||||
@@ -9,17 +9,17 @@ part of 'captcha_response_model.dart';
|
||||
_CaptchaResponseModel _$CaptchaResponseModelFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _CaptchaResponseModel(
|
||||
captchaKey: json['captchaKey'] as String?,
|
||||
captchaImage: json['captchaImage'] as String?,
|
||||
imageType: json['imageType'] as String?,
|
||||
imageDecode: json['imageDecode'] as String?,
|
||||
captchaKey: json['captcha_key'] as String?,
|
||||
captchaImage: json['captcha_image'] as String?,
|
||||
imageType: json['image_type'] as String?,
|
||||
imageDecode: json['image_decode'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$CaptchaResponseModelToJson(
|
||||
_CaptchaResponseModel instance,
|
||||
) => <String, dynamic>{
|
||||
'captchaKey': instance.captchaKey,
|
||||
'captchaImage': instance.captchaImage,
|
||||
'imageType': instance.imageType,
|
||||
'imageDecode': instance.imageDecode,
|
||||
'captcha_key': instance.captchaKey,
|
||||
'captcha_image': instance.captchaImage,
|
||||
'image_type': instance.imageType,
|
||||
'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(),
|
||||
username: json['username'] as String,
|
||||
password: json['password'] as String,
|
||||
firstName: json['firstName'] as String,
|
||||
lastName: json['lastName'] as String,
|
||||
isActive: json['isActive'] as bool,
|
||||
firstName: json['first_name'] as String,
|
||||
lastName: json['last_name'] as String,
|
||||
isActive: json['is_active'] as bool,
|
||||
mobile: json['mobile'] 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),
|
||||
nationality: json['nationality'] as String,
|
||||
ownership: json['ownership'] as String,
|
||||
@@ -39,21 +39,21 @@ _User _$UserFromJson(Map<String, dynamic> json) => _User(
|
||||
photo: json['photo'] as String,
|
||||
province: (json['province'] as num).toInt(),
|
||||
city: (json['city'] as num).toInt(),
|
||||
otpStatus: json['otpStatus'] as bool,
|
||||
cityName: json['cityName'] as String,
|
||||
provinceName: json['provinceName'] as String,
|
||||
otpStatus: json['otp_status'] as bool,
|
||||
cityName: json['city_name'] as String,
|
||||
provinceName: json['province_name'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$UserToJson(_User instance) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'username': instance.username,
|
||||
'password': instance.password,
|
||||
'firstName': instance.firstName,
|
||||
'lastName': instance.lastName,
|
||||
'isActive': instance.isActive,
|
||||
'first_name': instance.firstName,
|
||||
'last_name': instance.lastName,
|
||||
'is_active': instance.isActive,
|
||||
'mobile': instance.mobile,
|
||||
'phone': instance.phone,
|
||||
'nationalCode': instance.nationalCode,
|
||||
'national_code': instance.nationalCode,
|
||||
'birthdate': instance.birthdate.toIso8601String(),
|
||||
'nationality': instance.nationality,
|
||||
'ownership': instance.ownership,
|
||||
@@ -61,14 +61,14 @@ Map<String, dynamic> _$UserToJson(_User instance) => <String, dynamic>{
|
||||
'photo': instance.photo,
|
||||
'province': instance.province,
|
||||
'city': instance.city,
|
||||
'otpStatus': instance.otpStatus,
|
||||
'cityName': instance.cityName,
|
||||
'provinceName': instance.provinceName,
|
||||
'otp_status': instance.otpStatus,
|
||||
'city_name': instance.cityName,
|
||||
'province_name': instance.provinceName,
|
||||
};
|
||||
|
||||
_Role _$RoleFromJson(Map<String, dynamic> json) => _Role(
|
||||
id: (json['id'] as num).toInt(),
|
||||
roleName: json['roleName'] as String,
|
||||
roleName: json['role_name'] as String,
|
||||
description: json['description'] as String,
|
||||
type: RoleType.fromJson(json['type'] as Map<String, 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>{
|
||||
'id': instance.id,
|
||||
'roleName': instance.roleName,
|
||||
'role_name': instance.roleName,
|
||||
'description': instance.description,
|
||||
'type': instance.type,
|
||||
'permissions': instance.permissions,
|
||||
@@ -91,14 +91,14 @@ Map<String, dynamic> _$RoleTypeToJson(_RoleType instance) => <String, dynamic>{
|
||||
};
|
||||
|
||||
_Permission _$PermissionFromJson(Map<String, dynamic> json) => _Permission(
|
||||
pageName: json['pageName'] as String,
|
||||
pageAccess: (json['pageAccess'] as List<dynamic>)
|
||||
pageName: json['page_name'] as String,
|
||||
pageAccess: (json['page_access'] as List<dynamic>)
|
||||
.map((e) => e as String)
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$PermissionToJson(_Permission instance) =>
|
||||
<String, dynamic>{
|
||||
'pageName': instance.pageName,
|
||||
'pageAccess': instance.pageAccess,
|
||||
'page_name': instance.pageName,
|
||||
'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/auth/auth_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 {
|
||||
Future<LocationDetails?> getLocationDetails({
|
||||
@@ -8,4 +9,6 @@ abstract class LivestockRepository {
|
||||
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/model/response/address/address.dart';
|
||||
import 'package:rasadyar_livestock/data/model/response/live_tmp/livestock_model.dart';
|
||||
|
||||
import 'livestock_repository.dart';
|
||||
|
||||
@@ -9,10 +10,18 @@ class LivestockRepositoryImp implements LivestockRepository {
|
||||
LivestockRepositoryImp({required this.livestockRemote});
|
||||
|
||||
@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(
|
||||
latitude: latitude,
|
||||
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,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
/* if (value == null || value.isEmpty) {
|
||||
return '⚠️ شماره موبایل را وارد کنید';
|
||||
} else if (value.length < 10) {
|
||||
return '⚠️ شماره موبایل باید 11 رقم باشد';
|
||||
}
|
||||
}*/
|
||||
return null;
|
||||
},
|
||||
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,
|
||||
child: RElevated(
|
||||
height: 40.h,
|
||||
onPressed: () {
|
||||
controller.currentIndex.value++;
|
||||
},
|
||||
enabled: data.value,
|
||||
// onPressed: controller.onNext,
|
||||
child: Text('بعدی'),
|
||||
onPressed: controller.onNext,
|
||||
isLoading: controller.isLoading.value,
|
||||
child: Text(controller.currentIndex.value == 2 ? 'ثبت' : 'بعدی'),
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
@@ -186,7 +184,7 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
await controller.pickImage();
|
||||
await controller.pickImage(controller.rancherImage);
|
||||
await showCropDialog();
|
||||
},
|
||||
child: Container(
|
||||
@@ -284,7 +282,8 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
TextSpan(
|
||||
text: controller.addressLocationValue.string ?? 'N/A',
|
||||
text:
|
||||
'${controller.addressLocationValue.value?.latitude} , ${controller.addressLocationValue.value?.longitude}',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
],
|
||||
@@ -337,7 +336,7 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
await controller.pickImage();
|
||||
await controller.pickImage(controller.herdImage);
|
||||
await showCropDialog();
|
||||
},
|
||||
child: Container(
|
||||
@@ -392,24 +391,11 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
||||
_buildSearchWidget(),
|
||||
_buildInfoDetails(),
|
||||
_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(
|
||||
right: 10,
|
||||
bottom: 75,
|
||||
bottom: 5,
|
||||
child: RFab.add(
|
||||
onPressed: () {
|
||||
Get.bottomSheet(_buildBottomSheet(), isScrollControlled: true);
|
||||
@@ -436,26 +422,28 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
||||
|
||||
Expanded _buildListContent() {
|
||||
return Expanded(
|
||||
child: RListView.separated(
|
||||
itemCount: 20,
|
||||
padding: EdgeInsets.symmetric(horizontal: 8.w),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return ObxValue((val) {
|
||||
return ExpandableListItem2(
|
||||
isTag: true,
|
||||
selected: val.contains(index),
|
||||
onTap: () => controller.isExpandedList.toggle(index),
|
||||
index: index,
|
||||
child: itemListWidget(index),
|
||||
secondChild: itemListExpandedWidget(index),
|
||||
labelColor: AppColor.blueLight,
|
||||
labelIcon: Assets.vec.virtualSvg.path,
|
||||
);
|
||||
}, controller.isExpandedList);
|
||||
},
|
||||
resource: Resource.success(List.generate(20, (i) => i)),
|
||||
separatorBuilder: (BuildContext context, int index) => SizedBox(height: 8.h),
|
||||
),
|
||||
child: ObxValue((data) {
|
||||
return RListView.separated(
|
||||
itemCount: data.length,
|
||||
padding: EdgeInsets.symmetric(horizontal: 8.w),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return ObxValue((val) {
|
||||
return ExpandableListItem2(
|
||||
isTag: true,
|
||||
selected: val.contains(index),
|
||||
onTap: () => controller.isExpandedList.toggle(index),
|
||||
index: index,
|
||||
child: itemListWidget(index),
|
||||
secondChild: itemListExpandedWidget(index),
|
||||
labelColor: AppColor.blueLight,
|
||||
labelIcon: Assets.vec.virtualSvg.path,
|
||||
);
|
||||
}, controller.isExpandedList);
|
||||
},
|
||||
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: const EdgeInsets.only(top: 8.0),
|
||||
child: RElevated(
|
||||
text: 'افزودن دام به گله',
|
||||
text: 'افزودن دام به گله',
|
||||
textStyle: AppFonts.yekan18.copyWith(color: Colors.white),
|
||||
width: Get.width,
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
height: 40,
|
||||
onPressed: () {
|
||||
controller.addLiveStock();
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
@@ -712,45 +701,61 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
||||
SizedBox _buildLiveStockImage() {
|
||||
return SizedBox(
|
||||
width: Get.width,
|
||||
height: 350,
|
||||
child: Card(
|
||||
color: Colors.white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: Get.width,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.lightGreyNormal,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Center(child: Assets.images.placeHolder.image(height: 150, width: 200)),
|
||||
height: 356.h,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8.r),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: AppColor.lightGreyNormal, width: 1.w),
|
||||
borderRadius: BorderRadius.circular(8.r),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Row(children: [Text('تصویر دام', style: AppFonts.yekan16Bold)]),
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: Get.width,
|
||||
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,
|
||||
height: 40,
|
||||
height: 40.h,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: ShapeDecoration(
|
||||
color: AppColor.blueNormal,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
padding: EdgeInsets.all(10.r),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
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),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -760,7 +765,7 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
||||
return OverlayDropdownWidget(
|
||||
items: ['نوع پلاک 1', 'نوع پلاک 2', 'نوع پلاک 3'],
|
||||
onChanged: (value) {
|
||||
print('Selected Breed: $value');
|
||||
controller.tagType.value = value;
|
||||
},
|
||||
itemBuilder: (item) => Text(item),
|
||||
labelBuilder: (item) => Text(item ?? 'نوع پلاک'),
|
||||
@@ -769,6 +774,7 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
||||
|
||||
TextFiledFixedHint _buildTagNumber() {
|
||||
return TextFiledFixedHint(
|
||||
controller: controller.herdTagController,
|
||||
inputType: InputType.number,
|
||||
hintText: 'پلاک دام',
|
||||
onChanged: (String value) {
|
||||
@@ -779,21 +785,19 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
||||
|
||||
TextFiledFixedHint _buildFatherTagNumber() {
|
||||
return TextFiledFixedHint(
|
||||
controller: controller.fatherTagNumberController,
|
||||
inputType: InputType.number,
|
||||
hintText: 'پلاک پدر ',
|
||||
onChanged: (String value) {
|
||||
eLog('father Tag: $value');
|
||||
},
|
||||
onChanged: (String value) {},
|
||||
);
|
||||
}
|
||||
|
||||
TextFiledFixedHint _buildMotherTagNumber() {
|
||||
return TextFiledFixedHint(
|
||||
controller: controller.motherTagNumberController,
|
||||
inputType: InputType.number,
|
||||
hintText: 'پلاک مادر ',
|
||||
onChanged: (String value) {
|
||||
eLog('Mother Tag: $value');
|
||||
},
|
||||
onChanged: (value) {},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -801,7 +805,8 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
||||
return OverlayDropdownWidget(
|
||||
items: ['نوع نژاد 1', 'نوع نژاد 2', 'نوع نژاد 3'],
|
||||
onChanged: (value) {
|
||||
print('Selected Breed: $value');
|
||||
controller.breed.value = value;
|
||||
eLog('Selected Breed: $value');
|
||||
},
|
||||
itemBuilder: (item) => Text(item),
|
||||
labelBuilder: (item) => Text(item ?? 'نژاد'),
|
||||
@@ -846,24 +851,39 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
|
||||
);
|
||||
}
|
||||
|
||||
Container _buildLivestockBirthday() {
|
||||
return Container(
|
||||
height: 40,
|
||||
width: Get.width,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
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)),
|
||||
],
|
||||
Widget _buildLivestockBirthday() {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Get.bottomSheet(
|
||||
modalDatePicker((value) {
|
||||
controller.dateOfBirth.value = value;
|
||||
}),
|
||||
isScrollControlled: true,
|
||||
isDismissible: true,
|
||||
ignoreSafeArea: false,
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
height: 40,
|
||||
width: Get.width,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
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(
|
||||
items: ['گوسفند ماده', 'گوسفند نر', 'بز ماده', 'بز نر', 'گوساله ماده', 'گوساله نر'],
|
||||
onChanged: (value) {
|
||||
print('Selected: $value');
|
||||
controller.species.value = value;
|
||||
},
|
||||
itemBuilder: (item) => Text(item),
|
||||
labelBuilder: (item) => Text(item ?? 'گونه دام'),
|
||||
|
||||
Reference in New Issue
Block a user