191 lines
6.4 KiB
Dart
191 lines
6.4 KiB
Dart
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 ExpandableListItem2(
|
|
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,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|