feat : init statics

This commit is contained in:
2025-07-26 15:47:22 +03:30
parent ad456d5855
commit bafa24543d
54 changed files with 1853 additions and 1421 deletions

View File

@@ -1,7 +1,5 @@
library;
export 'presentation/filter/logic.dart';
export 'presentation/filter/view.dart';
export 'presentation/routes/app_pages.dart';
export 'presentation/pages/pages.dart';
export 'presentation/routes/app_routes.dart';
export 'presentation/routes/app_pages.dart';

View File

@@ -1,726 +0,0 @@
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
class ActionPage extends GetView<ActionLogic> {
const ActionPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColor.bgLight,
body: SafeArea(
child: Column(
children: [
SizedBox(height: 20),
ObxValue((data) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: List.generate(4, (index) {
return headerWidget(
icon: controller.headersIcons[index],
title: controller.headersTitle[index],
onTap: () {
controller.updateSelectedIndex(index);
},
isSelected: controller.selectedIndex.value == index,
);
}),
);
}, controller.selectedIndex),
Expanded(
child: ObxValue((index) {
if (index.value == 3) {
WidgetsBinding.instance.addPostFrameCallback((_) {
showCupertinoDialog(
context: context,
barrierDismissible: true,
builder: (context) {
return CupertinoAlertDialog(
title: Text(
'از سامانه خارج می شوید؟',
style: AppFonts.yekan18.copyWith(
color: AppColor.lightGreyDarkActive,
),
),
actions: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
spacing: 16,
children: [
Expanded(
child: RElevated(
text: 'بله',
onPressed: () {
exit(0);
},
),
),
Expanded(
child: ROutlinedElevated(
text: 'خیر',
onPressed: () {
controller.updateSelectedIndex(
controller.previousIndex.value,
);
Get.back();
},
),
),
],
),
),
],
);
},
);
});
}
return switch (index.value) {
0 => profileWidget(),
1 => supervisionHistoryWidget(),
2 => statisticsWidget(),
int() => Container(),
};
}, controller.selectedIndex),
),
],
),
),
);
}
Container statisticsWidget() => Container(
margin: EdgeInsets.only(top: 50),
padding: EdgeInsets.symmetric(vertical: 50),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
topRight: Radius.circular(30),
),
),
child: Column(
children: [
Container(
height: 32,
margin: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
spacing: 10,
children: [
Expanded(
child: ROutlinedElevatedIcon(
icon: FaIcon(FontAwesomeIcons.calendar),
onPressed: () {},
text: 'از تاریخ',
textStyle: AppFonts.yekan16.copyWith(
color: AppColor.blueNormal,
),
),
),
Expanded(
child: ROutlinedElevatedIcon(
icon: FaIcon(FontAwesomeIcons.calendar),
onPressed: () {},
text: 'تا تاریخ',
textStyle: AppFonts.yekan16.copyWith(
color: AppColor.blueNormal,
),
),
),
],
),
),
optionWidget(
selected: controller.filter1Index,
title: 'فیلترتراکنش ها',
options: controller.tmpLs,
),
optionWidget(
selected: controller.filter2Index,
title: 'فیلتر شهرستان',
options: controller.hamadanCities,
),
SizedBox(height: 10),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
vecWidgetWithOnTap(
child: Assets.vec.pdfDownloadSvg.svg(),
onTap: () {},
width: 64,
height: 64,
),
vecWidgetWithOnTap(
child: Assets.vec.excelDownloadSvg.svg(),
onTap: () {},
width: 64,
height: 64,
),
],
),
),
SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 20,
children: [
headerInfo(title: 'تعداد تراکنش ها', description: '183 '),
headerInfo(
title: 'جمع تراکنش ها',
description: '183 ریال',
background: AppColor.green1Light,
),
],
),
],
),
);
Widget supervisionHistoryWidget() {
return ObxValue((data) {
return ListView.builder(
itemBuilder: (context, index) {
return historyItem(data[index], () {
data[index] = !data[index];
});
},
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemCount: data.length,
);
}, controller.supervisionHistoryList);
}
Column profileWidget() {
return Column(
children: [
slidableWidgetOne(),
slidableWidgetOne(),
slidableWidgetOne(),
slidableWidgetOne(),
slidableWidgetOne(),
],
);
}
Widget headerWidget({
required Widget icon,
required String title,
required VoidCallback onTap,
bool isSelected = false,
}) {
return GestureDetector(
onTap: onTap,
child: Column(
spacing: 8,
children: [
Container(
width: 48,
height: 48,
padding: EdgeInsets.all(8),
decoration: ShapeDecoration(
color: isSelected ? AppColor.blueLightActive : AppColor.blueLight,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
child: icon,
),
Text(
title,
style: AppFonts.yekan12.copyWith(
color:
isSelected ? AppColor.blueNormalActive : AppColor.blueNormal,
),
),
],
),
);
}
Widget slidableWidgetOne() {
if (controller.showSlideHint) {
controller.triggerSlidableAnimation();
}
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20),
child: Slidable(
key: Key('selectedLocationWidget'),
controller: controller.slidController.value,
endActionPane: ActionPane(
motion: StretchMotion(),
children: [
CustomSlidableAction(
onPressed: (context) {},
backgroundColor: AppColor.redNormal,
foregroundColor: Colors.white,
padding: EdgeInsets.all(16),
borderRadius: BorderRadius.circular(8),
autoClose: true,
child: Assets.vec.trashSvg.svg(
width: 24,
height: 24,
),
),
],
),
child: GestureDetector(
onTap: () {},
child: Container(
height: 62,
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 1, color: AppColor.blackLightHover),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
spacing: 4,
children: [
Text(
'داود خرم مهری پور',
style: AppFonts.yekan10.copyWith(
color: AppColor.blueNormal,
),
),
Text(
'03295224154',
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Column(
spacing: 4,
children: [
Text(
'افزودن کاربر',
style: AppFonts.yekan10.copyWith(
color: AppColor.blueNormal,
),
),
Text(
'ثبت بازرسی',
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Column(
spacing: 4,
children: [
Text(
'همدان',
style: AppFonts.yekan10.copyWith(
color: AppColor.blueNormal,
),
),
Text(
'همدان',
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
],
),
),
),
),
);
}
Widget slidableWidgetTwo({required VoidCallback onTap}) {
return Slidable(
key: Key('selectedLocationWidget'),
controller: controller.slidController.value,
endActionPane: ActionPane(
motion: StretchMotion(),
children: [
CustomSlidableAction(
onPressed: (context) {},
backgroundColor: AppColor.blueNormal,
foregroundColor: Colors.white,
padding: EdgeInsets.all(16),
borderRadius: BorderRadius.only(
topRight: Radius.circular(8),
bottomRight: Radius.circular(8),
),
autoClose: true,
child: Assets.vec.trashSvg.svg(
width: 24,
height: 24,
),
),
CustomSlidableAction(
onPressed: (context) {},
backgroundColor: AppColor.redNormal,
foregroundColor: Colors.white,
padding: EdgeInsets.all(16),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
bottomLeft: Radius.circular(8),
),
autoClose: true,
child: Assets.vec.trashSvg.svg(
width: 24,
height: 24,
),
),
],
),
child: GestureDetector(
onTap: onTap,
child: Container(
height: 62,
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 1, color: AppColor.blackLightHover),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
spacing: 4,
children: [
Text(
'داود خرم مهری پور',
style: AppFonts.yekan10.copyWith(
color: AppColor.blueNormal,
),
),
Text(
'03295224154',
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Column(
spacing: 4,
children: [
Text(
'افزودن کاربر',
style: AppFonts.yekan10.copyWith(
color: AppColor.blueNormal,
),
),
Text(
'ثبت بازرسی',
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Column(
spacing: 4,
children: [
Text(
'همدان',
style: AppFonts.yekan10.copyWith(
color: AppColor.blueNormal,
),
),
Text(
'همدان',
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
],
),
),
),
);
}
Widget historyItem(bool isExpanded, VoidCallback onTap) {
return AnimatedContainer(
margin: EdgeInsets.symmetric(horizontal: 30, vertical: 10),
curve: Curves.easeInOut,
duration: Duration(seconds: 1),
height: isExpanded ? 364 : 62,
child:
isExpanded
? markerDetailsWidget(ontap: onTap)
: slidableWidgetTwo(onTap: onTap),
);
}
Widget markerDetailsWidget({required VoidCallback ontap}) {
return GestureDetector(
onTap: ontap,
behavior: HitTestBehavior.opaque,
child: Container(
clipBehavior: Clip.antiAlias,
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
decoration: ShapeDecoration(
color: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
child: Column(
spacing: 15,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
spacing: 12,
children: [
vecWidgetWithOnTap(
child: Assets.vec.editSvg.svg(),
onTap: () {},
width: 24,
height: 24,
color: AppColor.blueNormal,
),
Text(
'سوابق بازرسی من',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
vecWidgetWithOnTap(
child: Assets.vec.trashSvg.svg(),
width: 24,
height: 24,
color: AppColor.redNormal,
onTap: () {},
),
],
),
Container(
height: 32,
clipBehavior: Clip.antiAlias,
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 4),
decoration: ShapeDecoration(
color: AppColor.blueLight,
shape: RoundedRectangleBorder(
side: BorderSide(width: 1, color: AppColor.blueLightHover),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'تاریخ بازرسی',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
Text(
'1403/12/12',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'شماره همراه',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
Text(
'0326598653',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'آخرین فعالیت',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
Text(
'1409/12/12',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'موجودی',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
Text(
'5کیلوگرم',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
...List.generate(
5,
(index) => Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'فروش رفته',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
Text(
'0 کیلوگرم',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
),
],
),
),
);
}
Column optionWidget({
required RxInt selected,
required String title,
required List<String> options,
}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 22, vertical: 10),
child: Text(
title,
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 30),
child: Wrap(
runSpacing: 8,
spacing: 8,
children:
options
.map(
(e) => ObxValue((data) {
return ChoiceChip(
onSelected: (value) {
selected.value = options.indexOf(e);
},
selectedColor: AppColor.blueNormal,
labelStyle:
data.value == options.indexOf(e)
? AppFonts.yekan13.copyWith(
color: AppColor.whiteLight,
)
: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyNormalActive,
),
checkmarkColor: Colors.white,
label: Text(e),
selected: options.indexOf(e) == data.value,
);
}, selected),
)
.toList(),
),
),
],
);
}
Container headerInfo({
required String title,
required String description,
Color? background,
}) {
return Container(
clipBehavior: Clip.antiAlias,
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12),
decoration: ShapeDecoration(
color: background ?? AppColor.blueLight,
shape: RoundedRectangleBorder(
side: BorderSide(width: 1, color: AppColor.blackLightHover),
borderRadius: BorderRadius.circular(8),
),
),
alignment: AlignmentDirectional.center,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
spacing: 10,
children: [
Text(title, style: AppFonts.yekan10),
Text(description, style: AppFonts.yekan12),
],
),
);
}
}

View File

@@ -10,16 +10,14 @@ class ActionLogic extends GetxController with GetTickerProviderStateMixin {
List<String> headersTitle = [
'کاربران',
'سوابق بازرسی من',
'سوابق',
'آمار',
'خروج از سامانه',
];
List<Widget> headersIcons = [
Assets.vec.profileUserSvg.svg(),
Assets.vec.calendarSearchSvg.svg(),
Assets.vec.diagramSvg.svg(),
Assets.vec.logoutSvg.svg(),
List<String> headersIcons = [
Assets.vec.profileUserSvg.path,
Assets.vec.calendarSearchSvg.path,
Assets.vec.diagramSvg.path,
];
RxList<bool> supervisionHistoryList = [false, false, false, false].obs;

View File

@@ -0,0 +1,443 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_inspection/presentation/pages/records/view.dart';
import 'package:rasadyar_inspection/presentation/pages/statistics/view.dart';
import 'package:rasadyar_inspection/presentation/pages/users/view.dart';
import 'package:rasadyar_inspection/presentation/widget/base_page/view.dart';
import 'logic.dart';
class ActionPage extends GetView<ActionLogic> {
const ActionPage({super.key});
@override
Widget build(BuildContext context) {
return BasePage(
hasBack: false,
hasFilter: true,
hasSearch: true,
widgets: [
SizedBox(height: 20),
ObxValue((data) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(controller.headersIcons.length, (index) {
return headerWidget(
iconPath: controller.headersIcons[index],
title: controller.headersTitle[index],
onTap: () {
controller.updateSelectedIndex(index);
},
isSelected: controller.selectedIndex.value == index,
);
}),
);
}, controller.selectedIndex),
Expanded(
child: Container(
color: Colors.white,
child: ObxValue((index) {
return switch (index.value) {
0 => UsersPage(),
1 => RecordsPage(),
2 => StatisticsPage(),
int() => throw UnimplementedError(),
};
}, controller.selectedIndex),
),
),
],
);
}
Widget supervisionHistoryWidget() {
return ObxValue((data) {
return ListView.builder(
itemBuilder: (context, index) {
return historyItem(data[index], () {
data[index] = !data[index];
});
},
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemCount: data.length,
);
}, controller.supervisionHistoryList);
}
Widget headerWidget({
required String iconPath,
required String title,
required VoidCallback onTap,
bool isSelected = false,
}) {
return GestureDetector(
onTap: onTap,
child: Container(
width: 93.w,
height: 104.h,
margin: EdgeInsets.symmetric(horizontal: 8.w),
padding: EdgeInsets.symmetric(horizontal: 12.w,vertical: 8.h),
decoration: BoxDecoration(
color: isSelected ? Colors.white : Colors.transparent,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 8,
children: [
Container(
width: 48.w,
height: 48.h,
padding: EdgeInsets.all(8),
decoration: ShapeDecoration(
color: isSelected ? AppColor.blueLightActive : Colors.transparent,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
child: SvgGenImage.vec(iconPath).svg(
width: 24.w,
height: 24.h,
colorFilter: ColorFilter.mode(
isSelected ? AppColor.blueNormalActive : AppColor.blueNormal,
BlendMode.srcIn,
),
),
),
Text(
title,
style: AppFonts.yekan12.copyWith(
color: isSelected ? AppColor.blueNormalActive : AppColor.blueNormal,
),
),
],
),
),
);
}
Widget slidableWidgetTwo({required VoidCallback onTap}) {
return Slidable(
key: Key('selectedLocationWidget'),
controller: controller.slidController.value,
endActionPane: ActionPane(
motion: StretchMotion(),
children: [
CustomSlidableAction(
onPressed: (context) {},
backgroundColor: AppColor.blueNormal,
foregroundColor: Colors.white,
padding: EdgeInsets.all(16),
borderRadius: BorderRadius.only(
topRight: Radius.circular(8),
bottomRight: Radius.circular(8),
),
autoClose: true,
child: Assets.vec.trashSvg.svg(width: 24, height: 24),
),
CustomSlidableAction(
onPressed: (context) {},
backgroundColor: AppColor.redNormal,
foregroundColor: Colors.white,
padding: EdgeInsets.all(16),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
bottomLeft: Radius.circular(8),
),
autoClose: true,
child: Assets.vec.trashSvg.svg(width: 24, height: 24),
),
],
),
child: GestureDetector(
onTap: onTap,
child: Container(
height: 62,
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 1, color: AppColor.blackLightHover),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
spacing: 4,
children: [
Text(
'داود خرم مهری پور',
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
),
Text(
'03295224154',
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
Column(
spacing: 4,
children: [
Text(
'افزودن کاربر',
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
),
Text(
'ثبت بازرسی',
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
Column(
spacing: 4,
children: [
Text('همدان', style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)),
Text(
'همدان',
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
],
),
),
),
);
}
Widget historyItem(bool isExpanded, VoidCallback onTap) {
return AnimatedContainer(
margin: EdgeInsets.symmetric(horizontal: 30, vertical: 10),
curve: Curves.easeInOut,
duration: Duration(seconds: 1),
height: isExpanded ? 364 : 62,
child: isExpanded ? markerDetailsWidget(ontap: onTap) : slidableWidgetTwo(onTap: onTap),
);
}
Widget markerDetailsWidget({required VoidCallback ontap}) {
return GestureDetector(
onTap: ontap,
behavior: HitTestBehavior.opaque,
child: Container(
clipBehavior: Clip.antiAlias,
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
decoration: ShapeDecoration(
color: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
child: Column(
spacing: 15,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
spacing: 12,
children: [
vecWidgetWithOnTap(
child: Assets.vec.editSvg.svg(),
onTap: () {},
width: 24,
height: 24,
color: AppColor.blueNormal,
),
Text(
'سوابق بازرسی من',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
vecWidgetWithOnTap(
child: Assets.vec.trashSvg.svg(),
width: 24,
height: 24,
color: AppColor.redNormal,
onTap: () {},
),
],
),
Container(
height: 32,
clipBehavior: Clip.antiAlias,
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 4),
decoration: ShapeDecoration(
color: AppColor.blueLight,
shape: RoundedRectangleBorder(
side: BorderSide(width: 1, color: AppColor.blueLightHover),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'تاریخ بازرسی',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
Text(
'1403/12/12',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'شماره همراه',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
Text(
'0326598653',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'آخرین فعالیت',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
Text(
'1409/12/12',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'موجودی',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
Text(
'5کیلوگرم',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
...List.generate(
5,
(index) => Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'فروش رفته',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
Text(
'0 کیلوگرم',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
),
],
),
),
);
}
Column optionWidget({
required RxInt selected,
required String title,
required List<String> options,
}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 22, vertical: 10),
child: Text(
title,
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 30),
child: Wrap(
runSpacing: 8,
spacing: 8,
children: options
.map(
(e) => ObxValue((data) {
return ChoiceChip(
onSelected: (value) {
selected.value = options.indexOf(e);
},
selectedColor: AppColor.blueNormal,
labelStyle: data.value == options.indexOf(e)
? AppFonts.yekan13.copyWith(color: AppColor.whiteLight)
: AppFonts.yekan12.copyWith(color: AppColor.darkGreyNormalActive),
checkmarkColor: Colors.white,
label: Text(e),
selected: options.indexOf(e) == data.value,
);
}, selected),
)
.toList(),
),
),
],
);
}
Container headerInfo({required String title, required String description, Color? background}) {
return Container(
clipBehavior: Clip.antiAlias,
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12),
decoration: ShapeDecoration(
color: background ?? AppColor.blueLight,
shape: RoundedRectangleBorder(
side: BorderSide(width: 1, color: AppColor.blackLightHover),
borderRadius: BorderRadius.circular(8),
),
),
alignment: AlignmentDirectional.center,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
spacing: 10,
children: [
Text(title, style: AppFonts.yekan10),
Text(description, style: AppFonts.yekan12),
],
),
);
}
}

View File

@@ -1,9 +1,9 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_inspection/data/utils/marker_generator.dart';
import 'package:rasadyar_inspection/presentation/filter/view.dart';
import 'package:rasadyar_inspection/presentation/pages/filter/view.dart';
class InspectorFilterLogic extends GetxController
with GetTickerProviderStateMixin {

View File

@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_core/presentation/widget/buttons/fab.dart';
import 'package:rasadyar_inspection/presentation/routes/app_routes.dart';
import 'package:rasadyar_inspection/presentation/widget/custom_chips.dart';
import 'logic.dart';
@@ -440,31 +441,6 @@ Widget markerDetailsWidget() {
),
);
}
Widget customChip({bool isSelected = false, required String title, required int index, required Function(int) onTap}) {
return GestureDetector(
onTap: () {
onTap.call(index);
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
color: isSelected ? AppColor.blueNormal : AppColor.whiteGreyNormal,
borderRadius: BorderRadius.circular(8),
border: isSelected
? Border.fromBorderSide(BorderSide.none)
: Border.all(width: 0.25, color: const Color(0xFFB0B0B0)),
),
child: Text(
title,
textAlign: TextAlign.center,
style: isSelected ? AppFonts.yekan10.copyWith(color: AppColor.whiteLight) : AppFonts.yekan10,
),
),
);
}
Widget selectedLocationWidget({
required bool showHint,
required SlidableController sliderController,

View File

@@ -1,8 +1,9 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_inspection/presentation/pages/filter/view.dart';
import 'package:rasadyar_inspection/presentation/routes/app_routes.dart';
import 'package:rasadyar_inspection/presentation/widget/base_page/view.dart';
import 'package:rasadyar_inspection/presentation/widget/list_item/list_item.dart';
import 'package:rasadyar_inspection/presentation/widget/custom_chips.dart';
import 'package:rasadyar_inspection/presentation/widget/search.dart';
import 'logic.dart';
@@ -118,35 +119,6 @@ class InspectionMapPage extends GetView<InspectionMapLogic> {
return BaseBottomSheet(
height: data.value ? 450.h : 150.h,
child: ListItemWithOutCounter(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'داود خرم مهری پور',
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
),
Text(
'گوشت و مرغ',
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('باقی مانده', style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)),
Text(
'0 کیلوگرم',
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
Assets.vec.scanBarcodeSvg.svg(),
],
),
secondChild: Column(
spacing: 8,
children: [
@@ -256,13 +228,7 @@ class InspectionMapPage extends GetView<InspectionMapLogic> {
width: 150.w,
height: 40.h,
onPressed: () {
buildDeleteDialog(
onConfirm: () async {
// controller.denyAllocation(item.key ?? '');
//await controller.deleteAllocation(item);
},
onRefresh: () async {},
);
buildDeleteDialog(onConfirm: () async {}, onRefresh: () async {});
},
borderColor: AppColor.bgIcon,
child: Row(
@@ -293,6 +259,35 @@ class InspectionMapPage extends GetView<InspectionMapLogic> {
labelIconColor: AppColor.bgIcon,
onTap: () => data.value = !data.value,
selected: data.value,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'داود خرم مهری پور',
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
),
Text(
'گوشت و مرغ',
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('باقی مانده', style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)),
Text(
'0 کیلوگرم',
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
Assets.vec.scanBarcodeSvg.svg(),
],
),
),
);
}, controller.isSelectedDetailsLocation);
@@ -428,6 +423,7 @@ Widget filterWidget({required RxInt filterIndex, required RxInt showIndex}) {
},
index: 1,
),
customChip(
isSelected: data.value == 2,
title: 'بازرسی شده ها',
@@ -524,225 +520,6 @@ Widget cardWithLabel({
);
}
Widget markerDetailsWidget() {
return Container(
clipBehavior: Clip.antiAlias,
margin: EdgeInsets.all(35),
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
decoration: ShapeDecoration(
color: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
child: Column(
spacing: 15,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
spacing: 12,
children: [
Text(
'داود خرم پور',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDarkHover),
),
Spacer(),
vecWidgetWithOnTap(
child: Assets.vec.mapSvg.svg(),
onTap: () {
Get.toNamed(InspectionRoutes.inspectionLocationDetails);
},
width: 24,
height: 24,
color: AppColor.blueNormal,
),
vecWidgetWithOnTap(
child: Assets.vec.messageAddSvg.svg(),
width: 24,
height: 24,
color: AppColor.greenNormal,
onTap: () {
Get.toNamed(InspectionRoutes.inspectionAddSupervision);
},
),
vecWidgetWithOnTap(
child: Assets.vec.securityTimeSvg.svg(),
color: AppColor.warning,
height: 24,
width: 24,
onTap: () {},
),
],
),
Container(
height: 32,
clipBehavior: Clip.antiAlias,
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 4),
decoration: ShapeDecoration(
color: AppColor.blueLight,
shape: RoundedRectangleBorder(
side: BorderSide(width: 1, color: AppColor.blueLightHover),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'باقی مانده',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
Text(
'0 کیلوگرم',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'شماره همراه',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
Text(
'0326598653',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'آخرین فعالیت',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
Text(
'1409/12/12',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'موجودی',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
Text(
'5کیلوگرم',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
...List.generate(
5,
(index) => Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'فروش رفته',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
Text(
'0 کیلوگرم',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
),
],
),
);
}
Widget customChip({
bool isSelected = false,
required String title,
required int index,
required Function(int) onTap,
}) {
return GestureDetector(
onTap: () {
onTap.call(index);
},
child: Container(
height: 32.h,
padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 8.h),
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
color: AppColor.whiteGreyNormal,
borderRadius: BorderRadius.circular(8),
border: Border.all(
width: 1,
color: isSelected ? AppColor.blueNormal : AppColor.blackLightActive,
),
),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 12.w,
height: 12.h,
child: Transform.scale(
scale: 0.70,
child: Checkbox(
value: isSelected,
side: BorderSide(color: AppColor.whiteDarkHover, width: 1),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
visualDensity: VisualDensity.compact,
overlayColor: WidgetStateProperty.all<Color>(AppColor.blueNormal),
fillColor: WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.selected)) {
return AppColor.blueNormal;
} else {
return AppColor.whiteGreyNormal;
}
}),
onChanged: (value) {
onTap.call(index);
},
),
),
),
SizedBox(width: 8.w),
Text(
title,
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(
color: isSelected ? AppColor.blueNormal : AppColor.whiteDarkHover,
),
),
],
),
),
);
}
Widget selectedLocationWidget({
required bool showHint,

View File

@@ -0,0 +1,22 @@
export 'action/logic.dart';
export 'action/view.dart';
export 'add_mobile_inspector/logic.dart';
export 'add_mobile_inspector/view.dart';
export 'add_supervision/logic.dart';
export 'add_supervision/view.dart';
export 'display_information/logic.dart';
export 'display_information/view.dart';
export 'inspection_map/logic.dart';
export 'inspection_map/view.dart';
export 'location_details/logic.dart';
export 'location_details/view.dart';
export 'profile/logic.dart';
export 'profile/view.dart';
export 'records/logic.dart';
export 'records/view.dart';
export 'registration_of_violation/logic.dart';
export 'registration_of_violation/view.dart';
export 'root/logic.dart';
export 'root/view.dart';
export 'statistics/logic.dart';
export 'statistics/view.dart';

View File

@@ -0,0 +1,32 @@
import 'package:rasadyar_core/core.dart';
class RecordsLogic extends GetxController {
Rx<Resource<PaginationModel<int>>> countList = Resource<PaginationModel<int>>.success(
PaginationModel(results: [1, 2, 3, 4, 5, 6], count: 1, next: null, previous: null),
).obs;
RxBool isLoadingMore = false.obs;
RxInt currentPage = 1.obs;
RxInt indexExpanded = (-1).obs;
@override
void onReady() {
// TODO: implement onReady
super.onReady();
}
@override
void onClose() {
// TODO: implement onClose
super.onClose();
}
void toggleExpandedList(int index) {
if (indexExpanded.value == index) {
indexExpanded.value = -1;
} else {
indexExpanded.value = index;
}
}
}

View File

@@ -0,0 +1,184 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
class RecordsPage extends GetView<RecordsLogic> {
const RecordsPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: ObxValue((data) {
return RPaginatedListView(
listType: ListType.separated,
resource: data.value,
hasMore: data.value.data?.next != null,
isPaginating: controller.isLoadingMore.value,
onRefresh: () async {
controller.currentPage.value = 1;
//await controller.getAllocatedMade();
},
onLoadMore: () async {
controller.currentPage.value++;
iLog(controller.currentPage.value);
// await controller.getAllocatedMade(true);
},
padding: EdgeInsets.fromLTRB(8, 12, 8, 80),
itemBuilder: (context, index) {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ListItem2(
selected: val.value == index,
onTap: () => controller.toggleExpandedList(index),
index: index,
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.calendarSearchOutlineSvg.path,
labelIconColor: AppColor.bgIcon,
secondChild: itemListExpandedWidget(item, index),
child: itemListWidget(item),
);
}, controller.indexExpanded);
},
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
);
}, controller.countList),
floatingActionButton: RFab.add(onPressed: () {}),
floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
);
}
Widget itemListWidget(int item) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 3,
children: [
Text('داود خرم مهری پور', style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal)),
Text(
'09302545455',
style: AppFonts.yekan10.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('باقی مانده', style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)),
Text('0 کیلوگرم', style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover)),
],
),
Assets.vec.scanBarcodeSvg.svg(),
],
);
}
Widget itemListExpandedWidget(int item, int index) {
return Column(
spacing: 8,
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 12.w),
child: Column(
spacing: 8,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'داوود خرم پور',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
),
],
),
Container(
height: 32.h,
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: ShapeDecoration(
color: AppColor.blueLight,
shape: RoundedRectangleBorder(
side: BorderSide(width: 1.w, color: AppColor.blueLightHover),
borderRadius: BorderRadius.circular(8),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
spacing: 3,
children: [
Text(
'تاریخ بازرسی',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
),
Text(
'1403/12/12',
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
],
),
),
buildRow(
title: 'تلفن خریدار',
value: '0326598653',
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
buildRow(title: 'آخرین فعالیت', value: '1409/12/12'),
buildRow(title: 'موجودی', value: '5KG'),
buildRow(title: 'فروش رفته', value: '5KG'),
],
),
),
Visibility(
visible: true,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 16.w,
children: [
RElevated(
text: 'ویرایش',
width: 150.w,
height: 40.h,
onPressed: () {
/* controller.setEditData(item);
Get.bottomSheet(
addOrEditBottomSheet(true),
isScrollControlled: true,
backgroundColor: Colors.transparent,
).whenComplete(() {
controller.clearForm();
});*/
},
textStyle: AppFonts.yekan20.copyWith(color: Colors.white),
backgroundColor: AppColor.blueDark,
),
ROutlinedElevated(
text: 'حذف',
textStyle: AppFonts.yekan20.copyWith(color: AppColor.redNormal),
width: 150.w,
height: 40.h,
onPressed: () {
buildDeleteDialog(
onConfirm: () async {
// controller.isExpandedList.remove(index);
// controller.denyAllocation(item.key ?? '');
//await controller.deleteAllocation(item);
},
onRefresh: () async {},
);
},
borderColor: AppColor.redNormal,
),
],
),
),
],
);
}
}

