feat : list view item
This commit is contained in:
@@ -7,6 +7,7 @@ import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_pr
|
|||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_free_bar/steward_free_bar.dart';
|
import 'package:rasadyar_chicken/data/models/response/steward_free_bar/steward_free_bar.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
|
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
|
||||||
|
import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
import 'logic.dart';
|
import 'logic.dart';
|
||||||
@@ -22,21 +23,26 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
|
|||||||
onSearchChanged: (data) => controller.setSearchValue(data),
|
onSearchChanged: (data) => controller.setSearchValue(data),
|
||||||
filteringWidget: filterBottomSheet(),
|
filteringWidget: filterBottomSheet(),
|
||||||
widgets: [
|
widgets: [
|
||||||
ObxValue((data) {
|
Expanded(
|
||||||
return RPaginatedListView(
|
child: ObxValue((data) {
|
||||||
listType: ListType.separated,
|
return RPaginatedListView(
|
||||||
resource: data.value,
|
listType: ListType.separated,
|
||||||
padding: EdgeInsets.fromLTRB(8, 8, 18, 80),
|
resource: data.value,
|
||||||
itemBuilder: (context, index) => saleListItem(
|
padding: EdgeInsets.fromLTRB(8, 8, 18, 80),
|
||||||
expandList: controller.isExpandedList,
|
itemBuilder: (context, index) => ListItem(
|
||||||
index: index,
|
expandList: controller.isExpandedList,
|
||||||
item: data.value.data![index],
|
index: index,
|
||||||
),
|
child: Container(height: 40, color: Colors.red),
|
||||||
itemCount: data.value.data?.length ?? 0,
|
secondChild: Container(height: 80, color: Colors.blue),
|
||||||
separatorBuilder: (context, index) => SizedBox(height: 8.h),
|
labelColor: AppColor.lightGreyNormalHover,
|
||||||
onLoadMore: () async {},
|
labelIcon: Assets.vec.truckFastSvg.path,
|
||||||
);
|
),
|
||||||
}, controller.purchaseOutOfProvinceList),
|
itemCount: data.value.data?.length ?? 0,
|
||||||
|
separatorBuilder: (context, index) => SizedBox(height: 8.h),
|
||||||
|
onLoadMore: () async {},
|
||||||
|
);
|
||||||
|
}, controller.purchaseOutOfProvinceList),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
floatingActionButton: RFab.add(
|
floatingActionButton: RFab.add(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@@ -751,36 +757,4 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*ObxValue<RxBool> _buildSearchWidget() {
|
|
||||||
return ObxValue((data) {
|
|
||||||
return AnimatedContainer(
|
|
||||||
duration: Duration(milliseconds: 300),
|
|
||||||
padding: EdgeInsets.only(top: 5),
|
|
||||||
curve: Curves.easeInOut,
|
|
||||||
height: data.value ? 50 : 0,
|
|
||||||
child: Visibility(
|
|
||||||
visible: data.value,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
||||||
child: RTextField(
|
|
||||||
suffixIcon: Padding(
|
|
||||||
padding: const EdgeInsets.all(12.0),
|
|
||||||
child: Assets.vec.searchSvg.svg(
|
|
||||||
width: 10,
|
|
||||||
height: 10,
|
|
||||||
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
hintText: 'جستجو',
|
|
||||||
onChanged: (value) {
|
|
||||||
controller.searchedValue.value = value;
|
|
||||||
},
|
|
||||||
controller: TextEditingController(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.searchIsSelected);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,127 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
|
class ListItem extends StatelessWidget {
|
||||||
|
const ListItem({
|
||||||
|
super.key,
|
||||||
|
required this.expandList,
|
||||||
|
required this.index,
|
||||||
|
required this.child,
|
||||||
|
required this.secondChild,
|
||||||
|
required this.labelColor,
|
||||||
|
required this.labelIcon,
|
||||||
|
this.labelIconColor = AppColor.mediumGreyDarkHover,
|
||||||
|
});
|
||||||
|
|
||||||
|
final RxList<int> expandList;
|
||||||
|
final int index;
|
||||||
|
final Widget child;
|
||||||
|
final Widget secondChild;
|
||||||
|
final Color labelColor;
|
||||||
|
final String labelIcon;
|
||||||
|
final Color? labelIconColor;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
/*if (expandList.contains(index)) {
|
||||||
|
controller.isExpandedList.remove(index);
|
||||||
|
} else {
|
||||||
|
controller.isExpandedList.add(index);
|
||||||
|
}*/
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: Get.width,
|
||||||
|
margin: const EdgeInsets.fromLTRB(0, 0, 10, 0),
|
||||||
|
decoration: BoxDecoration(color: labelColor, borderRadius: BorderRadius.circular(8)),
|
||||||
|
child: AnimatedSize(
|
||||||
|
duration: Duration(milliseconds: 400),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Stack(
|
||||||
|
clipBehavior: Clip.none,
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
children: [
|
||||||
|
AnimatedSize(
|
||||||
|
duration: Duration(milliseconds: 300),
|
||||||
|
child: Container(
|
||||||
|
width: Get.width - 30,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.transparent,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
border: Border.all(width: 2, color: Colors.red),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: AnimatedCrossFade(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
firstChild: Container(
|
||||||
|
height: 75,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
bottomLeft: Radius.zero,
|
||||||
|
bottomRight: Radius.circular(8),
|
||||||
|
topLeft: Radius.zero,
|
||||||
|
topRight: Radius.circular(8),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
secondChild: Container(
|
||||||
|
padding: EdgeInsets.fromLTRB(8, 12, 14, 12),
|
||||||
|
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: secondChild,
|
||||||
|
),
|
||||||
|
crossFadeState: expandList.contains(index)
|
||||||
|
? CrossFadeState.showSecond
|
||||||
|
: CrossFadeState.showFirst,
|
||||||
|
duration: Duration(milliseconds: 300),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 20,
|
||||||
|
child: Center(
|
||||||
|
child: SvgGenImage.vec(labelIcon).svg(
|
||||||
|
width: 16.w,
|
||||||
|
height: 16.h,
|
||||||
|
colorFilter: ColorFilter.mode(labelColor, BlendMode.srcIn),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
Positioned(
|
||||||
|
right: -12,
|
||||||
|
child: Container(
|
||||||
|
width: index < 999 ? 24 : null,
|
||||||
|
height: index < 999 ? 24 : null,
|
||||||
|
padding: EdgeInsets.all(2),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColor.greenLightHover,
|
||||||
|
borderRadius: BorderRadius.circular(4),
|
||||||
|
border: Border.all(width: 0.50, color: AppColor.greenDarkActive),
|
||||||
|
),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
(index + 1).toString(),
|
||||||
|
style: AppFonts.yekan12.copyWith(color: Colors.black),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user