feat: new changes in StewardFreeBar model and some change ui

This commit is contained in:
2025-06-17 14:53:03 +03:30
parent cda87cba95
commit fc4295e532
6 changed files with 611 additions and 609 deletions

View File

@@ -1,8 +1,20 @@
import 'package:rasadyar_chicken/presentation/pages/root/logic.dart';
import 'package:rasadyar_core/core.dart';
class SalesOutOfProvinceLogic extends GetxController {
RxBool isExpanded = false.obs;
RxList<int> isExpandedList = <int>[].obs;
RootLogic get rootLogic => Get.find<RootLogic>();
@override
void onReady() {
// TODO: implement onReady

View File

@@ -65,231 +65,221 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
ListView saleListWidget() {
return ListView.separated(
shrinkWrap: true,
padding: EdgeInsets.fromLTRB(8, 8, 18, 80),
itemBuilder: (context, index) {
return ObxValue(
(data) => saleListItem(data, index),
controller.isExpandedList,
);
},
separatorBuilder: (context, index) => SizedBox(height: 8),
itemCount: 5,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
padding: EdgeInsets.fromLTRB(8, 8, 18, 80),
itemBuilder: (context, index) {
return ObxValue(
(data) => saleListItem(data, index),
controller.isExpandedList,
);
},
separatorBuilder: (context, index) => SizedBox(height: 8),
itemCount: 5,
);
}
Widget emptyWidget() {
return Center(
child: Text(
'داده ای دریافت نشد!',
style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDarkHover),
),
);
}
GestureDetector saleListItem(RxList<int> data, int index) {
return GestureDetector(
onTap: () {
if (data.contains(index)) {
controller.isExpandedList.remove(index);
} else {
controller.isExpandedList.add(index);
}
},
child: AnimatedContainer(
duration: Duration(milliseconds: 400),
onTap: () {
if (data.contains(index)) {
controller.isExpandedList.remove(index);
} else {
controller.isExpandedList.add(index);
}
},
child: AnimatedContainer(
duration: Duration(milliseconds: 400),
alignment: Alignment.center,
height: data.contains(index) ? 210 : 56,
child: Stack(
clipBehavior: Clip.none,
alignment: Alignment.centerRight,
children: [
AnimatedContainer(
width: Get.width - 30,
duration: Duration(milliseconds: 300),
height: data.contains(index) ? 210 : 56,
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,
height: data.contains(index) ? 210 : 56,
child: Stack(
clipBehavior: Clip.none,
alignment: Alignment.centerRight,
firstChild: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
AnimatedContainer(
width: Get.width - 30,
duration: Duration(milliseconds: 300),
height: data.contains(index) ? 210 : 56,
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: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
'1403/5/5',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.bgDark,
),
),
Text(
'افلاک',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.blueNormal,
),
),
Text(
'kg 200 مرغ گرم ',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.blueNormal,
),
),
Text(
'لرستان-خرم آباد',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.bgDark,
),
),
Icon(CupertinoIcons.chevron_down, size: 12),
],
),
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: [
Assets.vec.editSvg.svg(
width: 20,
height: 20,
colorFilter: ColorFilter.mode(
AppColor.blueNormal,
BlendMode.srcIn,
),
),
Text(
'لرستان - خرم آباد',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(
color: AppColor.greenDark,
),
),
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(
'تاریخ',
'07:15:00 - 1402/07/01',
),
),
buildRow(
'مشخصات فروشنده',
'افلاک - 09203659874',
),
buildRow('وزن خریداری شده', '200 کیلوگرم'),
buildRow('لاشه خریداری شده', '200 عدد'),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Icon(CupertinoIcons.chevron_up, size: 12),
],
),
],
),
),
crossFadeState: data.contains(index)
? CrossFadeState.showSecond
: CrossFadeState.showFirst,
duration: Duration(milliseconds: 300),
Text(
'1403/5/5',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
),
Text(
'افلاک',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.blueNormal,
),
),
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,
),
),
Text(
'kg 200 مرغ گرم ',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.blueNormal,
),
),
Text(
'لرستان-خرم آباد',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
),
Icon(CupertinoIcons.chevron_down, size: 12),
],
),
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: [
Assets.vec.editSvg.svg(
width: 20,
height: 20,
colorFilter: ColorFilter.mode(
AppColor.blueNormal,
BlendMode.srcIn,
),
),
Text(
'لرستان - خرم آباد',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(
color: AppColor.greenDark,
),
),
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('تاریخ', '07:15:00 - 1402/07/01'),
),
buildRow('مشخصات فروشنده', 'افلاک - 09203659874'),
buildRow('وزن خریداری شده', '200 کیلوگرم'),
buildRow('لاشه خریداری شده', '200 عدد'),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [Icon(CupertinoIcons.chevron_up, size: 12)],
),
],
),
),
crossFadeState: data.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),
),
),
),
],
),
),
);
}
Row routePageWidget() {
return Row(
children: [
SizedBox(width: 8),
RichText(
text: TextSpan(
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
children: [
WidgetSpan(
child: Row(
children: [
Assets.vec.cubeSearchSvg.svg(
width: 24,
height: 24,
colorFilter: const ColorFilter.mode(
AppColor.blueNormal,
BlendMode.srcIn,
),
),
SizedBox(width: 6,)
],
children: [
SizedBox(width: 8),
RichText(
text: TextSpan(
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
children: [
WidgetSpan(
child: Row(
children: [
Assets.vec.cubeSearchSvg.svg(
width: 24,
height: 24,
colorFilter: const ColorFilter.mode(
AppColor.blueNormal,
BlendMode.srcIn,
),
),
),
TextSpan(text: 'خارج استان'),
TextSpan(text: '/'),
TextSpan(text: 'خرید'),
],
SizedBox(width: 6),
],
),
),
),
],
);
TextSpan(text: 'خارج استان'),
TextSpan(text: '/'),
TextSpan(text: 'خرید'),
],
),
),
],
);
}
Widget buildRow(String title, String value) {