View File

@@ -1,12 +1,10 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_inspection/presentation/routes/app_routes.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_core/presentation/widget/buttons/fab.dart';
import 'package:rasadyar_inspection/presentation/routes/app_routes.dart';
import 'logic.dart';
class RegistrationOfViolationPage
extends GetView<RegistrationOfViolationLogic> {
class RegistrationOfViolationPage extends GetView<RegistrationOfViolationLogic> {
const RegistrationOfViolationPage({super.key});
@override
@@ -15,17 +13,12 @@ class RegistrationOfViolationPage
backgroundColor: AppColor.bgLight,
appBar: RAppBar(
title: 'ثبت تخلف',
leading: Assets.vec.messageAddSvg.svg(
leading: Assets.vec.messageAddSvg.svg(
width: 16,
height: 16,
colorFilter: ColorFilter.mode(
Colors.white,
BlendMode.srcIn,
),
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
),
additionalActions: [
RFab.smallAdd(onPressed: () => controller.countViolation.value++),
],
additionalActions: [RFab.smallAdd(onPressed: () => controller.countViolation.value++)],
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
@@ -34,7 +27,7 @@ class RegistrationOfViolationPage
Expanded(
child: ObxValue((data) {
return ListView.separated(
itemBuilder: (context, index) => violationWidget(),
itemBuilder: (context, index) => violationWidget22(),
separatorBuilder: (context, index) => SizedBox(height: 15),
itemCount: data.value,
);
@@ -61,7 +54,7 @@ class RegistrationOfViolationPage
}
}
Container violationWidget() {
Container violationWidget22() {
return Container(
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
decoration: BoxDecoration(
@@ -71,13 +64,13 @@ Container violationWidget() {
child: Column(
spacing: 16,
children: [
RTextField(
RTextField(
controller: TextEditingController(),
label: 'عنوان تخلف',
filled: true,
filledColor: AppColor.whiteLight,
),
RTextField(
RTextField(
controller: TextEditingController(),
label: 'توضیحات تخلف',
filled: true,
@@ -85,19 +78,19 @@ Container violationWidget() {
maxLines: 3,
minLines: 3,
),
RTextField(
RTextField(
controller: TextEditingController(),
label: 'عنوان تخلف',
filled: true,
filledColor: AppColor.whiteLight,
),
RTextField(
RTextField(
controller: TextEditingController(),
label: 'عنوان تخلف',
filled: true,
filledColor: AppColor.whiteLight,
),
RTextField(
RTextField(
controller: TextEditingController(),
label: 'توضیحات تخلف',
filled: true,
@@ -111,7 +104,9 @@ Container violationWidget() {
child: Row(
spacing: 16,
children: [
Expanded(child: RElevated(text: 'ثبت', onPressed: () {})),
Expanded(
child: RElevated(text: 'ثبت', onPressed: () {}),
),
Expanded(
child: ROutlinedElevated(text: 'انصراف', onPressed: () {}),
),

View File

@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart' ;
import 'package:rasadyar_inspection/presentation/action/view.dart';
import 'package:rasadyar_inspection/presentation/filter/view.dart';
import 'package:rasadyar_inspection/presentation/inspection_map/view.dart';
import 'package:rasadyar_inspection/presentation/profile/view.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_inspection/presentation/pages/action/view.dart';
import 'package:rasadyar_inspection/presentation/pages/inspection_map/view.dart';
import 'package:rasadyar_inspection/presentation/pages/profile/view.dart';
enum ErrorLocationType { serviceDisabled, permissionDenied, none }
@@ -37,19 +37,16 @@ class RootLogic extends GetxController {
requestResult != LocationPermission.deniedForever;
case LocationPermission.deniedForever:
return request ? await Geolocator.openAppSettings() : false;
case LocationPermission.always:
case LocationPermission.whileInUse:
return true;
default:
return false;
}
} catch (e) {
eLog(e);
return await Geolocator.openLocationSettings();
}

View File

@@ -0,0 +1,63 @@
import 'package:rasadyar_core/core.dart';
class StatisticsLogic extends GetxController {
List<String> transactionFilters = ['همه', 'دارای تراکنش', 'بدون تراکنش'];
RxList<int> transactionFiltersSelected = RxList();
RxList<String> iranProvinces = [
'آذربایجان شرقی',
'آذربایجان غربی',
'اردبیل',
'اصفهان',
'البرز',
'ایلام',
'بوشهر',
'تهران',
'چهارمحال و بختیاری',
'خراسان جنوبی',
'خراسان رضوی',
'خراسان شمالی',
'خوزستان',
'زنجان',
'سمنان',
'سیستان و بلوچستان',
'فارس',
'قزوین',
'قم',
'کردستان',
'کرمان',
'کرمانشاه',
'کهگیلویه و بویراحمد',
'گلستان',
'گیلان',
'لرستان',
'مازندران',
'مرکزی',
'هرمزگان',
'همدان',
'یزد',
].obs;
RxnString iranProvincesSelected = RxnString();
RxInt s1 =2536524448.obs;
RxInt s2 =2536524448.obs;
@override
void onReady() {
// TODO: implement onReady
super.onReady();
}
@override
void onClose() {
// TODO: implement onClose
super.onClose();
}
void onTransactionFilterSelected(int index) {
if (transactionFiltersSelected.contains(index)) {
transactionFiltersSelected.remove(index);
} else {
transactionFiltersSelected.add(index);
}
update();
}
}

View File

@@ -0,0 +1,324 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_inspection/presentation/widget/custom_chips.dart';
import 'logic.dart';
class StatisticsPage extends GetView<StatisticsLogic> {
const StatisticsPage({super.key});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
spacing: 10,
children: [
Expanded(
child: Container(
height: 32.h,
decoration: BoxDecoration(
border: Border.all(color: AppColor.blueNormal, width: 1),
borderRadius: BorderRadius.circular(8),
),
padding: EdgeInsets.symmetric(horizontal: 11.w, vertical: 4.h),
child: Row(
children: [
Assets.vec.calendarSvg.svg(
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
),
SizedBox(width: 4.w),
Text('از', style: AppFonts.yekan16.copyWith(color: AppColor.blueNormal)),
SizedBox(width: 22.w),
Text(
'1404/12/12',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(color: AppColor.lightGreyNormalActive),
),
],
),
),
),
Expanded(
child: Container(
height: 32.h,
decoration: BoxDecoration(
border: Border.all(color: AppColor.blueNormal, width: 1),
borderRadius: BorderRadius.circular(8),
),
padding: EdgeInsets.symmetric(horizontal: 11.w, vertical: 4.h),
child: Row(
children: [
Assets.vec.calendarSvg.svg(
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
),
SizedBox(width: 4.w),
Text('تا', style: AppFonts.yekan16.copyWith(color: AppColor.blueNormal)),
SizedBox(width: 22.w),
Text(
'1404/12/12',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(color: AppColor.lightGreyNormalActive),
),
],
),
),
),
],
),
),
SizedBox(height: 16.h),
Container(
height: 80.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColor.lightGreyNormalHover, width: 1),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 8,
children: [
Row(
children: [
Text(
'فیلتر تراکنش ها',
textAlign: TextAlign.right,
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
],
),
Expanded(
child: ListView.separated(
shrinkWrap: true,
physics: const BouncingScrollPhysics(),
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) => ObxValue((selectedIndex) {
return customChip(
title: controller.transactionFilters[index],
isSelected: selectedIndex.contains(index),
index: index,
onTap: (data) => controller.onTransactionFilterSelected(data),
);
}, controller.transactionFiltersSelected),
separatorBuilder: (context, index) => SizedBox(width: 8),
itemCount: controller.transactionFilters.length,
),
),
],
),
),
),
SizedBox(height: 8.h),
Container(
height: 80.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColor.lightGreyNormalHover, width: 1),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 8,
children: [
Row(
children: [
Text(
'فیلتر شهرستان',
textAlign: TextAlign.right,
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
],
),
Expanded(child: _provinceDropdownWidget()),
],
),
),
),
SizedBox(height: 8.h),
Container(
height: 152.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColor.lightGreyNormalHover, width: 1),
),
child: Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 13),
child: Row(
spacing: 8,
children: [
Expanded(
child: ObxValue(
(data) => _informationLabelCard(
title: 'تعداد تراکنش ها',
titleColor: AppColor.blueNormal,
isLoading: data.value == null,
description: 25369654.separatedByComma,
iconPath: Assets.vec.cubeSearchSvg.path,
iconColor: AppColor.blueNormal,
bgDescriptionColor: Colors.white,
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [AppColor.blueLight, Colors.white],
),
),
controller.s1,
),
),
Expanded(
child: ObxValue((data) {
return _informationLabelCard(
title: 'جمع تراکنش ها',
isLoading: data.value == null,
description: data.value.separatedByComma ?? '0',
unit: 'ريال',
iconPath: Assets.vec.cubeWattingSvg.path,
bgDescriptionColor: Colors.white,
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [const Color(0xFFFFE7BB), Colors.white],
),
);
}, controller.s2),
),
],
),
),
),
],
),
);
}
Widget _provinceDropdownWidget() {
return ObxValue((data) {
return OverlayDropdownWidget<String>(
items: data,
onChanged: (value) {
controller.iranProvincesSelected.value = value;
controller.iranProvincesSelected.refresh();
},
selectedItem: controller.iranProvincesSelected.value,
itemBuilder: (item) => Text(
item ?? 'بدون نام',
style: AppFonts.yekan14.copyWith(color: AppColor.lightGreyDarker),
),
labelBuilder: (item) =>
Text('انتخاب استان', style: AppFonts.yekan14.copyWith(color: AppColor.textColorLight)),
);
}, controller.iranProvinces);
}
Container _informationLabelCard({
required String title,
required String description,
required String iconPath,
required Color bgDescriptionColor,
String? unit,
bool isLoading = false,
Color? iconColor,
Color? titleColor,
Color? bgLabelColor,
LinearGradient? gradient,
}) {
return Container(
height: 82.h,
margin: EdgeInsets.symmetric(horizontal: 12.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColor.lightGreyNormalHover, width: 1),
),
clipBehavior: Clip.hardEdge,
child: Row(
children: [
// Left side with icon and title
Expanded(
flex: 2,
child: Container(
height: 82.h,
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: gradient == null ? bgLabelColor : null,
borderRadius: BorderRadius.only(
topRight: Radius.circular(8),
bottomRight: Radius.circular(8),
),
gradient: gradient,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 4,
children: [
SvgGenImage.vec(iconPath).svg(
width: 24,
height: 24,
colorFilter: iconColor != null
? ColorFilter.mode(iconColor, BlendMode.srcIn)
: null,
),
Text(
title,
textAlign: TextAlign.right,
style: AppFonts.yekan10.copyWith(
color: titleColor ?? AppColor.mediumGreyDarkActive,
),
),
],
),
),
),
// Right side with description and unit
Expanded(
flex: 3,
child: Container(
decoration: BoxDecoration(
color: bgDescriptionColor,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
bottomLeft: Radius.circular(8),
),
),
child: isLoading
? Center(child: CupertinoActivityIndicator())
: Column(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 4,
children: [
Text(
description,
textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive),
),
Visibility(
visible: unit != null,
child: Text(
unit,
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive),
),
),
],
),
),
),
],
),
);
}
}

