refactor : request page and fix padding's
This commit is contained in:
@@ -4,4 +4,6 @@ import 'package:rasadyar_livestock/presentation/page/root/logic.dart';
|
|||||||
class RequestsLogic extends GetxController {
|
class RequestsLogic extends GetxController {
|
||||||
RxList<int> filterSelected = <int>[].obs;
|
RxList<int> filterSelected = <int>[].obs;
|
||||||
|
|
||||||
|
RxBool isFilterShowed = false.obs;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,213 +10,13 @@ class RequestsPage extends GetView<RequestsLogic> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: RAppBar(
|
appBar: RAppBar(title: 'لیست درخواستها', hasBack: false, centerTitle: true),
|
||||||
title: 'لیست درخواستها',
|
|
||||||
hasBack: false,
|
|
||||||
centerTitle: true,
|
|
||||||
),
|
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(height: 16),
|
SizedBox(height: 8),
|
||||||
_searchWidget(),
|
_buildSearchAndFilter(),
|
||||||
SizedBox(height: 16),
|
_buildFilterWidget(),
|
||||||
SizedBox(
|
_buildListOfContent(),
|
||||||
height: 50,
|
|
||||||
child: SingleChildScrollView(
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 12),
|
|
||||||
child: ObxValue((data) {
|
|
||||||
return Row(
|
|
||||||
spacing: 12,
|
|
||||||
children: [
|
|
||||||
CustomChip(
|
|
||||||
title: 'انتخاب فیلتر',
|
|
||||||
index: 0,
|
|
||||||
isSelected: true,
|
|
||||||
selectedColor: AppColor.blueNormal,
|
|
||||||
onTap: (index) {},
|
|
||||||
),
|
|
||||||
|
|
||||||
RFilterChips(
|
|
||||||
title: 'درخواستهای من',
|
|
||||||
index: 1,
|
|
||||||
isSelected: data.contains(1),
|
|
||||||
selectedColor: AppColor.yellowNormal,
|
|
||||||
onTap: (index) {
|
|
||||||
if (data.contains(1)) {
|
|
||||||
data.remove(1);
|
|
||||||
} else {
|
|
||||||
data.add(1);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
|
|
||||||
RFilterChips(
|
|
||||||
title: 'در انتظار ثبت ',
|
|
||||||
index: 2,
|
|
||||||
selectedColor: AppColor.greenLightActive,
|
|
||||||
isSelected: data.contains(2),
|
|
||||||
onTap: (index) {
|
|
||||||
if (data.contains(2)) {
|
|
||||||
data.remove(2);
|
|
||||||
} else {
|
|
||||||
data.add(2);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
|
|
||||||
RFilterChips(
|
|
||||||
title: 'ارجاع به تعاونی',
|
|
||||||
index: 3,
|
|
||||||
selectedColor: AppColor.blueLightHover,
|
|
||||||
isSelected: data.contains(3),
|
|
||||||
onTap: (index) {
|
|
||||||
if (data.contains(3)) {
|
|
||||||
data.remove(3);
|
|
||||||
} else {
|
|
||||||
data.add(3);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}, controller.filterSelected),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 10),
|
|
||||||
Expanded(
|
|
||||||
child: ListView.separated(
|
|
||||||
itemCount: 10,
|
|
||||||
physics: BouncingScrollPhysics(),
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
|
||||||
separatorBuilder: (context, index) => SizedBox(height: 16),
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
Get.toNamed(LiveStockRoutes.requestTagging);
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
width: Get.width,
|
|
||||||
height: 75,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color:
|
|
||||||
index < 3
|
|
||||||
? AppColor.yellowNormal
|
|
||||||
: index < 7
|
|
||||||
? AppColor.greenLightActive
|
|
||||||
: AppColor.blueLight,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
SizedBox(width: 5),
|
|
||||||
Expanded(
|
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.only(
|
|
||||||
topRight: Radius.circular(8),
|
|
||||||
bottomRight: Radius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
SizedBox(width: 10),
|
|
||||||
Text(
|
|
||||||
'محمد احمدی',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan12.copyWith(
|
|
||||||
color: AppColor.blueNormal,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: 20),
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'پنج شنبه 14 اردیبهشت',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan10.copyWith(
|
|
||||||
color: AppColor.darkGreyNormal,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
' همدان - نهاوند - روستای - همدان - نهاوند - روستای ',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan10.copyWith(
|
|
||||||
color: AppColor.darkGreyNormal,
|
|
||||||
),
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
maxLines: 1,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: 20),
|
|
||||||
GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
// controller.onTapMap();
|
|
||||||
},
|
|
||||||
child: SizedBox(
|
|
||||||
width: 50,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Assets.vec.mapSvg.svg(
|
|
||||||
width: 20,
|
|
||||||
height: 20,
|
|
||||||
colorFilter: ColorFilter.mode(
|
|
||||||
AppColor.blueNormal,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 8),
|
|
||||||
Text(
|
|
||||||
'مسیریابی',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan10.copyWith(
|
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(width: 20),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
width: 20,
|
|
||||||
child: Center(
|
|
||||||
child: RotatedBox(
|
|
||||||
quarterTurns: 3,
|
|
||||||
child: Text(
|
|
||||||
index < 3
|
|
||||||
? ' بازرسی'
|
|
||||||
: index < 7
|
|
||||||
? 'اطلاعات'
|
|
||||||
: 'ارجاع به تعاونی',
|
|
||||||
style: AppFonts.yekan8,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
RElevated(
|
RElevated(
|
||||||
text: '+ ایجاد درخواست',
|
text: '+ ایجاد درخواست',
|
||||||
width: Get.width - 36,
|
width: Get.width - 36,
|
||||||
@@ -232,9 +32,239 @@ class RequestsPage extends GetView<RequestsLogic> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Expanded _buildListOfContent() {
|
||||||
|
return Expanded(
|
||||||
|
child: ListView.separated(
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: 10,
|
||||||
|
physics: BouncingScrollPhysics(),
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 20, vertical: controller.isFilterShowed.value ? 5 : 10),
|
||||||
|
separatorBuilder: (context, index) => SizedBox(height: 6),
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Get.toNamed(LiveStockRoutes.requestTagging);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: Get.width,
|
||||||
|
height: 75,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color:
|
||||||
|
index < 3
|
||||||
|
? AppColor.yellowNormal
|
||||||
|
: index < 7
|
||||||
|
? AppColor.greenLightActive
|
||||||
|
: AppColor.blueLight,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(width: 5),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topRight: Radius.circular(8),
|
||||||
|
bottomRight: Radius.circular(8),
|
||||||
|
),
|
||||||
|
border: Border.all(
|
||||||
|
color:
|
||||||
|
index < 3
|
||||||
|
? AppColor.yellowNormal
|
||||||
|
: index < 7
|
||||||
|
? AppColor.greenLightActive
|
||||||
|
: AppColor.blueLight,
|
||||||
|
width: 2,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(width: 10),
|
||||||
|
Text(
|
||||||
|
'محمد احمدی',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: AppFonts.yekan12.copyWith(
|
||||||
|
color: AppColor.blueNormal,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 20),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'پنج شنبه 14 اردیبهشت',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: AppFonts.yekan10.copyWith(color: AppColor.darkGreyNormal),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
' همدان - نهاوند - روستای - همدان - نهاوند - روستای ',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: AppFonts.yekan10.copyWith(color: AppColor.darkGreyNormal),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
maxLines: 1,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 20),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
// controller.onTapMap();
|
||||||
|
},
|
||||||
|
child: SizedBox(
|
||||||
|
width: 50,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Assets.vec.mapSvg.svg(
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
'مسیریابی',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
SizedBox(width: 20),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
Container(
|
||||||
|
width: 20,
|
||||||
|
child: Center(
|
||||||
|
child: RotatedBox(
|
||||||
|
quarterTurns: 3,
|
||||||
|
child: Text(
|
||||||
|
index < 3
|
||||||
|
? ' بازرسی'
|
||||||
|
: index < 7
|
||||||
|
? 'اطلاعات'
|
||||||
|
: 'ارجاع به تعاونی',
|
||||||
|
style: AppFonts.yekan8,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Row _buildSearchAndFilter() {
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 10.0),
|
||||||
|
child: IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
controller.isFilterShowed.value = !controller.isFilterShowed.value;
|
||||||
|
},
|
||||||
|
|
||||||
|
style: IconButton.styleFrom(
|
||||||
|
backgroundColor: AppColor.blueNormal,
|
||||||
|
fixedSize: Size(40, 40),
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
|
),
|
||||||
|
icon: Assets.vec.filterSvg.svg(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(child: _searchWidget()),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
ObxValue<RxBool> _buildFilterWidget() {
|
||||||
|
return ObxValue((data) {
|
||||||
|
return AnimatedContainer(
|
||||||
|
duration: Duration(milliseconds: 300),
|
||||||
|
padding: EdgeInsets.only(top: 5),
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
height: data.value ? 45 : 0,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 12),
|
||||||
|
child: ObxValue((data) {
|
||||||
|
return Row(
|
||||||
|
spacing: 12,
|
||||||
|
children: [
|
||||||
|
CustomChip(
|
||||||
|
title: 'انتخاب فیلتر',
|
||||||
|
index: 0,
|
||||||
|
isSelected: true,
|
||||||
|
selectedColor: AppColor.blueNormal,
|
||||||
|
onTap: (index) {},
|
||||||
|
),
|
||||||
|
|
||||||
|
RFilterChips(
|
||||||
|
title: 'درخواستهای من',
|
||||||
|
index: 1,
|
||||||
|
isSelected: data.contains(1),
|
||||||
|
selectedColor: AppColor.yellowNormal,
|
||||||
|
onTap: (index) {
|
||||||
|
if (data.contains(1)) {
|
||||||
|
data.remove(1);
|
||||||
|
} else {
|
||||||
|
data.add(1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
RFilterChips(
|
||||||
|
title: 'در انتظار ثبت ',
|
||||||
|
index: 2,
|
||||||
|
selectedColor: AppColor.greenLightActive,
|
||||||
|
isSelected: data.contains(2),
|
||||||
|
onTap: (index) {
|
||||||
|
if (data.contains(2)) {
|
||||||
|
data.remove(2);
|
||||||
|
} else {
|
||||||
|
data.add(2);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
RFilterChips(
|
||||||
|
title: 'ارجاع به تعاونی',
|
||||||
|
index: 3,
|
||||||
|
selectedColor: AppColor.blueLightHover,
|
||||||
|
isSelected: data.contains(3),
|
||||||
|
onTap: (index) {
|
||||||
|
if (data.contains(3)) {
|
||||||
|
data.remove(3);
|
||||||
|
} else {
|
||||||
|
data.add(3);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}, controller.filterSelected),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}, controller.isFilterShowed);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _searchWidget() {
|
Widget _searchWidget() {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
padding: const EdgeInsets.only(right: 8.0, left: 20.0),
|
||||||
child: RTextField(
|
child: RTextField(
|
||||||
suffixIcon: Padding(
|
suffixIcon: Padding(
|
||||||
padding: const EdgeInsets.all(12.0),
|
padding: const EdgeInsets.all(12.0),
|
||||||
|
|||||||
Reference in New Issue
Block a user