allShopItems method
Implementation
Widget allShopItems(BuildContext context) {
return Expanded(
flex: 1,
child: controller.items.isEmpty
? Container(
child: const Center(
child: CustomText(text: 'No search results found'),
),
)
: GridView.builder(
shrinkWrap: true,
physics: const BouncingScrollPhysics(),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
mainAxisSpacing: 6.0,
crossAxisSpacing: 12.0,
childAspectRatio: .5,
crossAxisCount: 2),
itemCount: controller.items.length,
itemBuilder: (_, i) {
var item = controller.items[i];
return InkWell(
onTap: () {
Utils.navigationPush(
context,
ShopItemDetail(
data: item,
shopContext: shopContext,
));
},
child: Container(
padding: const EdgeInsets.only(bottom: 18),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Container(
child: PNetworkImage(
item.assets!.isNotEmpty
? item.assets![0].url!
: Constants.noAssetImageAvailable,
width: Get.width,
fit: BoxFit.cover,
),
decoration: const BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(10.0)),
),
),
),
verticalSpaceSmall,
CustomTextTag(
text: item.status!.toTitleCase(),
height: 27,
width: 100,
status: item.status,
),
verticalSpaceSmall,
CustomText(
text: item.name! + " " + item.description!,
font: Dimens.fontSize16,
fntweight: FontWeight.w300,
maxLine: 1,
ellipsis: TextOverflow.ellipsis,
),
verticalSpaceSmall,
CustomText(
text: "\$" + item.price!,
font: Dimens.fontSize18,
fntweight: FontWeight.w600,
ellipsis: TextOverflow.ellipsis,
),
],
),
),
);
}),
);
}