View File

@@ -0,0 +1,33 @@
import 'package:rasadyar_core/core.dart';
class UsersLogic extends GetxController {
Rx<Resource<PaginationModel<int>>> countList = Resource<PaginationModel<int>>.success(
PaginationModel(results: [1, 2, 3, 4, 5, 6], count: 1, next: null, previous: null),
).obs;
RxBool isLoadingMore = false.obs;
RxInt currentPage = 1.obs;
RxInt indexExpanded = (-1).obs;
@override
void onReady() {
// TODO: implement onReady
super.onReady();
}
@override
void onClose() {
// TODO: implement onClose
super.onClose();
}
void toggleExpandedList(int index) {
if (indexExpanded.value == index) {
indexExpanded.value = -1;
} else {
indexExpanded.value = index;
}
}
}

View File

@@ -0,0 +1,190 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
class UsersPage extends GetView<UsersLogic> {
const UsersPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: ObxValue((data) {
return RPaginatedListView(
listType: ListType.separated,
resource: data.value,
hasMore: data.value.data?.next != null,
isPaginating: controller.isLoadingMore.value,
onRefresh: () async {
controller.currentPage.value = 1;
//await controller.getAllocatedMade();
},
onLoadMore: () async {
controller.currentPage.value++;
iLog(controller.currentPage.value);
// await controller.getAllocatedMade(true);
},
padding: EdgeInsets.fromLTRB(8, 12, 8, 80),
itemBuilder: (context, index) {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ListItem2(
selected: val.value == index,
onTap: () => controller.toggleExpandedList(index),
index: index,
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.profile2OutlineSvg.path,
labelIconColor: AppColor.bgIcon,
secondChild: itemListExpandedWidget(item, index),
child: itemListWidget(item),
);
}, controller.indexExpanded);
},
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
);
}, controller.countList),
floatingActionButton: RFab.add(onPressed: () {}),
floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
);
}
Widget itemListWidget(int item) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 3,
children: [
Text(
'داود خرم مهری پور',
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
),
Text(
'09302545455',
style: AppFonts.yekan10.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('باقی مانده', style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)),
Text(
'0 کیلوگرم',
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
Assets.vec.scanBarcodeSvg.svg(),
],
);
}
Widget itemListExpandedWidget(int item, int index) {
return Column(
spacing: 8,
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 12.w),
child: Column(
spacing: 8,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'داوود خرم پور',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
),
],
),
Container(
height: 32.h,
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: ShapeDecoration(
color: AppColor.blueLight,
shape: RoundedRectangleBorder(
side: BorderSide(width: 1.w, color: AppColor.blueLightHover),
borderRadius: BorderRadius.circular(8),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
spacing: 3,
children: [
Text(
'تاریخ بازرسی',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
),
Text(
'1403/12/12',
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
],
),
),
buildRow(
title: 'تلفن خریدار',
value: '0326598653',
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
buildRow(title: 'آخرین فعالیت', value: '1409/12/12'),
buildRow(title: 'موجودی', value: '5KG'),
buildRow(title: 'فروش رفته', value: '5KG'),
],
),
),
Visibility(
visible:true,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 16.w,
children: [
RElevated(
text: 'ویرایش',
width: 150.w,
height: 40.h,
onPressed: () {
/* controller.setEditData(item);
Get.bottomSheet(
addOrEditBottomSheet(true),
isScrollControlled: true,
backgroundColor: Colors.transparent,
).whenComplete(() {
controller.clearForm();
});*/
},
textStyle: AppFonts.yekan20.copyWith(color: Colors.white),
backgroundColor: AppColor.blueDark,
),
ROutlinedElevated(
text: 'حذف',
textStyle: AppFonts.yekan20.copyWith(color: AppColor.redNormal),
width: 150.w,
height: 40.h,
onPressed: () {
buildDeleteDialog(
onConfirm: () async {
// controller.isExpandedList.remove(index);
// controller.denyAllocation(item.key ?? '');
//await controller.deleteAllocation(item);
},
onRefresh: () async{}
);
},
borderColor: AppColor.redNormal,
),
],
),
),
],
);
}
}

