refactor : extract to widget's
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_core/presentation/widget/buttons/fab.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
@@ -37,11 +36,8 @@ class TaggingPage extends GetView<TaggingLogic> {
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
IconButton(
|
||||
onPressed:() {
|
||||
Get.bottomSheet(
|
||||
_buildBottomSheet(),
|
||||
isScrollControlled: true,
|
||||
);
|
||||
onPressed: () {
|
||||
Get.bottomSheet(_buildBottomSheet(), isScrollControlled: true);
|
||||
},
|
||||
style: IconButton.styleFrom(
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
@@ -145,222 +141,205 @@ class TaggingPage extends GetView<TaggingLogic> {
|
||||
);
|
||||
}
|
||||
|
||||
Container _buildBottomSheet() {
|
||||
Widget _buildBottomSheet() {
|
||||
return BaseBottomSheet(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
spacing: 8,
|
||||
children: [
|
||||
_buildLiveStockSpecies(),
|
||||
_buildLivestockBirthday(),
|
||||
_buildLivestockGender(),
|
||||
|
||||
_buildLivestockBreed(),
|
||||
|
||||
_buildMotherTagNumber(),
|
||||
_buildFatherTagNumber(),
|
||||
_buildTagNumber(),
|
||||
_buildTagType(),
|
||||
|
||||
_buildLiveStockImage(),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: RElevated(
|
||||
text: 'افزودن دام به گله',
|
||||
textStyle: AppFonts.yekan18.copyWith(color: Colors.white),
|
||||
width: Get.width,
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
height: 40,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
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)),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
Container(
|
||||
width: Get.width,
|
||||
height: 40,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: ShapeDecoration(
|
||||
color: AppColor.blueNormal,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('تصویر دام', style: AppFonts.yekan14.copyWith(color: Colors.white)),
|
||||
Icon(CupertinoIcons.arrow_up_doc, color: Colors.white),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
OverlayDropdownWidget<String> _buildTagType() {
|
||||
return OverlayDropdownWidget(
|
||||
items: ['نوع پلاک 1', 'نوع پلاک 2', 'نوع پلاک 3'],
|
||||
onChanged: (value) {
|
||||
print('Selected Breed: $value');
|
||||
},
|
||||
itemBuilder: (item) => Text(item),
|
||||
labelBuilder: (item) => Text(item ?? 'نوع پلاک'),
|
||||
);
|
||||
}
|
||||
|
||||
TextFiledFixedHint _buildTagNumber() {
|
||||
return TextFiledFixedHint(
|
||||
inputType: InputType.number,
|
||||
hintText: 'پلاک دام',
|
||||
onChanged: (String value) {
|
||||
eLog('father Tag: $value');
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
TextFiledFixedHint _buildFatherTagNumber() {
|
||||
return TextFiledFixedHint(
|
||||
inputType: InputType.number,
|
||||
hintText: 'پلاک پدر ',
|
||||
onChanged: (String value) {
|
||||
eLog('father Tag: $value');
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
TextFiledFixedHint _buildMotherTagNumber() {
|
||||
return TextFiledFixedHint(
|
||||
inputType: InputType.number,
|
||||
hintText: 'پلاک مادر ',
|
||||
onChanged: (String value) {
|
||||
eLog('Mother Tag: $value');
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
OverlayDropdownWidget<String> _buildLivestockBreed() {
|
||||
return OverlayDropdownWidget(
|
||||
items: ['نوع نژاد 1', 'نوع نژاد 2', 'نوع نژاد 3'],
|
||||
onChanged: (value) {
|
||||
print('Selected Breed: $value');
|
||||
},
|
||||
itemBuilder: (item) => Text(item),
|
||||
labelBuilder: (item) => Text(item ?? 'نژاد'),
|
||||
);
|
||||
}
|
||||
|
||||
ObxValue<RxInt> _buildLivestockGender() {
|
||||
return ObxValue(
|
||||
(data) => CupertinoSlidingSegmentedControl<int>(
|
||||
children: {
|
||||
0: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: Text(
|
||||
'نر',
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: data.value == 0 ? AppColor.whiteGreyLight : AppColor.darkGreyNormalActive,
|
||||
),
|
||||
),
|
||||
),
|
||||
1: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Text(
|
||||
'ماده',
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: data.value == 1 ? AppColor.whiteGreyLight : AppColor.darkGreyNormalActive,
|
||||
),
|
||||
),
|
||||
),
|
||||
},
|
||||
onValueChanged: (int? value) {
|
||||
if (value != null) {
|
||||
controller.selectedSegment.value = value;
|
||||
}
|
||||
},
|
||||
|
||||
proportionalWidth: true,
|
||||
groupValue: data.value,
|
||||
thumbColor: AppColor.blueNormal,
|
||||
backgroundColor: CupertinoColors.systemGrey6,
|
||||
),
|
||||
controller.selectedSegment,
|
||||
);
|
||||
}
|
||||
|
||||
Container _buildLivestockBirthday() {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(20),
|
||||
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)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(25),
|
||||
topRight: Radius.circular(25),
|
||||
),
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
spacing: 8,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
height: 3,
|
||||
width: 50,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.darkGreyDark,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
SizedBox(height: 3),
|
||||
|
||||
OverlayDropdownWidget(
|
||||
items: [
|
||||
'گوسفند ماده',
|
||||
'گوسفند نر',
|
||||
'بز ماده',
|
||||
'بز نر',
|
||||
'گوساله ماده',
|
||||
'گوساله نر',
|
||||
],
|
||||
onChanged: (value) {
|
||||
print('Selected: $value');
|
||||
},
|
||||
itemBuilder: (item) => Text(item),
|
||||
labelBuilder: (item) => Text(item ?? 'گونه دام'),
|
||||
),
|
||||
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),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
ObxValue((data) {
|
||||
return CupertinoSlidingSegmentedControl<int>(
|
||||
children: {
|
||||
0: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: Text(
|
||||
'نر',
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color:
|
||||
data.value == 0
|
||||
? AppColor.whiteGreyLight
|
||||
: AppColor.darkGreyNormalActive,
|
||||
),
|
||||
),
|
||||
),
|
||||
1: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Text(
|
||||
'ماده',
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color:
|
||||
data.value == 1
|
||||
? AppColor.whiteGreyLight
|
||||
: AppColor.darkGreyNormalActive,
|
||||
),
|
||||
),
|
||||
),
|
||||
},
|
||||
onValueChanged: (int? value) {
|
||||
if (value != null) {
|
||||
controller.selectedSegment.value = value;
|
||||
}
|
||||
},
|
||||
|
||||
proportionalWidth: true,
|
||||
groupValue: data.value,
|
||||
thumbColor: AppColor.blueNormal,
|
||||
backgroundColor: CupertinoColors.systemGrey6,
|
||||
);
|
||||
}, controller.selectedSegment),
|
||||
|
||||
OverlayDropdownWidget(
|
||||
items: ['نوع نژاد 1', 'نوع نژاد 2', 'نوع نژاد 3'],
|
||||
onChanged: (value) {
|
||||
print('Selected Breed: $value');
|
||||
},
|
||||
itemBuilder: (item) => Text(item),
|
||||
labelBuilder: (item) => Text(item ?? 'نژاد'),
|
||||
),
|
||||
|
||||
TextFiledFixedHint(
|
||||
inputType: InputType.number,
|
||||
hintText: 'پلاک مادر ',
|
||||
onChanged: (String value) {
|
||||
eLog('Mother Tag: $value');
|
||||
},
|
||||
),
|
||||
TextFiledFixedHint(
|
||||
inputType: InputType.number,
|
||||
hintText: 'پلاک پدر ',
|
||||
onChanged: (String value) {
|
||||
eLog('father Tag: $value');
|
||||
},
|
||||
),
|
||||
TextFiledFixedHint(
|
||||
inputType: InputType.number,
|
||||
hintText: 'پلاک دام',
|
||||
onChanged: (String value) {
|
||||
eLog('father Tag: $value');
|
||||
},
|
||||
),
|
||||
OverlayDropdownWidget(
|
||||
items: ['نوع پلاک 1', 'نوع پلاک 2', 'نوع پلاک 3'],
|
||||
onChanged: (value) {
|
||||
print('Selected Breed: $value');
|
||||
},
|
||||
itemBuilder: (item) => Text(item),
|
||||
labelBuilder: (item) => Text(item ?? 'نوع پلاک'),
|
||||
),
|
||||
|
||||
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),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
Container(
|
||||
width: Get.width,
|
||||
height: 40,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: ShapeDecoration(
|
||||
color: AppColor.blueNormal,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'تصویر دام',
|
||||
style: AppFonts.yekan14.copyWith(color: Colors.white),
|
||||
),
|
||||
Icon(CupertinoIcons.arrow_up_doc, color: Colors.white),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: RElevated(
|
||||
text: 'افزودن دام به گله',
|
||||
textStyle: AppFonts.yekan18.copyWith(color: Colors.white),
|
||||
width: Get.width,
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
height: 40,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
OverlayDropdownWidget<String> _buildLiveStockSpecies() {
|
||||
return OverlayDropdownWidget(
|
||||
items: ['گوسفند ماده', 'گوسفند نر', 'بز ماده', 'بز نر', 'گوساله ماده', 'گوساله نر'],
|
||||
onChanged: (value) {
|
||||
print('Selected: $value');
|
||||
},
|
||||
itemBuilder: (item) => Text(item),
|
||||
labelBuilder: (item) => Text(item ?? 'گونه دام'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user