diff --git a/packages/livestock/lib/presentation/page/tagging/logic.dart b/packages/livestock/lib/presentation/page/tagging/logic.dart index f543973..c60d7ff 100644 --- a/packages/livestock/lib/presentation/page/tagging/logic.dart +++ b/packages/livestock/lib/presentation/page/tagging/logic.dart @@ -1,6 +1,8 @@ -import 'package:get/get.dart'; +import 'package:rasadyar_core/core.dart'; class TaggingLogic extends GetxController { + RxInt selectedSegment = 0.obs; + @override void onReady() { // TODO: implement onReady diff --git a/packages/livestock/lib/presentation/page/tagging/view.dart b/packages/livestock/lib/presentation/page/tagging/view.dart index 6bb7f25..19babe1 100644 --- a/packages/livestock/lib/presentation/page/tagging/view.dart +++ b/packages/livestock/lib/presentation/page/tagging/view.dart @@ -37,15 +37,18 @@ class TaggingPage extends GetView { ), SizedBox(width: 4), IconButton( - onPressed: () {}, + onPressed:() { + Get.bottomSheet( + _buildBottomSheet(), + isScrollControlled: true, + ); + }, style: IconButton.styleFrom( backgroundColor: AppColor.blueNormal, fixedSize: Size(40, 40), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - ), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), ), - icon: Assets.vec.editSvg.svg(), + icon: Assets.vec.addSvg.svg(), ), ], ), @@ -54,169 +57,74 @@ class TaggingPage extends GetView { child: Card( clipBehavior: Clip.hardEdge, color: Colors.white, - child: Stack( - fit: StackFit.expand, - children: [ - GridView.builder( - padding: EdgeInsets.symmetric( - horizontal: 20, - vertical: 10, + child: GridView.builder( + padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10), + itemCount: 20, + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 12, + mainAxisSpacing: 8, + ), + itemBuilder: (context, index) { + return Container( + decoration: ShapeDecoration( + color: AppColor.lightGreyLightHover, + shape: RoundedRectangleBorder( + side: BorderSide(width: 1, color: AppColor.blackLightHover), + borderRadius: BorderRadius.circular(8), + ), ), - itemCount: 20, - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 12, - mainAxisSpacing: 8, - ), - itemBuilder: (context, index) { - return Container( - decoration: ShapeDecoration( - color: AppColor.lightGreyLightHover, - shape: RoundedRectangleBorder( - side: BorderSide( - width: 1, - color: AppColor.blackLightHover, - ), - borderRadius: BorderRadius.circular(8), - ), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Assets.vec.editSvg.svg( - width: 16, - height: 16, - colorFilter: ColorFilter.mode( - AppColor.blueNormal, - BlendMode.srcIn, - ), - ), - Assets.vec.trashSvg.svg( - width: 16, - height: 16, - colorFilter: ColorFilter.mode( - AppColor.error, - BlendMode.srcIn, - ), - ), - ], + Assets.vec.editSvg.svg( + width: 16, + height: 16, + colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn), ), - Text( - 'گوسفند ماده', - textAlign: TextAlign.center, - style: AppFonts.yekan14.copyWith( - color: AppColor.blueNormal, - ), - ), - SizedBox(height: 10), - Text( - 'سن : 18 ماه', - textAlign: TextAlign.center, - style: AppFonts.yekan12.copyWith( - color: AppColor.darkGreyNormal, - ), - ), - Text( - 'نوع نژاد', - textAlign: TextAlign.center, - style: AppFonts.yekan14.copyWith( - color: AppColor.bgDark, - ), - ), - Text( - '1212115112512', - textAlign: TextAlign.center, - style: AppFonts.yekan14.copyWith( - color: AppColor.blueNormal, - ), - ), - Text( - 'نوع پلاک', - textAlign: TextAlign.center, - style: AppFonts.yekan14.copyWith( - color: AppColor.bgDark, - ), + Assets.vec.trashSvg.svg( + width: 16, + height: 16, + colorFilter: ColorFilter.mode(AppColor.error, BlendMode.srcIn), ), ], ), - ), - ); - }, - ), - - Positioned( - bottom: 10, - right: 3, - child: RFab.add( - onPressed: () { - Get.bottomSheet( - Container( - padding: EdgeInsets.all(20), - color: Colors.white, - height: 300, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Container( - height: 40, - width: Get.width, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), - border: Border.all( - width: 1, - color: AppColor.darkGreyLight, - ), - ), - child: GestureDetector( - onTap: () { - - }, - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - 'گونه دام', - style: AppFonts.yekan14, - ), - Icon(CupertinoIcons.chevron_up), - ], - ), - ), - ), - /* DropdownMenu( - width: Get.width, - - dropdownMenuEntries: [ - DropdownMenuEntry( - value: 'گوسفند', - label: 'گوسفند', - ), - DropdownMenuEntry( - value: 'بز', - label: 'بز', - ), - DropdownMenuEntry( - value: 'گوساله', - label: 'گوساله', - ), - ], - ),*/ - ], - ), + Text( + 'گوسفند ماده', + textAlign: TextAlign.center, + style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal), ), - isScrollControlled: true, - ); - }, + SizedBox(height: 10), + Text( + 'سن : 18 ماه', + textAlign: TextAlign.center, + style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyNormal), + ), + Text( + 'نوع نژاد', + textAlign: TextAlign.center, + style: AppFonts.yekan14.copyWith(color: AppColor.bgDark), + ), + Text( + '1212115112512', + textAlign: TextAlign.center, + style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal), + ), + Text( + 'نوع پلاک', + textAlign: TextAlign.center, + style: AppFonts.yekan14.copyWith(color: AppColor.bgDark), + ), + ], + ), ), - ), - ], + ); + }, ), ), ), @@ -236,4 +144,223 @@ class TaggingPage extends GetView { ), ); } + + Container _buildBottomSheet() { + return Container( + padding: EdgeInsets.all(20), + + 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( + 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(); + }, + ), + ), + ], + ), + ), + ); + } }