View File

@@ -1,22 +1,7 @@
import 'package:rasadyar_auth/auth.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_inspection/presentation/action/logic.dart';
import 'package:rasadyar_inspection/presentation/add_mobile_inspector/logic.dart';
import 'package:rasadyar_inspection/presentation/add_mobile_inspector/view.dart';
import 'package:rasadyar_inspection/presentation/add_supervision/logic.dart';
import 'package:rasadyar_inspection/presentation/add_supervision/view.dart';
import 'package:rasadyar_inspection/presentation/display_information/logic.dart';
import 'package:rasadyar_inspection/presentation/display_information/view.dart';
import 'package:rasadyar_inspection/presentation/filter/logic.dart';
import 'package:rasadyar_inspection/presentation/inspection_map/logic.dart';
import 'package:rasadyar_inspection/presentation/location_details/logic.dart';
import 'package:rasadyar_inspection/presentation/location_details/view.dart';
import 'package:rasadyar_inspection/presentation/profile/logic.dart';
import 'package:rasadyar_inspection/presentation/profile/view.dart';
import 'package:rasadyar_inspection/presentation/registration_of_violation/logic.dart';
import 'package:rasadyar_inspection/presentation/registration_of_violation/view.dart';
import 'package:rasadyar_inspection/presentation/root/logic.dart';
import 'package:rasadyar_inspection/presentation/root/view.dart';
import 'package:rasadyar_inspection/presentation/pages/filter/logic.dart';
import 'package:rasadyar_inspection/presentation/pages/pages.dart';
import 'package:rasadyar_inspection/presentation/pages/users/logic.dart';
import 'package:rasadyar_inspection/presentation/routes/app_routes.dart';
import 'package:rasadyar_inspection/presentation/widget/base_page/logic.dart';
@@ -29,10 +14,13 @@ sealed class InspectionPages {
page: () => RootPage(),
binding: BindingsBuilder(() {
Get.put(RootLogic());
Get.put(InspectorFilterLogic());
Get.lazyPut(()=>InspectionMapLogic());
Get.lazyPut(()=>BaseLogic());
Get.lazyPut(() =>RootLogic());
Get.lazyPut(() =>InspectorFilterLogic());
Get.lazyPut(() => InspectionMapLogic());
Get.lazyPut(() => BaseLogic());
Get.lazyPut(() => UsersLogic());
Get.lazyPut(() => RecordsLogic());
Get.lazyPut(() => StatisticsLogic());
Get.lazyPut(() => LocationDetailsLogic(), fenix: true);
Get.lazyPut(() => ActionLogic(), fenix: true);
Get.lazyPut(() => ProfileLogic(), fenix: true);

View File

@@ -0,0 +1,68 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
Widget customChip({
bool isSelected = false,
required String title,
required int index,
required Function(int) onTap,
}) {
return GestureDetector(
onTap: () {
onTap.call(index);
},
child: Container(
height: 32.h,
padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 8.h),
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
color: AppColor.whiteGreyNormal,
borderRadius: BorderRadius.circular(8),
border: Border.all(
width: 1,
color: isSelected ? AppColor.blueNormal : AppColor.blackLightActive,
),
),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 12.w,
height: 12.h,
child: Transform.scale(
scale: 0.70,
child: Checkbox(
value: isSelected,
side: BorderSide(color: AppColor.whiteDarkHover, width: 1),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
visualDensity: VisualDensity.compact,
overlayColor: WidgetStateProperty.all<Color>(AppColor.blueNormal),
fillColor: WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.selected)) {
return AppColor.blueNormal;
} else {
return AppColor.whiteGreyNormal;
}
}),
onChanged: (value) {
onTap.call(index);
},
),
),
),
SizedBox(width: 8.w),
Text(
title,
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(
color: isSelected ? AppColor.blueNormal : AppColor.whiteDarkHover,
),
),
],
),
),
);
}

