feat : init statics
This commit is contained in:
76
packages/inspection/lib/presentation/pages/action/logic.dart
Normal file
76
packages/inspection/lib/presentation/pages/action/logic.dart
Normal file
@@ -0,0 +1,76 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class ActionLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
late Rx<SlidableController> slidController;
|
||||
bool showSlideHint = true;
|
||||
|
||||
RxInt selectedIndex = 0.obs;
|
||||
RxInt previousIndex = 0.obs;
|
||||
|
||||
List<String> headersTitle = [
|
||||
'کاربران',
|
||||
'سوابق',
|
||||
'آمار',
|
||||
];
|
||||
|
||||
List<String> headersIcons = [
|
||||
Assets.vec.profileUserSvg.path,
|
||||
Assets.vec.calendarSearchSvg.path,
|
||||
Assets.vec.diagramSvg.path,
|
||||
];
|
||||
|
||||
RxList<bool> supervisionHistoryList = [false, false, false, false].obs;
|
||||
|
||||
List<String> tmpLs = ['دولتی', 'غیر دولتی', 'استیجاری', 'شخصی', 'سایر'];
|
||||
|
||||
List<String> hamadanCities = [
|
||||
'همدان',
|
||||
'ملایر',
|
||||
'نهاوند',
|
||||
'تویسرکان',
|
||||
'اسدآباد',
|
||||
'بهار',
|
||||
'رزن',
|
||||
'کبودرآهنگ',
|
||||
'فامنین',
|
||||
'لالجین',
|
||||
];
|
||||
|
||||
RxInt filter1Index = 0.obs;
|
||||
RxInt filter2Index = 0.obs;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
slidController = SlidableController(this).obs;
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
Future<void> triggerSlidableAnimation() async {
|
||||
await Future.delayed(Duration(milliseconds: 200));
|
||||
await slidController.value.openEndActionPane();
|
||||
await Future.delayed(Duration(milliseconds: 200));
|
||||
await slidController.value.close();
|
||||
showSlideHint = !showSlideHint;
|
||||
}
|
||||
|
||||
void updateSelectedIndex(int index) {
|
||||
if (index == selectedIndex.value) {
|
||||
return;
|
||||
}
|
||||
previousIndex.value = selectedIndex.value;
|
||||
selectedIndex.value = index;
|
||||
}
|
||||
}
|
||||
443
packages/inspection/lib/presentation/pages/action/view.dart
Normal file
443
packages/inspection/lib/presentation/pages/action/view.dart
Normal 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),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class AddMobileInspectorLogic extends GetxController {
|
||||
RxInt countInspector = 1.obs;
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
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 'logic.dart';
|
||||
|
||||
class AddMobileInspectorPage extends GetView<AddMobileInspectorLogic> {
|
||||
const AddMobileInspectorPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColor.bgLight,
|
||||
appBar: RAppBar(
|
||||
title: 'افزودن بازرس همراه',
|
||||
leading: Assets.vec.messageAddSvg.svg(
|
||||
width: 16,
|
||||
height: 16,
|
||||
colorFilter: ColorFilter.mode(
|
||||
Colors.white,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
additionalActions: [
|
||||
RFab.smallAdd(onPressed: () => controller.countInspector.value++),
|
||||
],
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ObxValue((data) {
|
||||
return ListView.separated(
|
||||
padding: const EdgeInsets.fromLTRB(25, 10, 25, 0),
|
||||
itemBuilder: (context, index) => mobileInspectorWidget(),
|
||||
separatorBuilder: (context, index) => SizedBox(height: 15),
|
||||
itemCount: data.value,
|
||||
);
|
||||
}, controller.countInspector),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 4, 20, 25),
|
||||
child: RElevated(
|
||||
text: 'مرحله بعد',
|
||||
onPressed: () {
|
||||
Get.toNamed(InspectionRoutes.inspectionRegistrationOfViolation);
|
||||
},
|
||||
height: 40,
|
||||
isFullWidth: true,
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
textStyle: AppFonts.yekan16.copyWith(color: Colors.white),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Container mobileInspectorWidget() {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 16),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 0.7, color: AppColor.bgDark),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 16,
|
||||
children: [
|
||||
RTextField(
|
||||
controller: TextEditingController(),
|
||||
label: 'نام و نام خانوادگی',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
RTextField(
|
||||
controller: TextEditingController(),
|
||||
label: 'شماره مجوز',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
RTextField(
|
||||
controller: TextEditingController(),
|
||||
label: 'شماره ثبت',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
RTextField(
|
||||
controller: TextEditingController(),
|
||||
label: 'کد اقتصادی',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: Row(
|
||||
spacing: 16,
|
||||
children: [
|
||||
Expanded(
|
||||
child: RElevated(
|
||||
text: 'ثبت',
|
||||
textStyle: AppFonts.yekan16.copyWith(color: Colors.white),
|
||||
onPressed: () {},
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ROutlinedElevated(
|
||||
text: 'انصراف',
|
||||
textStyle: AppFonts.yekan16,
|
||||
onPressed: () {},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_inspection/presentation/routes/app_routes.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class AddSupervisionLogic extends GetxController {
|
||||
RxInt selectedSegment = 0.obs;
|
||||
RxInt violationSegmentsSelected = 0.obs;
|
||||
RxInt selectedTypeOfOwnership = 0.obs;
|
||||
RxInt selectedUnitType = 0.obs;
|
||||
RxList<int> selectedAccompanyingInspectors = RxList<int>([0]);
|
||||
|
||||
Map<String,List<String>> tmpData = {
|
||||
'نوع مالکیت': ['دولتی', 'غیر دولتی', 'استیجاری', 'شخصی', 'سایر'],
|
||||
'نوع واحد': ['دولتی', 'غیر دولتی', 'استیجاری', 'شخصی', 'سایر'],
|
||||
'بازرسان همراه': ['ندارد','دولتی', 'غیر دولتی', 'استیجاری', 'شخصی', 'سایر'],
|
||||
};
|
||||
|
||||
List<String> tmpLs = ['دولتی', 'غیر دولتی', 'استیجاری', 'شخصی', 'سایر'];
|
||||
|
||||
// The data for the segments
|
||||
final Map<int, Widget> segments = {
|
||||
0: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(50)),
|
||||
child: Text('دائم', style: AppFonts.yekan13),
|
||||
),
|
||||
1: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(50)),
|
||||
child: Text('موقت', style: AppFonts.yekan13),
|
||||
),
|
||||
};
|
||||
|
||||
// The data for the segments
|
||||
final Map<int, Widget> violationSegments = {
|
||||
0: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(50)),
|
||||
child: Text('دارد', style: AppFonts.yekan13),
|
||||
),
|
||||
1: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(50)),
|
||||
child: Text('ندارد', style: AppFonts.yekan13),
|
||||
),
|
||||
};
|
||||
|
||||
|
||||
List<String> routes = [
|
||||
InspectionRoutes.inspectionRegistrationOfViolation,
|
||||
InspectionRoutes.inspectionDisplayInformation
|
||||
];
|
||||
|
||||
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
|
||||
super.onReady();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_inspection/presentation/routes/app_routes.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class AddSupervisionPage extends GetView<AddSupervisionLogic> {
|
||||
const AddSupervisionPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColor.lightGreyLight,
|
||||
appBar: RAppBar(
|
||||
title: 'ایجاد بازرسی',
|
||||
leading: Assets.vec.messageAddSvg.svg(
|
||||
width: 16,
|
||||
height: 16,
|
||||
colorFilter: ColorFilter.mode(
|
||||
Colors.white,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
||||
children: [
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20,
|
||||
vertical: 10,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
||||
children: [
|
||||
Text(
|
||||
'نوع پروانه کسب',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
ObxValue((data) {
|
||||
return NewCupertinoSegmentedControl<int>(
|
||||
padding: EdgeInsets.zero,
|
||||
children: controller.segments,
|
||||
groupValue: data.value,
|
||||
selectedColor: AppColor.blueNormal,
|
||||
unselectedColor: Colors.white,
|
||||
borderColor: Colors.grey.shade300,
|
||||
onValueChanged: (int value) {
|
||||
data.value = value;
|
||||
},
|
||||
);
|
||||
}, controller.selectedSegment),
|
||||
SizedBox(height: 16),
|
||||
Text(
|
||||
'تخلف',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
ObxValue((data) {
|
||||
return NewCupertinoSegmentedControl<int>(
|
||||
padding: EdgeInsets.zero,
|
||||
children: controller.violationSegments,
|
||||
groupValue: data.value,
|
||||
selectedColor: AppColor.blueNormal,
|
||||
unselectedColor: Colors.white,
|
||||
borderColor: Colors.grey.shade300,
|
||||
onValueChanged: (int value) {
|
||||
if(value == 0) {
|
||||
controller.routes.ensureContainsAtStart(InspectionRoutes.inspectionRegistrationOfViolation);
|
||||
} else {
|
||||
controller.routes.remove(InspectionRoutes.inspectionRegistrationOfViolation);
|
||||
}
|
||||
data.value = value;
|
||||
},
|
||||
);
|
||||
}, controller.violationSegmentsSelected),
|
||||
SizedBox(height: 8),
|
||||
RTextField(
|
||||
controller: TextEditingController(),label: 'صادر کننده پروانه'),
|
||||
SizedBox(height: 8),
|
||||
RTextField(
|
||||
controller: TextEditingController(),label: 'شماره مجوز'),
|
||||
SizedBox(height: 8),
|
||||
RTextField(
|
||||
controller: TextEditingController(),label: 'شماره ثبت'),
|
||||
SizedBox(height: 8),
|
||||
RTextField(
|
||||
controller: TextEditingController(),label: 'کد اقتصادی'),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
optionWidget(
|
||||
selected: controller.selectedTypeOfOwnership,
|
||||
options: controller.tmpData.entries.elementAt(0),
|
||||
onSelected:
|
||||
(index) =>
|
||||
controller.selectedTypeOfOwnership.value = index,
|
||||
),
|
||||
SizedBox(height: 18),
|
||||
optionWidget(
|
||||
selected: controller.selectedUnitType,
|
||||
options: controller.tmpData.entries.elementAt(1),
|
||||
onSelected:
|
||||
(index) => controller.selectedUnitType.value = index,
|
||||
),
|
||||
SizedBox(height: 18),
|
||||
optionWidget(
|
||||
selectedList: controller.selectedAccompanyingInspectors,
|
||||
options: controller.tmpData.entries.elementAt(2),
|
||||
onSelected: (data) {
|
||||
final selected = controller.selectedAccompanyingInspectors;
|
||||
final route = InspectionRoutes.inspectionAddMobileInspector;
|
||||
|
||||
if (data == 0) {
|
||||
selected.resetWith(0);
|
||||
controller.routes.remove(route);
|
||||
return;
|
||||
}
|
||||
|
||||
controller.routes.ensureContainsAtStart(route);
|
||||
selected.removeIfPresent(0);
|
||||
selected.toggle(data);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 25),
|
||||
child: RElevated(
|
||||
text: 'مرحله بعد',
|
||||
onPressed: () {
|
||||
Get.toNamed(controller.routes.first);
|
||||
|
||||
},
|
||||
height: 40,
|
||||
isFullWidth: true,
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
textStyle: AppFonts.yekan16.copyWith(color: Colors.white),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Column optionWidget({
|
||||
RxInt? selected,
|
||||
RxList<int>? selectedList,
|
||||
required MapEntry<String, List<String>> options,
|
||||
required void Function(int index) onSelected,
|
||||
}) {
|
||||
assert(
|
||||
(selected != null) != (selectedList != null),
|
||||
'Exactly one of selected or selectedList must be provided',
|
||||
);
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Text(
|
||||
options.key,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: 50,
|
||||
child: ListView.separated(
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemBuilder:
|
||||
(context, index) =>
|
||||
selected != null
|
||||
? ObxValue((data) {
|
||||
return ChoiceChip(
|
||||
onSelected: (_) => onSelected(index),
|
||||
color: WidgetStateProperty.resolveWith<Color?>((data,) {
|
||||
if (selected.value == index) {
|
||||
return AppColor.blueNormal;
|
||||
} else {
|
||||
return Colors.white;
|
||||
}
|
||||
}),
|
||||
labelStyle:
|
||||
data.value == index
|
||||
? AppFonts.yekan13.copyWith(
|
||||
color: AppColor.whiteLight,
|
||||
)
|
||||
: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.darkGreyNormalActive,
|
||||
),
|
||||
checkmarkColor: Colors.white,
|
||||
label: Text(options.value[index]),
|
||||
selected: index == data.value,
|
||||
);
|
||||
}, selected)
|
||||
: ObxValue((data) {
|
||||
return ChoiceChip(
|
||||
onSelected: (value) => onSelected.call(index),
|
||||
color: WidgetStateProperty.resolveWith<Color?>((states,) {
|
||||
if (data.contains(index)) {
|
||||
return AppColor.blueNormal;
|
||||
} else {
|
||||
return Colors.white;
|
||||
}
|
||||
}),
|
||||
labelStyle:
|
||||
data.contains(index)
|
||||
? AppFonts.yekan13.copyWith(
|
||||
color: AppColor.whiteLight,
|
||||
)
|
||||
: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.darkGreyNormalActive,
|
||||
),
|
||||
checkmarkColor: Colors.white,
|
||||
label: Text(options.value[index]),
|
||||
selected: data.contains(index),
|
||||
);
|
||||
}, selectedList!),
|
||||
|
||||
separatorBuilder: (context, index) => SizedBox(width: 8),
|
||||
itemCount: options.value.length,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class DisplayInformationLogic extends GetxController {}
|
||||
@@ -0,0 +1,428 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class DisplayInformationPage extends GetView<DisplayInformationLogic> {
|
||||
const DisplayInformationPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColor.bgLight,
|
||||
appBar: RAppBar(
|
||||
title: 'نمایش اطلاعات',
|
||||
leading: Assets.vec.messageAddSvg.svg(
|
||||
width: 16,
|
||||
height: 16,
|
||||
colorFilter: ColorFilter.mode(
|
||||
AppColor.blueNormal,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
physics: BouncingScrollPhysics(),
|
||||
child: Column(
|
||||
spacing: 20,
|
||||
children: [
|
||||
ratingbarWidget(),
|
||||
markerDetailsWidget(),
|
||||
accompanyingInspectorsWidget(),
|
||||
accompanyingInspectorsWidget(),
|
||||
violationWidget(),
|
||||
violationWidget(),
|
||||
SizedBox(height: 30,)
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 4, 20, 25),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: RElevated(height: 40, text: 'ثبت', onPressed: () {}),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: ROutlinedElevated(
|
||||
height: 40,
|
||||
text: 'انصراف',
|
||||
onPressed: () {
|
||||
Get.until((route) => route.isFirst);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget ratingbarWidget() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(35, 35, 35,0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
children: [Text('به این صنف امتیاز دهید', style: AppFonts.yekan12)],
|
||||
),
|
||||
|
||||
SizedBox(height: 12),
|
||||
RatingBar.builder(
|
||||
initialRating: 3,
|
||||
minRating: 1,
|
||||
direction: Axis.horizontal,
|
||||
allowHalfRating: true,
|
||||
itemCount: 5,
|
||||
wrapAlignment: WrapAlignment.center,
|
||||
itemPadding: EdgeInsets.symmetric(horizontal: 4.0),
|
||||
itemBuilder: (context, _) => Icon(Icons.star, color: Colors.amber),
|
||||
onRatingUpdate: (rating) {},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget violationWidget() {
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 35),
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 0.7, color: AppColor.bgDark),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 16,
|
||||
children: [
|
||||
RTextField(
|
||||
controller: TextEditingController(),
|
||||
label: 'عنوان تخلف',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
),
|
||||
RTextField(
|
||||
controller: TextEditingController(),
|
||||
label: 'توضیحات تخلف',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
maxLines: 3,
|
||||
minLines: 3,
|
||||
),
|
||||
RTextField(
|
||||
controller: TextEditingController(),
|
||||
label: 'عنوان تخلف',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
),
|
||||
RTextField(
|
||||
controller: TextEditingController(),
|
||||
label: 'عنوان تخلف',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
),
|
||||
RTextField(
|
||||
controller: TextEditingController(),
|
||||
label: 'توضیحات تخلف',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
maxLines: 3,
|
||||
minLines: 3,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget markerDetailsWidget() {
|
||||
return Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
margin: EdgeInsets.symmetric(horizontal: 35, vertical: 10),
|
||||
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.center,
|
||||
spacing: 12,
|
||||
children: [
|
||||
Text(
|
||||
'ایجاد بازرسی',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
],
|
||||
),
|
||||
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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget accompanyingInspectorsWidget() {
|
||||
return Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
margin: EdgeInsets.symmetric(horizontal: 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.center,
|
||||
spacing: 12,
|
||||
children: [
|
||||
Text(
|
||||
'بازرس همراه',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'نام و نام خانوادگی',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'آیدا گل محمدی',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
144
packages/inspection/lib/presentation/pages/filter/logic.dart
Normal file
144
packages/inspection/lib/presentation/pages/filter/logic.dart
Normal file
@@ -0,0 +1,144 @@
|
||||
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/pages/filter/view.dart';
|
||||
|
||||
|
||||
class InspectorFilterLogic extends GetxController
|
||||
with GetTickerProviderStateMixin {
|
||||
Rx<LatLng> currentLocation = LatLng(35.824891, 50.948025).obs;
|
||||
RxList<LatLng> allMarkers = <LatLng>[].obs;
|
||||
RxList<LatLng> markers = <LatLng>[].obs;
|
||||
Timer? _debounceTimer;
|
||||
RxBool isLoading = false.obs;
|
||||
|
||||
RxInt filterIndex = 0.obs;
|
||||
RxInt showIndex = 0.obs;
|
||||
bool showSlideHint = true;
|
||||
|
||||
late Rx<SlidableController> slidController;
|
||||
|
||||
Rx<MapController> mapController = MapController().obs;
|
||||
late final AnimatedMapController animatedMapController;
|
||||
|
||||
late DraggableBottomSheetController filterBottomSheetController;
|
||||
late DraggableBottomSheetController selectedLocationBottomSheetController;
|
||||
late DraggableBottomSheetController detailsLocationBottomSheetController;
|
||||
late final BottomSheetManager bottomSheetManager;
|
||||
|
||||
Future<void> determineCurrentPosition() async {
|
||||
final position = await Geolocator.getCurrentPosition(
|
||||
locationSettings: AndroidSettings(accuracy: LocationAccuracy.best),
|
||||
);
|
||||
final latLng = LatLng(position.latitude, position.longitude);
|
||||
|
||||
currentLocation.value = latLng;
|
||||
markers.add(latLng);
|
||||
animatedMapController.animateTo(
|
||||
dest: latLng,
|
||||
zoom: 18,
|
||||
curve: Curves.easeInOut,
|
||||
duration: const Duration(seconds: 1),
|
||||
);
|
||||
}
|
||||
|
||||
void debouncedUpdateVisibleMarkers({required LatLng center}) {
|
||||
_debounceTimer?.cancel();
|
||||
_debounceTimer = Timer(const Duration(milliseconds: 300), () {
|
||||
final filtered = filterNearbyMarkers({
|
||||
'markers': allMarkers,
|
||||
'centerLat': center.latitude,
|
||||
'centerLng': center.longitude,
|
||||
'radius': 2000.0,
|
||||
});
|
||||
|
||||
markers.addAll(filtered);
|
||||
});
|
||||
}
|
||||
|
||||
List<LatLng> filterNearbyMarkers(Map<String, dynamic> args) {
|
||||
final List<LatLng> rawMarkers = args['markers'];
|
||||
final double centerLat = args['centerLat'];
|
||||
final double centerLng = args['centerLng'];
|
||||
final double radiusInMeters = args['radius'];
|
||||
final center = LatLng(centerLat, centerLng);
|
||||
final distance = Distance();
|
||||
|
||||
return rawMarkers
|
||||
.where((marker) => distance(center, marker) <= radiusInMeters)
|
||||
.toList();
|
||||
}
|
||||
|
||||
Future<void> generatedMarkers() async {
|
||||
final generatedMarkers = await generateLocationsUsingCompute(100000);
|
||||
allMarkers.value = generatedMarkers;
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
animatedMapController = AnimatedMapController(
|
||||
vsync: this,
|
||||
duration: const Duration(milliseconds: 500),
|
||||
curve: Curves.easeInOut,
|
||||
cancelPreviousAnimations: true,
|
||||
);
|
||||
|
||||
filterBottomSheetController = DraggableBottomSheetController(
|
||||
initialHeight: 350,
|
||||
minHeight: 200,
|
||||
maxHeight: Get.height * 0.5,
|
||||
);
|
||||
|
||||
selectedLocationBottomSheetController = DraggableBottomSheetController(
|
||||
initialHeight: 200,
|
||||
minHeight: 100,
|
||||
maxHeight: 200,
|
||||
);
|
||||
|
||||
|
||||
detailsLocationBottomSheetController = DraggableBottomSheetController(
|
||||
initialHeight: Get.height * 0.5,
|
||||
minHeight: Get.height * 0.37,
|
||||
maxHeight: Get.height * 0.5,
|
||||
);
|
||||
|
||||
slidController = SlidableController(this).obs;
|
||||
bottomSheetManager = BottomSheetManager({
|
||||
filterBottomSheetController:
|
||||
() => filterWidget(filterIndex: filterIndex, showIndex: showIndex),
|
||||
selectedLocationBottomSheetController:
|
||||
() => selectedLocationWidget(
|
||||
showHint:
|
||||
selectedLocationBottomSheetController.isVisible.value &&
|
||||
showSlideHint,
|
||||
sliderController: slidController.value,
|
||||
trigger: triggerSlidableAnimation,
|
||||
toggle: selectedLocationBottomSheetController.toggle,
|
||||
),
|
||||
detailsLocationBottomSheetController: () => markerDetailsWidget(),
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
determineCurrentPosition();
|
||||
generatedMarkers();
|
||||
}
|
||||
|
||||
Future<void> triggerSlidableAnimation() async {
|
||||
await Future.delayed(Duration(milliseconds: 200));
|
||||
await slidController.value.openEndActionPane();
|
||||
await Future.delayed(Duration(milliseconds: 200));
|
||||
await slidController.value.close();
|
||||
showSlideHint = false;
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
slidController.close();
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
521
packages/inspection/lib/presentation/pages/filter/view.dart
Normal file
521
packages/inspection/lib/presentation/pages/filter/view.dart
Normal file
@@ -0,0 +1,521 @@
|
||||
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';
|
||||
|
||||
class SupervisionFilterPage extends GetView<InspectorFilterLogic> {
|
||||
const SupervisionFilterPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: RAppBar(title: 'نقشه', additionalActions: [_searchButton(), _filterButton()]),
|
||||
body: PopScope(
|
||||
canPop: !controller.bottomSheetManager.isAnyVisible,
|
||||
onPopInvokedWithResult: (didPop, result) {
|
||||
controller.bottomSheetManager.closeFirstVisible();
|
||||
},
|
||||
child: Stack(
|
||||
children: [_buildMap(), _buildGpsButton(), Obx(() => controller.bottomSheetManager.buildVisibleSheet())],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
GestureDetector _searchButton() {
|
||||
return GestureDetector(
|
||||
onTap: () async{
|
||||
|
||||
},
|
||||
child: Assets.vec.searchSvg
|
||||
.svg(width: 24, height: 24, colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn))
|
||||
.paddingOnly(left: 16),
|
||||
);
|
||||
}
|
||||
|
||||
GestureDetector _filterButton() {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
controller.filterBottomSheetController.toggle();
|
||||
},
|
||||
child: Assets.vec.filterSvg
|
||||
.svg(width: 24, height: 24, colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn))
|
||||
.paddingOnly(left: 16),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMap() {
|
||||
return ObxValue((currentLocation) {
|
||||
return FlutterMap(
|
||||
mapController: controller.animatedMapController.mapController,
|
||||
options: MapOptions(
|
||||
initialCenter: currentLocation.value,
|
||||
initialZoom: 18,
|
||||
onPositionChanged: (camera, hasGesture) {
|
||||
controller.debouncedUpdateVisibleMarkers(center: camera.center);
|
||||
},
|
||||
),
|
||||
children: [
|
||||
TileLayer(urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png'),
|
||||
ObxValue((markers) {
|
||||
return MarkerLayer(
|
||||
markers: markers
|
||||
.map(
|
||||
(e) => markerWidget(
|
||||
marker: e,
|
||||
onTap: () {
|
||||
controller.selectedLocationBottomSheetController.isVisible.value = true;
|
||||
},
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
);
|
||||
}, controller.markers),
|
||||
],
|
||||
);
|
||||
}, controller.currentLocation);
|
||||
}
|
||||
|
||||
Widget _buildGpsButton() {
|
||||
return Positioned(
|
||||
right: 10,
|
||||
bottom: 15,
|
||||
child: ObxValue((data) {
|
||||
return RFab(
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
isLoading: data.value,
|
||||
icon: Assets.vec.gpsSvg.svg(width: 28, height: 28),
|
||||
onPressed: () async {
|
||||
controller.isLoading.value = true;
|
||||
await controller.determineCurrentPosition();
|
||||
controller.isLoading.value = false;
|
||||
},
|
||||
);
|
||||
}, controller.isLoading),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Marker markerWidget({required LatLng marker, required VoidCallback onTap}) {
|
||||
return Marker(
|
||||
point: marker,
|
||||
child: GestureDetector(
|
||||
onTap: onTap,
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: SizedBox(width: 36, height: 36, child: Assets.vec.mapMarkerSvg.svg(width: 30, height: 30)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Padding filterWidget({required RxInt filterIndex, required RxInt showIndex}) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Column(
|
||||
spacing: 16,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
spacing: 16,
|
||||
children: [
|
||||
Container(
|
||||
width: 100,
|
||||
height: 64,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.blueLight,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 1, color: AppColor.blackLightHover),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 4,
|
||||
children: [
|
||||
Text('دامداران', style: AppFonts.yekan10),
|
||||
Text('183 عدد', style: AppFonts.yekan13Bold),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 100,
|
||||
height: 64,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.greenLight,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 1, color: AppColor.blackLightHover),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 4,
|
||||
children: [
|
||||
Text('مرغداران', style: AppFonts.yekan10),
|
||||
Text('183 عدد', style: AppFonts.yekan13Bold),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 100,
|
||||
height: 64,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.blueLight,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 1, color: AppColor.blackLightHover),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 4,
|
||||
children: [
|
||||
Text('اصناف', style: AppFonts.yekan10),
|
||||
Text('183 عدد', style: AppFonts.yekan13Bold),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 12,
|
||||
children: [
|
||||
Text(
|
||||
'فیلتر نمایش',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan13.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
ObxValue((data) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
spacing: 8,
|
||||
children: [
|
||||
customChip(
|
||||
isSelected: data.value == 0,
|
||||
onTap: (data) {
|
||||
filterIndex.value = data;
|
||||
},
|
||||
index: 0,
|
||||
title: 'دامداران',
|
||||
),
|
||||
customChip(
|
||||
isSelected: data.value == 1,
|
||||
title: 'مرغداران',
|
||||
onTap: (data) {
|
||||
filterIndex.value = data;
|
||||
},
|
||||
index: 1,
|
||||
),
|
||||
customChip(
|
||||
isSelected: data.value == 2,
|
||||
title: 'اصناف',
|
||||
onTap: (data) {
|
||||
filterIndex.value = data;
|
||||
},
|
||||
index: 2,
|
||||
),
|
||||
],
|
||||
);
|
||||
}, filterIndex),
|
||||
],
|
||||
),
|
||||
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 12,
|
||||
children: [
|
||||
Text(
|
||||
'نمایش',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan13.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
ObxValue((data) {
|
||||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
spacing: 8,
|
||||
children: [
|
||||
customChip(
|
||||
isSelected: data.value == 0,
|
||||
title: 'نمایش همه',
|
||||
onTap: (data) {
|
||||
showIndex.value = data;
|
||||
},
|
||||
index: 0,
|
||||
),
|
||||
customChip(
|
||||
isSelected: data.value == 1,
|
||||
title: 'دارای تراکنش',
|
||||
onTap: (data) {
|
||||
showIndex.value = data;
|
||||
},
|
||||
index: 1,
|
||||
),
|
||||
customChip(
|
||||
isSelected: data.value == 2,
|
||||
title: 'بازرسی شده ها',
|
||||
onTap: (data) {
|
||||
showIndex.value = data;
|
||||
},
|
||||
index: 2,
|
||||
),
|
||||
customChip(
|
||||
isSelected: data.value == 3,
|
||||
title: 'بازرسی نشده ها',
|
||||
onTap: (data) {
|
||||
showIndex.value = data;
|
||||
},
|
||||
index: 3,
|
||||
),
|
||||
customChip(
|
||||
isSelected: data.value == 4,
|
||||
title: 'متخلفین',
|
||||
onTap: (data) {
|
||||
showIndex.value = data;
|
||||
},
|
||||
index: 4,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}, showIndex),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
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 selectedLocationWidget({
|
||||
required bool showHint,
|
||||
required SlidableController sliderController,
|
||||
required VoidCallback trigger,
|
||||
required VoidCallback toggle,
|
||||
}) {
|
||||
eLog(showHint);
|
||||
if (showHint) {
|
||||
trigger.call();
|
||||
}
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20),
|
||||
child: Slidable(
|
||||
key: Key('selectedLocationWidget'),
|
||||
controller: sliderController,
|
||||
endActionPane: ActionPane(
|
||||
motion: StretchMotion(),
|
||||
children: [
|
||||
CustomSlidableAction(
|
||||
onPressed: (context) {
|
||||
Get.toNamed(InspectionRoutes.inspectionLocationDetails);
|
||||
},
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
foregroundColor: Colors.white,
|
||||
padding: EdgeInsets.all(16),
|
||||
borderRadius: BorderRadius.only(bottomRight: Radius.circular(8), topRight: Radius.circular(8)),
|
||||
child: Assets.vec.mapSvg.svg(width: 24, height: 24),
|
||||
),
|
||||
CustomSlidableAction(
|
||||
onPressed: (context) {
|
||||
Get.toNamed(InspectionRoutes.inspectionAddSupervision);
|
||||
},
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Assets.vec.messageAddSvg.svg(),
|
||||
),
|
||||
CustomSlidableAction(
|
||||
onPressed: (context) {},
|
||||
backgroundColor: AppColor.warning,
|
||||
padding: EdgeInsets.all(16),
|
||||
borderRadius: BorderRadius.only(bottomLeft: Radius.circular(8), topLeft: Radius.circular(8)),
|
||||
child: Assets.vec.securityTimeSvg.svg(),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: GestureDetector(
|
||||
onTap: toggle,
|
||||
child: Container(
|
||||
height: 58,
|
||||
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(
|
||||
children: [
|
||||
Text('داود خرم مهری پور', style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)),
|
||||
Text('گوشت و مرغ', style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover)),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text('باقی مانده', style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)),
|
||||
Text('0 کیلوگرم', style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover)),
|
||||
],
|
||||
),
|
||||
Assets.vec.scanBarcodeSvg.svg(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
|
||||
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/widget/base_page/logic.dart';
|
||||
|
||||
import '../filter/view.dart';
|
||||
|
||||
class InspectionMapLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
|
||||
final BaseLogic baseLogic = Get.find<BaseLogic>();
|
||||
|
||||
Rx<LatLng> currentLocation = LatLng(35.824891, 50.948025).obs;
|
||||
RxList<LatLng> allMarkers = <LatLng>[].obs;
|
||||
RxList<LatLng> markers = <LatLng>[].obs;
|
||||
Timer? _debounceTimer;
|
||||
RxBool isLoading = false.obs;
|
||||
RxBool isSelectedDetailsLocation = false.obs;
|
||||
|
||||
RxInt filterIndex = 0.obs;
|
||||
RxInt showIndex = 0.obs;
|
||||
bool showSlideHint = true;
|
||||
|
||||
late Rx<SlidableController> slidController;
|
||||
|
||||
Rx<MapController> mapController = MapController().obs;
|
||||
late final AnimatedMapController animatedMapController;
|
||||
|
||||
late DraggableBottomSheetController filterBottomSheetController;
|
||||
late DraggableBottomSheetController selectedLocationBottomSheetController;
|
||||
late DraggableBottomSheetController detailsLocationBottomSheetController;
|
||||
late final BottomSheetManager bottomSheetManager;
|
||||
|
||||
Future<void> determineCurrentPosition() async {
|
||||
isLoading.value = true;
|
||||
final position = await Geolocator.getCurrentPosition(
|
||||
locationSettings: AndroidSettings(accuracy: LocationAccuracy.best),
|
||||
);
|
||||
final latLng = LatLng(position.latitude, position.longitude);
|
||||
|
||||
currentLocation.value = latLng;
|
||||
markers.add(latLng);
|
||||
animatedMapController.animateTo(
|
||||
dest: latLng,
|
||||
zoom: 18,
|
||||
curve: Curves.easeInOut,
|
||||
duration: const Duration(seconds: 1),
|
||||
);
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
void debouncedUpdateVisibleMarkers({required LatLng center}) {
|
||||
_debounceTimer?.cancel();
|
||||
_debounceTimer = Timer(const Duration(milliseconds: 300), () {
|
||||
final filtered = filterNearbyMarkers({
|
||||
'markers': allMarkers,
|
||||
'centerLat': center.latitude,
|
||||
'centerLng': center.longitude,
|
||||
'radius': 2000.0,
|
||||
});
|
||||
|
||||
markers.addAll(filtered);
|
||||
});
|
||||
}
|
||||
|
||||
List<LatLng> filterNearbyMarkers(Map<String, dynamic> args) {
|
||||
final List<LatLng> rawMarkers = args['markers'];
|
||||
final double centerLat = args['centerLat'];
|
||||
final double centerLng = args['centerLng'];
|
||||
final double radiusInMeters = args['radius'];
|
||||
final center = LatLng(centerLat, centerLng);
|
||||
final distance = Distance();
|
||||
|
||||
return rawMarkers
|
||||
.where((marker) => distance(center, marker) <= radiusInMeters)
|
||||
.toList();
|
||||
}
|
||||
|
||||
Future<void> generatedMarkers() async {
|
||||
final generatedMarkers = await generateLocationsUsingCompute(100000);
|
||||
allMarkers.value = generatedMarkers;
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
animatedMapController = AnimatedMapController(
|
||||
vsync: this,
|
||||
duration: const Duration(milliseconds: 500),
|
||||
curve: Curves.easeInOut,
|
||||
cancelPreviousAnimations: true,
|
||||
);
|
||||
|
||||
filterBottomSheetController = DraggableBottomSheetController(
|
||||
initialHeight: 350,
|
||||
minHeight: 200,
|
||||
maxHeight: Get.height * 0.5,
|
||||
);
|
||||
|
||||
selectedLocationBottomSheetController = DraggableBottomSheetController(
|
||||
initialHeight: 200,
|
||||
minHeight: 100,
|
||||
maxHeight: 200,
|
||||
);
|
||||
|
||||
|
||||
detailsLocationBottomSheetController = DraggableBottomSheetController(
|
||||
initialHeight: Get.height * 0.5,
|
||||
minHeight: Get.height * 0.37,
|
||||
maxHeight: Get.height * 0.5,
|
||||
);
|
||||
|
||||
slidController = SlidableController(this).obs;
|
||||
bottomSheetManager = BottomSheetManager({
|
||||
filterBottomSheetController:
|
||||
() => filterWidget(filterIndex: filterIndex, showIndex: showIndex),
|
||||
selectedLocationBottomSheetController:
|
||||
() => selectedLocationWidget(
|
||||
showHint:
|
||||
selectedLocationBottomSheetController.isVisible.value &&
|
||||
showSlideHint,
|
||||
sliderController: slidController.value,
|
||||
trigger: triggerSlidableAnimation,
|
||||
toggle: selectedLocationBottomSheetController.toggle,
|
||||
),
|
||||
detailsLocationBottomSheetController: () => markerDetailsWidget(),
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
determineCurrentPosition();
|
||||
generatedMarkers();
|
||||
}
|
||||
|
||||
Future<void> triggerSlidableAnimation() async {
|
||||
await Future.delayed(Duration(milliseconds: 200));
|
||||
await slidController.value.openEndActionPane();
|
||||
await Future.delayed(Duration(milliseconds: 200));
|
||||
await slidController.value.close();
|
||||
showSlideHint = false;
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
slidController.close();
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,621 @@
|
||||
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/custom_chips.dart';
|
||||
import 'package:rasadyar_inspection/presentation/widget/search.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class InspectionMapPage extends GetView<InspectionMapLogic> {
|
||||
const InspectionMapPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BasePage(
|
||||
hasSearch: true,
|
||||
hasFilter: true,
|
||||
hasBack: false,
|
||||
|
||||
defaultSearch: false,
|
||||
filteringWidget: filterWidget(showIndex: 3.obs, filterIndex: 5.obs),
|
||||
onSearchTap: () {
|
||||
controller.baseLogic.isSearchSelected.value = !controller.baseLogic.isSearchSelected.value;
|
||||
},
|
||||
|
||||
widgets: [_buildMap()],
|
||||
floatingActionButton: _buildGpsButton(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMap() {
|
||||
return Expanded(
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
ObxValue((currentLocation) {
|
||||
return FlutterMap(
|
||||
mapController: controller.animatedMapController.mapController,
|
||||
options: MapOptions(
|
||||
initialCenter: currentLocation.value,
|
||||
initialZoom: 18,
|
||||
onPositionChanged: (camera, hasGesture) {
|
||||
controller.debouncedUpdateVisibleMarkers(center: camera.center);
|
||||
},
|
||||
),
|
||||
children: [
|
||||
TileLayer(
|
||||
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
userAgentPackageName: 'ir.mnpc.rasadyar',
|
||||
),
|
||||
ObxValue((markers) {
|
||||
return MarkerLayer(
|
||||
markers: markers
|
||||
.map(
|
||||
(e) => markerWidget(
|
||||
marker: e,
|
||||
onTap: () {
|
||||
Get.bottomSheet(
|
||||
selectedLocationWidget2(
|
||||
showHint: false,
|
||||
sliderController: controller.slidController.value,
|
||||
trigger: () {},
|
||||
toggle: () {},
|
||||
),
|
||||
isScrollControlled: true,
|
||||
enableDrag: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
);
|
||||
}, controller.markers),
|
||||
],
|
||||
);
|
||||
}, controller.currentLocation),
|
||||
|
||||
Positioned(
|
||||
top: 10,
|
||||
left: 20,
|
||||
right: 20,
|
||||
child: ObxValue((data) {
|
||||
if (data.value) {
|
||||
return SearchWidget(
|
||||
onSearchChanged: (data) {
|
||||
controller.baseLogic.searchValue.value = data;
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
}, controller.baseLogic.isSearchSelected),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildGpsButton() {
|
||||
return ObxValue((data) {
|
||||
return RFab(
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
isLoading: data.value,
|
||||
icon: Assets.vec.gpsSvg.svg(width: 40.w, height: 40.h),
|
||||
onPressed: () async => await controller.determineCurrentPosition(),
|
||||
);
|
||||
}, controller.isLoading);
|
||||
}
|
||||
|
||||
Widget selectedLocationWidget2({
|
||||
required bool showHint,
|
||||
required SlidableController sliderController,
|
||||
required VoidCallback trigger,
|
||||
required VoidCallback toggle,
|
||||
}) {
|
||||
return ObxValue((data) {
|
||||
return BaseBottomSheet(
|
||||
height: data.value ? 450.h : 150.h,
|
||||
child: ListItemWithOutCounter(
|
||||
secondChild: 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'),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 7,
|
||||
children: [
|
||||
RElevated(
|
||||
width: 40.h,
|
||||
height: 38.h,
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
child: Assets.vec.messageAddSvg.svg(
|
||||
width: 24.w,
|
||||
height: 24.h,
|
||||
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||
),
|
||||
onPressed: () {},
|
||||
),
|
||||
RElevated(
|
||||
width: 150.w,
|
||||
height: 40.h,
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
onPressed: () {
|
||||
/*controller.setEditData(item);
|
||||
Get.bottomSheet(
|
||||
addOrEditBottomSheet(true),
|
||||
isScrollControlled: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
).whenComplete(() {
|
||||
|
||||
});*/
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
spacing: 8,
|
||||
children: [
|
||||
Assets.vec.mapSvg.svg(
|
||||
width: 24.w,
|
||||
height: 24.h,
|
||||
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||
),
|
||||
Text(
|
||||
'مسیریابی',
|
||||
style: AppFonts.yekan14Bold.copyWith(color: Colors.white),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
ROutlinedElevated(
|
||||
width: 150.w,
|
||||
height: 40.h,
|
||||
onPressed: () {
|
||||
buildDeleteDialog(onConfirm: () async {}, onRefresh: () async {});
|
||||
},
|
||||
borderColor: AppColor.bgIcon,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 8,
|
||||
children: [
|
||||
Assets.vec.securityTimeSvg.svg(
|
||||
width: 24.w,
|
||||
height: 24.h,
|
||||
colorFilter: ColorFilter.mode(AppColor.bgIcon, BlendMode.srcIn),
|
||||
),
|
||||
Text(
|
||||
'سوابق بازرسی',
|
||||
style: AppFonts.yekan14Bold.copyWith(color: AppColor.bgIcon),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
labelColor: AppColor.blueLight,
|
||||
labelIcon: Assets.vec.cowSvg.path,
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Marker markerWidget({required LatLng marker, required VoidCallback onTap}) {
|
||||
return Marker(
|
||||
point: marker,
|
||||
child: GestureDetector(
|
||||
onTap: onTap,
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: SizedBox(
|
||||
width: 36,
|
||||
height: 36,
|
||||
child: Assets.vec.mapMarkerSvg.svg(width: 30, height: 30),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget filterWidget({required RxInt filterIndex, required RxInt showIndex}) {
|
||||
return BaseBottomSheet(
|
||||
height: Get.height * 0.5,
|
||||
child: Column(
|
||||
spacing: 16,
|
||||
children: [
|
||||
SizedBox(height: 1),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
spacing: 16,
|
||||
children: [
|
||||
cardWithLabel(
|
||||
title: 'اصناف',
|
||||
count: 1234567,
|
||||
icon: Assets.vec.shopSvg.svg(width: 24.w, height: 24.h),
|
||||
backgroundColor: AppColor.greenLight,
|
||||
backgroundBadgeColor: AppColor.greenLightActive,
|
||||
),
|
||||
cardWithLabel(
|
||||
title: 'دامداران',
|
||||
count: 1234567,
|
||||
icon: Assets.vec.peopleSvg.svg(width: 24.w, height: 24.h),
|
||||
|
||||
backgroundColor: AppColor.blueLight,
|
||||
backgroundBadgeColor: AppColor.blueLightActive,
|
||||
),
|
||||
cardWithLabel(
|
||||
title: 'مرغداران',
|
||||
count: 1234567,
|
||||
icon: Assets.vec.profile2Svg.svg(width: 24.w, height: 24.h),
|
||||
backgroundColor: AppColor.redLight,
|
||||
backgroundBadgeColor: AppColor.redLightActive,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 12,
|
||||
children: [
|
||||
Text(
|
||||
'فیلتر نمایش',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan13.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
ObxValue((data) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
spacing: 8,
|
||||
children: [
|
||||
customChip(
|
||||
isSelected: data.value == 0,
|
||||
onTap: (data) {
|
||||
filterIndex.value = data;
|
||||
},
|
||||
index: 0,
|
||||
title: 'دامداران',
|
||||
),
|
||||
customChip(
|
||||
isSelected: data.value == 1,
|
||||
title: 'مرغداران',
|
||||
onTap: (data) {
|
||||
filterIndex.value = data;
|
||||
},
|
||||
index: 1,
|
||||
),
|
||||
customChip(
|
||||
isSelected: data.value == 2,
|
||||
title: 'اصناف',
|
||||
onTap: (data) {
|
||||
filterIndex.value = data;
|
||||
},
|
||||
index: 2,
|
||||
),
|
||||
],
|
||||
);
|
||||
}, filterIndex),
|
||||
],
|
||||
),
|
||||
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 12,
|
||||
children: [
|
||||
Text(
|
||||
'نمایش',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan13.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
ObxValue((data) {
|
||||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
spacing: 8,
|
||||
children: [
|
||||
customChip(
|
||||
isSelected: data.value == 0,
|
||||
title: 'نمایش همه',
|
||||
onTap: (data) {
|
||||
showIndex.value = data;
|
||||
},
|
||||
index: 0,
|
||||
),
|
||||
customChip(
|
||||
isSelected: data.value == 1,
|
||||
title: 'دارای تراکنش',
|
||||
onTap: (data) {
|
||||
showIndex.value = data;
|
||||
},
|
||||
index: 1,
|
||||
),
|
||||
|
||||
customChip(
|
||||
isSelected: data.value == 2,
|
||||
title: 'بازرسی شده ها',
|
||||
onTap: (data) {
|
||||
showIndex.value = data;
|
||||
},
|
||||
index: 2,
|
||||
),
|
||||
customChip(
|
||||
isSelected: data.value == 3,
|
||||
title: 'بازرسی نشده ها',
|
||||
onTap: (data) {
|
||||
showIndex.value = data;
|
||||
},
|
||||
index: 3,
|
||||
),
|
||||
customChip(
|
||||
isSelected: data.value == 4,
|
||||
title: 'متخلفین',
|
||||
onTap: (data) {
|
||||
showIndex.value = data;
|
||||
},
|
||||
index: 4,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}, showIndex),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget cardWithLabel({
|
||||
required String title,
|
||||
required int count,
|
||||
String unit = 'عدد',
|
||||
required Widget icon,
|
||||
required Color backgroundColor,
|
||||
required Color backgroundBadgeColor,
|
||||
}) {
|
||||
return SizedBox(
|
||||
width: 114.w,
|
||||
height: 115.h,
|
||||
child: Stack(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
alignment: Alignment.topCenter,
|
||||
children: [
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
left: 0,
|
||||
child: Container(
|
||||
width: 114.w,
|
||||
height: 91.h,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: backgroundColor,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 0.25, color: AppColor.blackLightHover),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 6,
|
||||
children: [
|
||||
Text(title, style: AppFonts.yekan12.copyWith(color: AppColor.textColor)),
|
||||
Text(
|
||||
count.separatedByComma,
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
Text(unit, style: AppFonts.yekan12.copyWith(color: AppColor.textColor)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 5.h,
|
||||
child: Container(
|
||||
width: 32.w,
|
||||
height: 32.h,
|
||||
padding: EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
color: backgroundBadgeColor,
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
border: Border.all(color: AppColor.borderColor, width: 0.25),
|
||||
),
|
||||
child: Center(child: icon),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget selectedLocationWidget({
|
||||
required bool showHint,
|
||||
required SlidableController sliderController,
|
||||
required VoidCallback trigger,
|
||||
required VoidCallback toggle,
|
||||
}) {
|
||||
if (showHint) {
|
||||
trigger.call();
|
||||
}
|
||||
return BaseBottomSheet(
|
||||
height: 150.h,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20),
|
||||
child: Slidable(
|
||||
key: Key('selectedLocationWidget'),
|
||||
controller: sliderController,
|
||||
endActionPane: ActionPane(
|
||||
motion: StretchMotion(),
|
||||
children: [
|
||||
CustomSlidableAction(
|
||||
onPressed: (context) {
|
||||
Get.toNamed(InspectionRoutes.inspectionLocationDetails);
|
||||
},
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
foregroundColor: Colors.white,
|
||||
padding: EdgeInsets.all(16),
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomRight: Radius.circular(8),
|
||||
topRight: Radius.circular(8),
|
||||
),
|
||||
child: Assets.vec.mapSvg.svg(width: 24, height: 24),
|
||||
),
|
||||
CustomSlidableAction(
|
||||
onPressed: (context) {
|
||||
Get.toNamed(InspectionRoutes.inspectionAddSupervision);
|
||||
},
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Assets.vec.messageAddSvg.svg(),
|
||||
),
|
||||
CustomSlidableAction(
|
||||
onPressed: (context) {},
|
||||
backgroundColor: AppColor.warning,
|
||||
padding: EdgeInsets.all(16),
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(8),
|
||||
topLeft: Radius.circular(8),
|
||||
),
|
||||
child: Assets.vec.securityTimeSvg.svg(),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: GestureDetector(
|
||||
onTap: toggle,
|
||||
child: Container(
|
||||
height: 58,
|
||||
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(
|
||||
children: [
|
||||
Text(
|
||||
'داود خرم مهری پور',
|
||||
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
Text(
|
||||
'گوشت و مرغ',
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
'باقی مانده',
|
||||
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
Text(
|
||||
'0 کیلوگرم',
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover),
|
||||
),
|
||||
],
|
||||
),
|
||||
Assets.vec.scanBarcodeSvg.svg(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class LocationDetailsLogic extends GetxController {
|
||||
RxInt selectedSegment = 0.obs;
|
||||
|
||||
// The data for the segments
|
||||
final Map<int, Widget> segments = {
|
||||
0: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(50)),
|
||||
child: Text('همه', style: AppFonts.yekan13),
|
||||
),
|
||||
1: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(50)),
|
||||
child: Text('بر اساس تاریخ', style: AppFonts.yekan13),
|
||||
),
|
||||
};
|
||||
|
||||
RxBool seletected = false.obs;
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,254 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_core/presentation/utils/color_utils.dart';
|
||||
import 'package:rasadyar_core/presentation/widget/tabs/new_tab.dart';
|
||||
import 'logic.dart';
|
||||
|
||||
class LocationDetailsPage extends GetView<LocationDetailsLogic> {
|
||||
const LocationDetailsPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColor.lightGreyLight,
|
||||
appBar: RAppBar(title: 'جزئیات محل'),
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 22),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
headerInfo(description: 'ایداگل محمدی', title: 'نام مالک'),
|
||||
|
||||
headerInfo(
|
||||
description: '09415115545',
|
||||
title: 'شماره همراه',
|
||||
background: AppColor.green1Light,
|
||||
),
|
||||
|
||||
headerInfo(description: '183کیلوگرم', title: 'موجودی'),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(22, 13, 22, 4),
|
||||
child: Text(
|
||||
'نوع دریافت',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan13.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
),
|
||||
|
||||
ObxValue((data) {
|
||||
return NewCupertinoSegmentedControl<int>(
|
||||
padding: EdgeInsetsDirectional.symmetric(
|
||||
horizontal: 20,
|
||||
vertical: 10,
|
||||
),
|
||||
children: controller.segments,
|
||||
groupValue: data.value,
|
||||
selectedColor: AppColor.blueNormal,
|
||||
unselectedColor: Colors.white,
|
||||
borderColor: Colors.grey.shade300,
|
||||
onValueChanged: (int value) {
|
||||
data.value = value;
|
||||
},
|
||||
);
|
||||
}, controller.selectedSegment),
|
||||
Container(
|
||||
height: 32,
|
||||
margin: EdgeInsets.only(top: 10, left: 22, right: 22),
|
||||
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
spacing: 10,
|
||||
children: [
|
||||
Expanded(
|
||||
child: ROutlinedElevatedIcon(
|
||||
icon: FaIcon(FontAwesomeIcons.calendar),
|
||||
onPressed:() async {
|
||||
|
||||
Jalali? picked = await showPersianDatePicker(
|
||||
context: context,
|
||||
initialDate: Jalali.now(),
|
||||
firstDate: Jalali(1385, 8),
|
||||
lastDate: Jalali(1450, 9),
|
||||
|
||||
initialEntryMode:
|
||||
PersianDatePickerEntryMode.calendarOnly,
|
||||
initialDatePickerMode: PersianDatePickerMode.day,
|
||||
);
|
||||
},
|
||||
text: 'از تاریخ',
|
||||
textStyle: AppFonts.yekan16.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ROutlinedElevatedIcon(
|
||||
icon: FaIcon(FontAwesomeIcons.calendar),
|
||||
onPressed: () async {
|
||||
|
||||
Jalali? picked = await showPersianDatePicker(
|
||||
context: context,
|
||||
initialDate: Jalali.now(),
|
||||
firstDate: Jalali(1385, 8),
|
||||
lastDate: Jalali(1450, 9),
|
||||
|
||||
initialEntryMode:
|
||||
PersianDatePickerEntryMode.calendarOnly,
|
||||
initialDatePickerMode: PersianDatePickerMode.day,
|
||||
);
|
||||
},
|
||||
text: 'تا تاریخ',
|
||||
textStyle: AppFonts.yekan16.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: Divider()),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
||||
margin: EdgeInsets.symmetric(horizontal: 2),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: ShapeDecoration(
|
||||
color: AppColor.blueNormal.disabledColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(60),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'تعداد کل تراکنش ها : 0',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan10,
|
||||
),
|
||||
),
|
||||
Expanded(child: Divider()),
|
||||
],
|
||||
),
|
||||
|
||||
Expanded(
|
||||
child: GridView.builder(
|
||||
itemCount: 51,
|
||||
physics: BouncingScrollPhysics(),
|
||||
padding: EdgeInsets.fromLTRB(20, 14, 20, 50),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
crossAxisSpacing: 8,
|
||||
mainAxisSpacing: 8,
|
||||
),
|
||||
itemBuilder:
|
||||
(context, index) => Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: ShapeDecoration(
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
width: 1,
|
||||
color: const Color(0xFFEFEFEF),
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 22,
|
||||
vertical: 21,
|
||||
),
|
||||
child: Column(
|
||||
spacing: 6,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'${index + 1}- تراکنش موفق',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan10,
|
||||
),
|
||||
SizedBox(height: 2),
|
||||
Text(
|
||||
'1403/12/12',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12,
|
||||
),
|
||||
|
||||
Text(
|
||||
'محصول : مرغ',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.lightGreyNormalActive,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'وزن : 5555 گرم',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.lightGreyNormalActive,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'مبلغ : 14،000،000',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.lightGreyNormalActive,
|
||||
),
|
||||
),
|
||||
|
||||
Text(
|
||||
'سرویس سامان کیش',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
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),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
22
packages/inspection/lib/presentation/pages/pages.dart
Normal file
22
packages/inspection/lib/presentation/pages/pages.dart
Normal 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';
|
||||
@@ -0,0 +1,33 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class ProfileLogic extends GetxController {
|
||||
|
||||
|
||||
List<String> roles = <String>[
|
||||
'کاربر عادی',
|
||||
'کاربر ویژه',
|
||||
'کاربر VIP',
|
||||
'کاربر نقره ای',
|
||||
'کاربر طلایی',
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
RxInt selectedRole = 0.obs;
|
||||
RxInt selectedInformationType = 0.obs;
|
||||
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
262
packages/inspection/lib/presentation/pages/profile/view.dart
Normal file
262
packages/inspection/lib/presentation/pages/profile/view.dart
Normal file
@@ -0,0 +1,262 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class ProfilePage extends GetView<ProfileLogic> {
|
||||
const ProfilePage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
spacing: 30,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: Get.height * 0.3,
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
alignment: Alignment.center,
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Assets.vec.bgHeaderUserProfileSvg.svg(),
|
||||
Positioned(
|
||||
bottom: -20,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: SizedBox(
|
||||
width: 110,
|
||||
height: 110,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: AppColor.blueLightHover,
|
||||
child: FaIcon(
|
||||
FontAwesomeIcons.user,
|
||||
size: 45,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 16,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 75,
|
||||
child: ListView.separated(
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.all(16),
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemBuilder:
|
||||
(context, index) => ObxValue((data) {
|
||||
return ChoiceChip(
|
||||
onSelected: (value) {
|
||||
data.value = index;
|
||||
},
|
||||
selectedColor: AppColor.blueNormal,
|
||||
labelStyle:
|
||||
data.value == index
|
||||
? AppFonts.yekan13.copyWith(
|
||||
color: AppColor.whiteLight,
|
||||
)
|
||||
: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.darkGreyNormalActive,
|
||||
),
|
||||
checkmarkColor: Colors.white,
|
||||
label: Text(controller.roles[index]),
|
||||
selected: index == data.value,
|
||||
);
|
||||
}, controller.selectedRole),
|
||||
|
||||
separatorBuilder: (context, index) => SizedBox(width: 8),
|
||||
itemCount: controller.roles.length,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 30,
|
||||
vertical: 10,
|
||||
),
|
||||
child: ObxValue((data) {
|
||||
return switch (data.value) {
|
||||
0 => userProfileInformation(),
|
||||
1 => bankInformationWidget(),
|
||||
2 => invoiceIssuanceInformation(),
|
||||
int() => Placeholder(),
|
||||
};
|
||||
}, controller.selectedInformationType),
|
||||
),
|
||||
),
|
||||
|
||||
ObxValue((data) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Wrap(
|
||||
spacing: 20,
|
||||
runSpacing: 10,
|
||||
children: [
|
||||
cardActionWidget(
|
||||
title: 'اطلاعات کاربری',
|
||||
onPressed: () {
|
||||
data.value = 0;
|
||||
},
|
||||
icon: Assets.vec.profileUserSvg.path,
|
||||
selected: data.value == 0,
|
||||
),
|
||||
cardActionWidget(
|
||||
title: 'اطلاعات بانکی',
|
||||
onPressed: () {
|
||||
data.value = 1;
|
||||
},
|
||||
icon: Assets.vec.informationSvg.path,
|
||||
selected: data.value == 1,
|
||||
),
|
||||
cardActionWidget(
|
||||
title: 'اطلاعات \nصدور فاکتور',
|
||||
onPressed: () {
|
||||
data.value = 2;
|
||||
},
|
||||
icon: Assets.vec.receiptDiscountSvg.path,
|
||||
selected: data.value == 2,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}, controller.selectedInformationType),
|
||||
|
||||
SizedBox(height: 100),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Container invoiceIssuanceInformation() => Container();
|
||||
|
||||
Widget bankInformationWidget() => Column(
|
||||
spacing: 16,
|
||||
children: [
|
||||
itemList(title: 'نام بانک', content: 'سامان'),
|
||||
itemList(title: 'نام صاحب حساب', content: 'رضا رضایی'),
|
||||
itemList(title: 'شماره کارت ', content: '54154545415'),
|
||||
itemList(title: 'شماره حساب', content: '62565263263652'),
|
||||
itemList(title: 'شماره شبا', content: '62565263263652'),
|
||||
],
|
||||
);
|
||||
|
||||
Column userProfileInformation() {
|
||||
return Column(
|
||||
spacing: 10,
|
||||
children: [
|
||||
itemList(
|
||||
title: 'نام و نام خانوادگی',
|
||||
content: 'آیدا گل محمدی',
|
||||
icon: Assets.vec.userSvg.path,
|
||||
),
|
||||
itemList(
|
||||
title: 'موبایل',
|
||||
content: '09302654896',
|
||||
icon: Assets.vec.callSvg.path,
|
||||
),
|
||||
itemList(
|
||||
title: 'کدملی',
|
||||
content: 'نا مشخص',
|
||||
icon: Assets.vec.tagUserSvg.path,
|
||||
),
|
||||
itemList(
|
||||
title: 'شماره شناسنامه',
|
||||
content: 'نا مشخص',
|
||||
icon: Assets.vec.userSquareSvg.path,
|
||||
),
|
||||
itemList(
|
||||
title: 'تاریخ تولد',
|
||||
content: '1404/10/12',
|
||||
icon: Assets.vec.calendarSvg.path,
|
||||
),
|
||||
itemList(
|
||||
title: 'استان',
|
||||
content: 'لرستان',
|
||||
icon: Assets.vec.pictureFrameSvg.path,
|
||||
),
|
||||
itemList(
|
||||
title: 'شهر',
|
||||
content: 'خرم آباد',
|
||||
icon: Assets.vec.mapSvg.path,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget itemList({
|
||||
required String title,
|
||||
required String content,
|
||||
String? icon,
|
||||
}) => Row(
|
||||
spacing: 4,
|
||||
children: [
|
||||
if (icon != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: SvgGenImage.vec(icon).svg(
|
||||
width: 20,
|
||||
height: 20,
|
||||
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
||||
),
|
||||
),
|
||||
Text(title, style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal)),
|
||||
Spacer(),
|
||||
Text(
|
||||
content,
|
||||
style: AppFonts.yekan13.copyWith(color: AppColor.darkGreyNormalHover),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Widget cardActionWidget({
|
||||
required String title,
|
||||
required VoidCallback onPressed,
|
||||
required String icon,
|
||||
bool selected = false,
|
||||
}) {
|
||||
return GestureDetector(
|
||||
onTap: onPressed,
|
||||
child: Column(
|
||||
spacing: 4,
|
||||
children: [
|
||||
Container(
|
||||
width: 52,
|
||||
height: 52,
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: ShapeDecoration(
|
||||
color: selected ? AppColor.blueLightActive : AppColor.blueLight,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: SvgGenImage.vec(icon).svg(
|
||||
width: 40,
|
||||
height: 40,
|
||||
colorFilter: ColorFilter.mode(
|
||||
selected ? AppColor.whiteLight : AppColor.blueNormal,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 2),
|
||||
Text(
|
||||
title,
|
||||
style: AppFonts.yekan10.copyWith(
|
||||
color: selected ? AppColor.blueNormal : AppColor.blueLightActive,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
184
packages/inspection/lib/presentation/pages/records/view.dart
Normal file
184
packages/inspection/lib/presentation/pages/records/view.dart
Normal 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,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class RegistrationOfViolationLogic extends GetxController {
|
||||
RxInt countViolation = 1.obs;
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_inspection/presentation/routes/app_routes.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class RegistrationOfViolationPage extends GetView<RegistrationOfViolationLogic> {
|
||||
const RegistrationOfViolationPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColor.bgLight,
|
||||
appBar: RAppBar(
|
||||
title: 'ثبت تخلف',
|
||||
leading: Assets.vec.messageAddSvg.svg(
|
||||
width: 16,
|
||||
height: 16,
|
||||
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||
),
|
||||
additionalActions: [RFab.smallAdd(onPressed: () => controller.countViolation.value++)],
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ObxValue((data) {
|
||||
return ListView.separated(
|
||||
itemBuilder: (context, index) => violationWidget22(),
|
||||
separatorBuilder: (context, index) => SizedBox(height: 15),
|
||||
itemCount: data.value,
|
||||
);
|
||||
}, controller.countViolation),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 4, 0, 25),
|
||||
child: RElevated(
|
||||
text: 'مرحله بعد',
|
||||
onPressed: () {
|
||||
Get.toNamed(InspectionRoutes.inspectionDisplayInformation);
|
||||
},
|
||||
isFullWidth: true,
|
||||
height: 40,
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
textStyle: AppFonts.yekan16.copyWith(color: Colors.white),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Container violationWidget22() {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 0.7, color: AppColor.bgDark),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 16,
|
||||
children: [
|
||||
RTextField(
|
||||
controller: TextEditingController(),
|
||||
label: 'عنوان تخلف',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
),
|
||||
RTextField(
|
||||
controller: TextEditingController(),
|
||||
label: 'توضیحات تخلف',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
maxLines: 3,
|
||||
minLines: 3,
|
||||
),
|
||||
RTextField(
|
||||
controller: TextEditingController(),
|
||||
label: 'عنوان تخلف',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
),
|
||||
RTextField(
|
||||
controller: TextEditingController(),
|
||||
label: 'عنوان تخلف',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
),
|
||||
RTextField(
|
||||
controller: TextEditingController(),
|
||||
label: 'توضیحات تخلف',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
maxLines: 3,
|
||||
minLines: 3,
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: 40,
|
||||
child: Row(
|
||||
spacing: 16,
|
||||
children: [
|
||||
Expanded(
|
||||
child: RElevated(text: 'ثبت', onPressed: () {}),
|
||||
),
|
||||
Expanded(
|
||||
child: ROutlinedElevated(text: 'انصراف', onPressed: () {}),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
89
packages/inspection/lib/presentation/pages/root/logic.dart
Normal file
89
packages/inspection/lib/presentation/pages/root/logic.dart
Normal file
@@ -0,0 +1,89 @@
|
||||
import 'package:flutter/material.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 }
|
||||
|
||||
class RootLogic extends GetxController {
|
||||
RxInt currentIndex = 0.obs;
|
||||
List<Widget> pages = [InspectionMapPage(), ActionPage(), ProfilePage()];
|
||||
RxList<ErrorLocationType> errorLocationType = RxList();
|
||||
|
||||
Stream<bool> listenToLocationServiceStatus() {
|
||||
return Geolocator.getServiceStatusStream().map((status) {
|
||||
return status == ServiceStatus.enabled;
|
||||
});
|
||||
}
|
||||
|
||||
Future<bool> locationServiceEnabled() async {
|
||||
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
|
||||
if (!serviceEnabled) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Future<bool> checkPermission({bool request = false}) async {
|
||||
try {
|
||||
final LocationPermission permission = await Geolocator.checkPermission();
|
||||
|
||||
switch (permission) {
|
||||
case LocationPermission.denied:
|
||||
final LocationPermission requestResult = await Geolocator.requestPermission();
|
||||
return requestResult != LocationPermission.denied &&
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
|
||||
locationServiceEnabled().then((value) {
|
||||
if (!value) {
|
||||
errorLocationType.add(ErrorLocationType.serviceDisabled);
|
||||
}
|
||||
});
|
||||
|
||||
checkPermission().then((value) {
|
||||
if (!value) {
|
||||
errorLocationType.add(ErrorLocationType.permissionDenied);
|
||||
}
|
||||
});
|
||||
|
||||
listenToLocationServiceStatus().listen((event) {
|
||||
if (!event) {
|
||||
errorLocationType.add(ErrorLocationType.serviceDisabled);
|
||||
} else {
|
||||
errorLocationType.remove(ErrorLocationType.serviceDisabled);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void changePage(int index) {
|
||||
currentIndex.value = index;
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
56
packages/inspection/lib/presentation/pages/root/view.dart
Normal file
56
packages/inspection/lib/presentation/pages/root/view.dart
Normal file
@@ -0,0 +1,56 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class RootPage extends GetView<RootLogic> {
|
||||
const RootPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ObxValue((currentIndex) {
|
||||
return Scaffold(
|
||||
body: ObxValue(
|
||||
(currentIndex) => IndexedStack(index: currentIndex.value, children: controller.pages),
|
||||
controller.currentIndex,
|
||||
),
|
||||
bottomNavigationBar: RBottomNavigation(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
items: [
|
||||
RBottomNavigationItem(
|
||||
label: 'نقشه',
|
||||
icon: Assets.vec.mapSvg.path,
|
||||
isSelected: currentIndex.value == 0,
|
||||
onTap: () {
|
||||
Get.nestedKey(1)?.currentState?.popUntil((route) => route.isFirst);
|
||||
|
||||
controller.changePage(0);
|
||||
},
|
||||
),
|
||||
RBottomNavigationItem(
|
||||
label: 'اقدام',
|
||||
icon: Assets.vec.settingSvg.path,
|
||||
isSelected: currentIndex.value == 1,
|
||||
onTap: () {
|
||||
Get.nestedKey(0)?.currentState?.popUntil((route) => route.isFirst);
|
||||
controller.changePage(1);
|
||||
},
|
||||
),
|
||||
|
||||
RBottomNavigationItem(
|
||||
label: 'پروفایل',
|
||||
icon: Assets.vec.profileCircleSvg.path,
|
||||
isSelected: currentIndex.value == 4,
|
||||
onTap: () {
|
||||
Get.nestedKey(1)?.currentState?.popUntil((route) => route.isFirst);
|
||||
Get.nestedKey(0)?.currentState?.popUntil((route) => route.isFirst);
|
||||
|
||||
controller.changePage(4);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}, controller.currentIndex);
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
324
packages/inspection/lib/presentation/pages/statistics/view.dart
Normal file
324
packages/inspection/lib/presentation/pages/statistics/view.dart
Normal 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),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
33
packages/inspection/lib/presentation/pages/users/logic.dart
Normal file
33
packages/inspection/lib/presentation/pages/users/logic.dart
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
190
packages/inspection/lib/presentation/pages/users/view.dart
Normal file
190
packages/inspection/lib/presentation/pages/users/view.dart
Normal 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,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user