feat : list view item in out of the province
This commit is contained in:
@@ -5,9 +5,9 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/steward_free_bar/steward_free_bar.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/list_row_item.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
@@ -28,15 +28,247 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
|
||||
return RPaginatedListView(
|
||||
listType: ListType.separated,
|
||||
resource: data.value,
|
||||
padding: EdgeInsets.fromLTRB(8, 8, 18, 80),
|
||||
itemBuilder: (context, index) => ListItem(
|
||||
expandList: controller.isExpandedList,
|
||||
index: index,
|
||||
child: Container(height: 40, color: Colors.red),
|
||||
secondChild: Container(height: 80, color: Colors.blue),
|
||||
labelColor: AppColor.lightGreyNormalHover,
|
||||
labelIcon: Assets.vec.truckFastSvg.path,
|
||||
),
|
||||
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
|
||||
itemBuilder: (context, index) {
|
||||
var item = data.value.data![index];
|
||||
return ObxValue((val) {
|
||||
return ListItem2(
|
||||
selected: val.contains(index),
|
||||
onTap: () => controller.isExpandedList.toggle(index),
|
||||
|
||||
index: index,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
SizedBox(width: 20),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 3,
|
||||
children: [
|
||||
Text(
|
||||
item.killHouseName ?? 'N/A',
|
||||
textAlign: TextAlign.start,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
Text(
|
||||
item.date?.formattedJalaliDate ?? 'N/A',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
spacing: 3,
|
||||
children: [
|
||||
Visibility(
|
||||
visible: item.product?.name?.contains('مرغ گرم') ?? false,
|
||||
child: Assets.vec.hotChickenSvg.svg(
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: ColorFilter.mode(
|
||||
AppColor.blueNormal,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'${item.weightOfCarcasses?.separatedByComma}kg',
|
||||
textAlign: TextAlign.left,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
SizedBox(height: 2),
|
||||
|
||||
Text(
|
||||
'${item.province}',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Assets.vec.scanSvg.svg(
|
||||
width: 32.w,
|
||||
height: 32.h,
|
||||
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
secondChild: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'${item.province}-${item.city}',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
height: 32,
|
||||
padding: EdgeInsets.symmetric(horizontal: 4),
|
||||
decoration: ShapeDecoration(
|
||||
color: AppColor.blueLight,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(width: 1, color: AppColor.blueLightHover),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
spacing: 3,
|
||||
children: [
|
||||
Text(
|
||||
item.date?.toJalali.formatter.wN ?? 'N/A',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
|
||||
Text(
|
||||
'${item.date?.toJalali.formatter.d} ${item.date?.toJalali.formatter.mN ?? 'N/A'}',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Text(
|
||||
'${item.date?.toJalali.formatter.y}',
|
||||
style: AppFonts.yekan20.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
|
||||
Text(
|
||||
'${item.date?.toJalali.formatter.tHH}:${item.date?.toJalali.formatter.tMM ?? 'N/A'}',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
buildRow(title: 'مشخصات فروشنده', value: item.killHouseName ?? 'N/A'),
|
||||
|
||||
buildRow(
|
||||
title: 'تلفن فروشنده',
|
||||
value: item.killHouseMobile ?? 'N/A',
|
||||
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
buildRow(title: 'محصول', value: item.product?.name ?? 'N/A'),
|
||||
buildRow(
|
||||
title: 'وزن خریداری شده',
|
||||
value: '${item.weightOfCarcasses?.separatedByComma} کیلوگرم',
|
||||
),
|
||||
buildRowOnTapped(
|
||||
title: 'مشاهده بارنامه',
|
||||
titleStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||
valueWidget: Assets.vec.clipboardEyeSvg.svg(
|
||||
width: 20,
|
||||
height: 24,
|
||||
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
||||
),
|
||||
onTap: () {
|
||||
Get.bottomSheet(
|
||||
BaseBottomSheet(
|
||||
height: 400,
|
||||
child: Column(
|
||||
spacing: 16,
|
||||
children: [
|
||||
Text(
|
||||
'بارنامه',
|
||||
style: AppFonts.yekan16Bold.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
|
||||
Image.network(
|
||||
item.barImage ?? '',
|
||||
fit: BoxFit.cover,
|
||||
height: 300,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
eLog(error.toString());
|
||||
return Center(child: Text('خطایی پیش آمده!'));
|
||||
},
|
||||
loadingBuilder: (context, child, loadingProgress) {
|
||||
if (loadingProgress == null) return child;
|
||||
print('Loading progress: $loadingProgress');
|
||||
return CupertinoActivityIndicator();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 16.w,
|
||||
children: [
|
||||
RElevated(
|
||||
text: 'ویرایش',
|
||||
width: 150.w,
|
||||
height: 40.h,
|
||||
onPressed: () {
|
||||
controller.setEditData(item);
|
||||
Get.bottomSheet(
|
||||
addPurchasedInformationBottomSheet(true),
|
||||
isScrollControlled: true,
|
||||
).whenComplete(() {
|
||||
controller.resetSubmitForm();
|
||||
});
|
||||
},
|
||||
textStyle: AppFonts.yekan20.copyWith(color: Colors.white),
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
),
|
||||
ROutlinedElevated(
|
||||
text: 'حذف',
|
||||
textStyle: AppFonts.yekan20.copyWith(color: AppColor.redNormal),
|
||||
width: 150.w,
|
||||
height: 40.h,
|
||||
onPressed: () {
|
||||
buildDeleteDialog(
|
||||
onConfirm: () =>
|
||||
controller.deleteStewardPurchaseOutOfProvince(item.key!),
|
||||
);
|
||||
},
|
||||
borderColor: AppColor.redNormal,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
labelColor: AppColor.blueLight,
|
||||
labelIcon: Assets.vec.truckFastOutlinedSvg.path,
|
||||
);
|
||||
}, controller.isExpandedList);
|
||||
},
|
||||
itemCount: data.value.data?.length ?? 0,
|
||||
separatorBuilder: (context, index) => SizedBox(height: 8.h),
|
||||
onLoadMore: () async {},
|
||||
@@ -53,325 +285,6 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget saleListWidget() {
|
||||
return ObxValue((data) {
|
||||
switch (data.value.status) {
|
||||
case Status.initial:
|
||||
case Status.loading:
|
||||
return Center(child: CupertinoActivityIndicator());
|
||||
case Status.success:
|
||||
return ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: BouncingScrollPhysics(),
|
||||
padding: EdgeInsets.fromLTRB(8, 8, 18, 80),
|
||||
itemBuilder: (context, index) {
|
||||
return ObxValue(
|
||||
(expandList) => saleListItem(
|
||||
expandList: expandList,
|
||||
index: index,
|
||||
item: data.value.data![index],
|
||||
),
|
||||
controller.isExpandedList,
|
||||
);
|
||||
},
|
||||
separatorBuilder: (context, index) => SizedBox(height: 8),
|
||||
itemCount: data.value.data?.length ?? 0,
|
||||
);
|
||||
case Status.error:
|
||||
return Center(
|
||||
child: Text(
|
||||
data.value.message ?? 'خطا در دریافت اطلاعات',
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.error),
|
||||
),
|
||||
);
|
||||
case Status.empty:
|
||||
return emptyWidget();
|
||||
}
|
||||
}, controller.purchaseOutOfProvinceList);
|
||||
}
|
||||
|
||||
Widget emptyWidget() {
|
||||
return Center(
|
||||
child: Text(
|
||||
'داده ای دریافت نشد!',
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDarkHover),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
GestureDetector saleListItem({
|
||||
required RxList<int> expandList,
|
||||
required int index,
|
||||
required StewardFreeBar item,
|
||||
}) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
if (expandList.contains(index)) {
|
||||
controller.isExpandedList.remove(index);
|
||||
} else {
|
||||
controller.isExpandedList.add(index);
|
||||
}
|
||||
},
|
||||
child: AnimatedSize(
|
||||
duration: Duration(milliseconds: 400),
|
||||
alignment: Alignment.center,
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
alignment: Alignment.centerRight,
|
||||
children: [
|
||||
AnimatedSize(
|
||||
duration: Duration(milliseconds: 300),
|
||||
child: Container(
|
||||
width: Get.width - 30,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 0.5, color: AppColor.darkGreyNormal),
|
||||
),
|
||||
child: AnimatedCrossFade(
|
||||
alignment: Alignment.center,
|
||||
firstChild: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
item.date?.formattedJalaliDate ?? 'N/A',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text(
|
||||
item.killHouseName ?? 'N/A',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'${item.weightOfCarcasses?.separatedByComma}kg',
|
||||
textAlign: TextAlign.left,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
|
||||
SizedBox(height: 2),
|
||||
Visibility(
|
||||
visible: item.product?.name?.contains('مرغ گرم') ?? false,
|
||||
child: Assets.vec.hotChickenSvg.svg(
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: ColorFilter.mode(
|
||||
AppColor.blueNormal,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
'${item.province}\n${item.city}',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
),
|
||||
Icon(CupertinoIcons.chevron_down, size: 12),
|
||||
SizedBox(width: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
secondChild: Container(
|
||||
padding: EdgeInsets.fromLTRB(8, 12, 14, 12),
|
||||
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
controller.setEditData(item);
|
||||
Get.bottomSheet(
|
||||
addPurchasedInformationBottomSheet(true),
|
||||
isScrollControlled: true,
|
||||
).whenComplete(() {
|
||||
controller.resetSubmitForm();
|
||||
});
|
||||
},
|
||||
child: Assets.vec.editSvg.svg(
|
||||
width: 20,
|
||||
height: 20,
|
||||
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
||||
),
|
||||
),
|
||||
|
||||
Text(
|
||||
'${item.province}-${item.city}',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
|
||||
),
|
||||
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
buildDeleteDialog(
|
||||
onConfirm: () =>
|
||||
controller.deleteStewardPurchaseOutOfProvince(item.key!),
|
||||
);
|
||||
},
|
||||
child: Assets.vec.trashSvg.svg(
|
||||
width: 20,
|
||||
height: 20,
|
||||
colorFilter: ColorFilter.mode(AppColor.error, BlendMode.srcIn),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
height: 32,
|
||||
padding: EdgeInsets.symmetric(horizontal: 4),
|
||||
decoration: ShapeDecoration(
|
||||
color: AppColor.blueLight,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(width: 1, color: AppColor.blueLightHover),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: buildRow('تاریخ', item.date?.formattedJalaliDateYHMS ?? 'N/A'),
|
||||
),
|
||||
|
||||
buildRow(
|
||||
'مشخصات فروشنده',
|
||||
'${item.killHouseName} - ${item.killHouseMobile ?? 'N/A'}',
|
||||
),
|
||||
buildRow('محصول', item.product?.name ?? 'N/A'),
|
||||
buildRow(
|
||||
'وزن خریداری شده',
|
||||
'${item.weightOfCarcasses?.separatedByComma} کیلوگرم',
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.bottomSheet(
|
||||
BaseBottomSheet(
|
||||
height: 400,
|
||||
child: Column(
|
||||
spacing: 16,
|
||||
children: [
|
||||
Text(
|
||||
'بارنامه',
|
||||
style: AppFonts.yekan16Bold.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
|
||||
Image.network(
|
||||
item.barImage ?? '',
|
||||
fit: BoxFit.cover,
|
||||
height: 300,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
eLog(error.toString());
|
||||
return Center(child: Text('خطایی پیش آمده!'));
|
||||
},
|
||||
loadingBuilder: (context, child, loadingProgress) {
|
||||
if (loadingProgress == null) return child;
|
||||
print('Loading progress: $loadingProgress');
|
||||
return CupertinoActivityIndicator();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
'مشاهده بارنامه',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
),
|
||||
Icon(CupertinoIcons.chevron_up, size: 12),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
crossFadeState: expandList.contains(index)
|
||||
? CrossFadeState.showSecond
|
||||
: CrossFadeState.showFirst,
|
||||
duration: Duration(milliseconds: 300),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
right: -12,
|
||||
child: Container(
|
||||
width: index < 999 ? 24 : null,
|
||||
height: index < 999 ? 24 : null,
|
||||
padding: EdgeInsets.all(2),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.greenLightHover,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
border: Border.all(width: 0.50, color: AppColor.greenDarkActive),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
(index + 1).toString(),
|
||||
style: AppFonts.yekan12.copyWith(color: Colors.black),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildRow(String title, String value) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
title,
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
value,
|
||||
textAlign: TextAlign.left,
|
||||
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget addPurchasedInformationBottomSheet([bool isOnEdit = false]) {
|
||||
return BaseBottomSheet(
|
||||
child: SingleChildScrollView(
|
||||
@@ -389,6 +302,8 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
|
||||
controller: controller.sellerNameController,
|
||||
label: 'نام فروشنده',
|
||||
borderColor: AppColor.darkGreyLight,
|
||||
filled: true,
|
||||
filledColor: AppColor.bgLight,
|
||||
),
|
||||
RTextField(
|
||||
controller: controller.sellerPhoneController,
|
||||
@@ -396,6 +311,8 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
|
||||
keyboardType: TextInputType.phone,
|
||||
borderColor: AppColor.darkGreyLight,
|
||||
maxLength: 11,
|
||||
filled: true,
|
||||
filledColor: AppColor.bgLight,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'لطفاً شماره موبایل را وارد کنید';
|
||||
@@ -415,7 +332,13 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
|
||||
_cityWidget(),
|
||||
RTextField(
|
||||
controller: controller.carcassWeightController,
|
||||
label: 'وزن لاشه',
|
||||
label: 'وزن',
|
||||
filled: true,
|
||||
suffixIcon: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Assets.vec.killogramSvg.svg(),
|
||||
),
|
||||
filledColor: AppColor.bgLight,
|
||||
keyboardType: TextInputType.number,
|
||||
borderColor: AppColor.darkGreyLight,
|
||||
inputFormatters: [
|
||||
@@ -437,6 +360,8 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
|
||||
return ObxValue((data) {
|
||||
return RElevated(
|
||||
text: isOnEdit ? 'ویرایش' : 'ثبت خرید',
|
||||
width: Get.width,
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
onPressed: data.value
|
||||
? () async {
|
||||
var res = await controller.createStewardPurchaseOutOfProvince();
|
||||
@@ -459,8 +384,16 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
|
||||
},
|
||||
selectedItem: controller.selectedProduct.value,
|
||||
initialValue: controller.selectedProduct.value,
|
||||
itemBuilder: (item) => Text(item.name ?? 'بدون نام'),
|
||||
labelBuilder: (item) => Text(item?.name ?? 'انتخاب محصول'),
|
||||
itemBuilder: (item) => Text(
|
||||
item.name ?? 'بدون نام',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.lightGreyDarker),
|
||||
),
|
||||
labelBuilder: (item) => item?.name != null
|
||||
? Text(item!.name!, style: AppFonts.yekan14.copyWith(color: AppColor.textColor))
|
||||
: Text(
|
||||
'انتخاب محصول',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColorLight),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -474,8 +407,16 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
|
||||
print('Selected Product: ${value.name}');
|
||||
},
|
||||
selectedItem: controller.selectedProvince.value,
|
||||
itemBuilder: (item) => Text(item.name ?? 'بدون نام'),
|
||||
labelBuilder: (item) => Text(item?.name ?? 'انتخاب استان'),
|
||||
itemBuilder: (item) => Text(
|
||||
item.name ?? 'بدون نام',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.lightGreyDarker),
|
||||
),
|
||||
labelBuilder: (item) => item?.name != null
|
||||
? Text(item!.name!, style: AppFonts.yekan14.copyWith(color: AppColor.textColor))
|
||||
: Text(
|
||||
'انتخاب استان',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColorLight),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -486,11 +427,15 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
|
||||
items: data,
|
||||
onChanged: (value) {
|
||||
controller.selectedCity.value = value;
|
||||
print('Selected Product: ${value.name}');
|
||||
},
|
||||
selectedItem: controller.selectedCity.value,
|
||||
itemBuilder: (item) => Text(item.name ?? 'بدون نام'),
|
||||
labelBuilder: (item) => Text(item?.name ?? 'انتخاب شهر'),
|
||||
itemBuilder: (item) => Text(
|
||||
item.name ?? 'بدون نام',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.lightGreyDarker),
|
||||
),
|
||||
labelBuilder: (item) => item?.name != null
|
||||
? Text(item!.name!, style: AppFonts.yekan14.copyWith(color: AppColor.textColor))
|
||||
: Text('انتخاب شهر', style: AppFonts.yekan14.copyWith(color: AppColor.textColorLight)),
|
||||
);
|
||||
}, controller.cites);
|
||||
}
|
||||
@@ -498,96 +443,73 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
|
||||
SizedBox _imageCarcasesWidget(bool isOnEdit) {
|
||||
return SizedBox(
|
||||
width: Get.width,
|
||||
height: 250,
|
||||
height: 370,
|
||||
child: Card(
|
||||
color: Colors.white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: Column(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Text('بارنامه', style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal)),
|
||||
Expanded(
|
||||
child: ObxValue((data) {
|
||||
return Container(
|
||||
width: Get.width,
|
||||
height: 270,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.lightGreyNormal,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 1, color: AppColor.blackLight),
|
||||
),
|
||||
child: Center(
|
||||
child: isOnEdit
|
||||
? Image.network(controller.editImageUrl.value ?? '')
|
||||
: data.value == null
|
||||
? Assets.images.placeHolder.image(height: 150, width: 200)
|
||||
? Padding(
|
||||
padding: const EdgeInsets.fromLTRB(30, 10, 10, 30),
|
||||
child: Assets.vec.placeHolderSvg.svg(width: 200.w, height: 150.h),
|
||||
)
|
||||
: Image.file(File(data.value!.path), fit: BoxFit.cover),
|
||||
),
|
||||
);
|
||||
}, controller.selectedImage),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
Container(
|
||||
width: Get.width,
|
||||
height: 40,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'تصویر بار',
|
||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
controller.selectedImage.value = await controller.imagePicker.pickImage(
|
||||
source: ImageSource.camera,
|
||||
imageQuality: 60,
|
||||
maxWidth: 1080,
|
||||
maxHeight: 720,
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
decoration: ShapeDecoration(
|
||||
color: AppColor.blueNormal,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
),
|
||||
padding: EdgeInsetsGeometry.symmetric(horizontal: 6, vertical: 4),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text('دوربین', style: AppFonts.yekan14.copyWith(color: Colors.white)),
|
||||
SizedBox(width: 8),
|
||||
Icon(CupertinoIcons.camera, color: Colors.white),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
controller.selectedImage.value = await controller.imagePicker.pickImage(
|
||||
source: ImageSource.gallery,
|
||||
imageQuality: 60,
|
||||
maxWidth: 1080,
|
||||
maxHeight: 720,
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
decoration: ShapeDecoration(
|
||||
color: AppColor.blueNormal,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
),
|
||||
padding: EdgeInsetsGeometry.symmetric(horizontal: 6, vertical: 4),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text('گالری', style: AppFonts.yekan14.copyWith(color: Colors.white)),
|
||||
SizedBox(width: 8),
|
||||
Icon(CupertinoIcons.photo, color: Colors.white),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
RElevated(
|
||||
text: 'گالری',
|
||||
width: 150.w,
|
||||
height: 40.h,
|
||||
textStyle: AppFonts.yekan20.copyWith(color: Colors.white),
|
||||
onPressed: () async {
|
||||
controller.selectedImage.value = await controller.imagePicker.pickImage(
|
||||
source: ImageSource.gallery,
|
||||
imageQuality: 60,
|
||||
maxWidth: 1080,
|
||||
maxHeight: 720,
|
||||
);
|
||||
},
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
ROutlinedElevated(
|
||||
text: 'دوربین',
|
||||
width: 150.w,
|
||||
height: 40.h,
|
||||
textStyle: AppFonts.yekan20.copyWith(color: AppColor.blueNormal),
|
||||
onPressed: () async {
|
||||
controller.selectedImage.value = await controller.imagePicker.pickImage(
|
||||
source: ImageSource.camera,
|
||||
imageQuality: 60,
|
||||
maxWidth: 1080,
|
||||
maxHeight: 720,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -4,33 +4,29 @@ import 'package:rasadyar_core/core.dart';
|
||||
class ListItem extends StatelessWidget {
|
||||
const ListItem({
|
||||
super.key,
|
||||
required this.expandList,
|
||||
required this.index,
|
||||
required this.child,
|
||||
required this.secondChild,
|
||||
required this.labelColor,
|
||||
required this.labelIcon,
|
||||
required this.onTap,
|
||||
required this.selected,
|
||||
this.labelIconColor = AppColor.mediumGreyDarkHover,
|
||||
});
|
||||
|
||||
final RxList<int> expandList;
|
||||
final int index;
|
||||
final Widget child;
|
||||
final Widget secondChild;
|
||||
final Color labelColor;
|
||||
final String labelIcon;
|
||||
final Color? labelIconColor;
|
||||
final VoidCallback onTap;
|
||||
final bool selected;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
/*if (expandList.contains(index)) {
|
||||
controller.isExpandedList.remove(index);
|
||||
} else {
|
||||
controller.isExpandedList.add(index);
|
||||
}*/
|
||||
},
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
width: Get.width,
|
||||
margin: const EdgeInsets.fromLTRB(0, 0, 10, 0),
|
||||
@@ -83,7 +79,7 @@ class ListItem extends StatelessWidget {
|
||||
),
|
||||
child: secondChild,
|
||||
),
|
||||
crossFadeState: expandList.contains(index)
|
||||
crossFadeState: selected
|
||||
? CrossFadeState.showSecond
|
||||
: CrossFadeState.showFirst,
|
||||
duration: Duration(milliseconds: 300),
|
||||
@@ -129,3 +125,115 @@ class ListItem extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ListItem2 extends StatelessWidget {
|
||||
const ListItem2({
|
||||
super.key,
|
||||
required this.index,
|
||||
required this.child,
|
||||
required this.secondChild,
|
||||
required this.labelColor,
|
||||
required this.labelIcon,
|
||||
required this.onTap,
|
||||
required this.selected,
|
||||
this.labelIconColor = AppColor.mediumGreyDarkHover,
|
||||
});
|
||||
|
||||
final int index;
|
||||
final Widget child;
|
||||
final Widget secondChild;
|
||||
final Color labelColor;
|
||||
final String labelIcon;
|
||||
final Color? labelIconColor;
|
||||
final VoidCallback onTap;
|
||||
final bool selected;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
width: Get.width,
|
||||
margin: const EdgeInsets.fromLTRB(0, 0, 10, 0),
|
||||
decoration: BoxDecoration(
|
||||
color: labelColor,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 1, color: AppColor.lightGreyNormalHover),
|
||||
),
|
||||
child: AnimatedSize(
|
||||
duration: Duration(milliseconds: 400),
|
||||
alignment: Alignment.center,
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
alignment: Alignment.centerRight,
|
||||
children: [
|
||||
AnimatedCrossFade(
|
||||
firstChild: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
height: 75,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.zero,
|
||||
bottomRight: Radius.circular(8),
|
||||
topLeft: Radius.zero,
|
||||
topRight: Radius.circular(8),
|
||||
),
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 20,
|
||||
child: Center(
|
||||
child: SvgGenImage.vec(labelIcon).svg(
|
||||
width: 16.w,
|
||||
height: 16.h,
|
||||
//TODO
|
||||
colorFilter: ColorFilter.mode(labelIconColor ?? AppColor.mediumGreyDarkActive, BlendMode.srcIn),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
secondChild: Container(
|
||||
padding: EdgeInsets.fromLTRB(8, 8, 12, 12),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: secondChild,
|
||||
),
|
||||
crossFadeState: selected ? CrossFadeState.showSecond : CrossFadeState.showFirst,
|
||||
duration: Duration(milliseconds: 300),
|
||||
),
|
||||
|
||||
Positioned(
|
||||
right: -12,
|
||||
child: Container(
|
||||
width: index < 999 ? 24 : null,
|
||||
height: index < 999 ? 24 : null,
|
||||
padding: EdgeInsets.all(2),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.greenLightHover,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
border: Border.all(width: 0.50, color: AppColor.greenDarkActive),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
(index + 1).toString(),
|
||||
style: AppFonts.yekan12.copyWith(color: Colors.black),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
76
packages/chicken/lib/presentation/widget/list_row_item.dart
Normal file
76
packages/chicken/lib/presentation/widget/list_row_item.dart
Normal file
@@ -0,0 +1,76 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
Widget buildRow({
|
||||
required String title,
|
||||
required String value,
|
||||
TextStyle? titleStyle,
|
||||
TextStyle? valueStyle,
|
||||
}) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
title,
|
||||
textAlign: TextAlign.right,
|
||||
style: titleStyle ?? AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
value,
|
||||
textAlign: TextAlign.left,
|
||||
style: valueStyle ?? AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildRowOnTapped({
|
||||
String? title,
|
||||
String? value,
|
||||
Widget? titleWidget,
|
||||
Widget? valueWidget,
|
||||
TextStyle? titleStyle,
|
||||
TextStyle? valueStyle,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 2,
|
||||
child:
|
||||
titleWidget ??
|
||||
Text(
|
||||
title ?? 'N/A',
|
||||
textAlign: TextAlign.right,
|
||||
style: titleStyle ?? AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Flexible(
|
||||
flex: 2,
|
||||
child:
|
||||
valueWidget ??
|
||||
Text(
|
||||
value ?? 'N/A',
|
||||
textAlign: TextAlign.left,
|
||||
style: valueStyle ?? AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -361,8 +361,10 @@ class AppColor {
|
||||
|
||||
|
||||
static const Color bgLight = Color(0xFFF5F5F5); // #083940 rgb(8, 57, 64)
|
||||
static const Color bgIcon = Color(0xFF797979); // #797979
|
||||
static const Color bgDark = Color(0xFF979797); // #083940 rgb(8, 57, 64)
|
||||
static const Color textColor = Color(0xFF5B5B5B); // #083940 rgb(8, 57, 64)
|
||||
static const Color textColorLight = Color(0xFFB2B2B2);
|
||||
|
||||
//endregion
|
||||
|
||||
|
||||
@@ -16,11 +16,14 @@ import 'package:vector_graphics/vector_graphics.dart' as _vg;
|
||||
class $AssetsAnimGen {
|
||||
const $AssetsAnimGen();
|
||||
|
||||
/// File path: assets/anim/error.json
|
||||
LottieGenImage get error => const LottieGenImage('assets/anim/error.json');
|
||||
|
||||
/// File path: assets/anim/loading.json
|
||||
LottieGenImage get loading => const LottieGenImage('assets/anim/loading.json');
|
||||
|
||||
/// List of all assets
|
||||
List<LottieGenImage> get values => [loading];
|
||||
List<LottieGenImage> get values => [error, loading];
|
||||
}
|
||||
|
||||
class $AssetsIconsGen {
|
||||
@@ -62,6 +65,12 @@ class $AssetsIconsGen {
|
||||
/// File path: assets/icons/chicken.svg
|
||||
SvgGenImage get chicken => const SvgGenImage('assets/icons/chicken.svg');
|
||||
|
||||
/// File path: assets/icons/clipboard_eye.svg
|
||||
SvgGenImage get clipboardEye => const SvgGenImage('assets/icons/clipboard_eye.svg');
|
||||
|
||||
/// File path: assets/icons/clipboard_task.svg
|
||||
SvgGenImage get clipboardTask => const SvgGenImage('assets/icons/clipboard_task.svg');
|
||||
|
||||
/// File path: assets/icons/close_square.svg
|
||||
SvgGenImage get closeSquare => const SvgGenImage('assets/icons/close_square.svg');
|
||||
|
||||
@@ -128,6 +137,9 @@ class $AssetsIconsGen {
|
||||
/// File path: assets/icons/key.svg
|
||||
SvgGenImage get key => const SvgGenImage('assets/icons/key.svg');
|
||||
|
||||
/// File path: assets/icons/killogram.svg
|
||||
SvgGenImage get killogram => const SvgGenImage('assets/icons/killogram.svg');
|
||||
|
||||
/// File path: assets/icons/liveStock.svg
|
||||
SvgGenImage get liveStock => const SvgGenImage('assets/icons/liveStock.svg');
|
||||
|
||||
@@ -238,6 +250,8 @@ class $AssetsIconsGen {
|
||||
check,
|
||||
checkSquare,
|
||||
chicken,
|
||||
clipboardEye,
|
||||
clipboardTask,
|
||||
closeSquare,
|
||||
convertCube,
|
||||
cube,
|
||||
@@ -260,6 +274,7 @@ class $AssetsIconsGen {
|
||||
inside,
|
||||
inspection,
|
||||
key,
|
||||
killogram,
|
||||
liveStock,
|
||||
logout,
|
||||
map,
|
||||
@@ -363,6 +378,12 @@ class $AssetsVecGen {
|
||||
/// File path: assets/vec/chicken.svg.vec
|
||||
SvgGenImage get chickenSvg => const SvgGenImage.vec('assets/vec/chicken.svg.vec');
|
||||
|
||||
/// File path: assets/vec/clipboard_eye.svg.vec
|
||||
SvgGenImage get clipboardEyeSvg => const SvgGenImage.vec('assets/vec/clipboard_eye.svg.vec');
|
||||
|
||||
/// File path: assets/vec/clipboard_task.svg.vec
|
||||
SvgGenImage get clipboardTaskSvg => const SvgGenImage.vec('assets/vec/clipboard_task.svg.vec');
|
||||
|
||||
/// File path: assets/vec/close_square.svg.vec
|
||||
SvgGenImage get closeSquareSvg => const SvgGenImage.vec('assets/vec/close_square.svg.vec');
|
||||
|
||||
@@ -429,6 +450,9 @@ class $AssetsVecGen {
|
||||
/// File path: assets/vec/key.svg.vec
|
||||
SvgGenImage get keySvg => const SvgGenImage.vec('assets/vec/key.svg.vec');
|
||||
|
||||
/// File path: assets/vec/killogram.svg.vec
|
||||
SvgGenImage get killogramSvg => const SvgGenImage.vec('assets/vec/killogram.svg.vec');
|
||||
|
||||
/// File path: assets/vec/liveStock.svg.vec
|
||||
SvgGenImage get liveStockSvg => const SvgGenImage.vec('assets/vec/liveStock.svg.vec');
|
||||
|
||||
@@ -539,6 +563,8 @@ class $AssetsVecGen {
|
||||
checkSvg,
|
||||
checkSquareSvg,
|
||||
chickenSvg,
|
||||
clipboardEyeSvg,
|
||||
clipboardTaskSvg,
|
||||
closeSquareSvg,
|
||||
convertCubeSvg,
|
||||
cubeSvg,
|
||||
@@ -561,6 +587,7 @@ class $AssetsVecGen {
|
||||
insideSvg,
|
||||
inspectionSvg,
|
||||
keySvg,
|
||||
killogramSvg,
|
||||
liveStockSvg,
|
||||
logoutSvg,
|
||||
mapSvg,
|
||||
|
||||
@@ -15,8 +15,11 @@ class BaseBottomSheet extends StatelessWidget {
|
||||
height: height ?? MediaQuery.of(context).size.height * 0.85,
|
||||
padding: EdgeInsets.symmetric(vertical: 15, horizontal: 20),
|
||||
decoration: BoxDecoration(
|
||||
color:bgColor?? Colors.white,
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)),
|
||||
color: bgColor ?? Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(25),
|
||||
topRight: Radius.circular(25),
|
||||
),
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
@@ -33,11 +36,14 @@ class BaseBottomSheet extends StatelessWidget {
|
||||
Container(
|
||||
height: 3,
|
||||
width: 50,
|
||||
decoration: BoxDecoration(color: AppColor.darkGreyDark, borderRadius: BorderRadius.circular(8)),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.darkGreyDark,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
|
||||
Positioned(
|
||||
left: 0,
|
||||
left: -10,
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
|
||||
@@ -6,16 +6,14 @@ class EmptyWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Row(),
|
||||
Assets.icons.empty.svg(width: 156.w, height: 156.h),
|
||||
Text('داده ای یافت نشد', style: AppFonts.yekan20.copyWith(color: AppColor.textColor)),
|
||||
],
|
||||
),
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Row(),
|
||||
Assets.anim.error.lottie(),
|
||||
Text('داده ای یافت نشد', style: AppFonts.yekan20.copyWith(color: AppColor.textColor)),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
enum RTextFieldVariant {
|
||||
normal,
|
||||
noBorder,
|
||||
password,
|
||||
passwordNoBorder,
|
||||
}
|
||||
enum RTextFieldVariant { normal, noBorder, password, passwordNoBorder }
|
||||
|
||||
class RTextField extends StatefulWidget {
|
||||
final TextEditingController controller;
|
||||
@@ -40,6 +35,7 @@ class RTextField extends StatefulWidget {
|
||||
final void Function(String)? onChanged;
|
||||
final void Function(String)? onSubmitted;
|
||||
final List<TextInputFormatter>? inputFormatters;
|
||||
final Widget? suffix;
|
||||
|
||||
const RTextField({
|
||||
super.key,
|
||||
@@ -71,32 +67,25 @@ class RTextField extends StatefulWidget {
|
||||
this.onChanged,
|
||||
this.onSubmitted,
|
||||
this.borderColor,
|
||||
this.inputFormatters
|
||||
this.inputFormatters,
|
||||
this.suffix,
|
||||
});
|
||||
|
||||
|
||||
@override
|
||||
State<RTextField> createState() => _RTextFieldState();
|
||||
|
||||
bool get _isPassword => variant == RTextFieldVariant.password;
|
||||
|
||||
bool get _noBorder => variant == RTextFieldVariant.noBorder;
|
||||
|
||||
bool get _passwordNoBorder => variant == RTextFieldVariant.passwordNoBorder;
|
||||
|
||||
|
||||
InputBorder get _inputBorder =>
|
||||
_noBorder || _passwordNoBorder ? InputBorder.none : OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(
|
||||
color: borderColor ?? AppColor.lightGreyDarkActive,
|
||||
width: 1,
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
InputBorder get _inputBorder => _noBorder || _passwordNoBorder
|
||||
? InputBorder.none
|
||||
: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: borderColor ?? AppColor.lightGreyDarkActive, width: 1),
|
||||
);
|
||||
}
|
||||
|
||||
class _RTextFieldState extends State<RTextField> {
|
||||
@@ -164,6 +153,7 @@ class _RTextFieldState extends State<RTextField> {
|
||||
errorStyle: widget.errorStyle,
|
||||
errorMaxLines: 1,
|
||||
isDense: widget.isDense,
|
||||
suffix: widget.suffix,
|
||||
suffixIcon: _buildSuffixIcon(),
|
||||
suffixIconConstraints: widget.boxConstraints,
|
||||
prefixIcon: widget.prefixIcon,
|
||||
@@ -185,4 +175,4 @@ class _RTextFieldState extends State<RTextField> {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ class LoadingWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(child: Center(child: Assets.anim.loading.lottie(
|
||||
return Center(child: Assets.anim.loading.lottie(
|
||||
width: 120.w,
|
||||
height: 120.h,
|
||||
)));
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,8 +58,9 @@ class _OverlayDropdownState<T> extends State<OverlayDropdownWidget<T>> {
|
||||
elevation: 4,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Container(
|
||||
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: AppColor.bgLight,
|
||||
border: Border.all(color: AppColor.darkGreyLight),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
@@ -123,6 +124,7 @@ class _OverlayDropdownState<T> extends State<OverlayDropdownWidget<T>> {
|
||||
width: Get.width,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.bgLight,
|
||||
border: Border.all(color: AppColor.darkGreyLight),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
|
||||
@@ -21,6 +21,11 @@ extension XDateTime on String {
|
||||
String get formattedYHMS {
|
||||
return DateFormat('yyyy-MM-dd HH:mm:ss').format(toDateTime);
|
||||
}
|
||||
|
||||
Jalali get toJalali{
|
||||
final dateTime = DateTime.parse(this);
|
||||
return Jalali.fromDateTime(dateTime);
|
||||
}
|
||||
}
|
||||
|
||||
extension XDateTime2 on DateTime {
|
||||
|
||||
Reference in New Issue
Block a user