View File

@@ -1,343 +0,0 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
class ListItem extends StatelessWidget {
const ListItem({
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: [
AnimatedSize(
duration: Duration(milliseconds: 300),
child: Container(
width: Get.width - 30,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(8),
),
child: Row(
children: [
Expanded(
child: AnimatedCrossFade(
alignment: Alignment.center,
firstChild: 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,
),
secondChild: Container(
padding: EdgeInsets.fromLTRB(8, 12, 14, 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),
),
),
Container(
width: 20,
child: Center(
child: SvgGenImage.vec(labelIcon).svg(
width: 16.w,
height: 16.h,
colorFilter: ColorFilter.mode(labelColor, BlendMode.srcIn),
),
),
),
],
),
),
),
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),
),
),
),
],
),
),
),
);
}
}
class ListItemWithOutCounter extends StatelessWidget {
const ListItemWithOutCounter({
super.key,
required this.child,
required this.secondChild,
required this.labelColor,
required this.labelIcon,
required this.onTap,
required this.selected,
this.labelIconColor = AppColor.mediumGreyDarkHover,
});
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: AnimatedSize(
duration: Duration(milliseconds: 300),
child: Container(
width: Get.width - 30,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(8),
),
child: Row(
children: [
Expanded(
child: AnimatedCrossFade(
alignment: Alignment.center,
firstChild: 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,
),
secondChild: Container(
padding: EdgeInsets.all(8),
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
),
child: secondChild,
),
crossFadeState: selected
? CrossFadeState.showSecond
: CrossFadeState.showFirst,
duration: Duration(milliseconds: 300),
),
),
Visibility(
visible: selected==false,
child: Container(
width: 20,
child: Center(
child: SvgGenImage.vec(labelIcon).svg(
width: 16.w,
height: 16.h,
colorFilter: ColorFilter.mode(labelColor, BlendMode.srcIn),
),
),
),
),
],
),
),
),
),
),
);
}
}
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),
),
),
),
],
),
),
),
);
}
}