check this code
Widget getCategoryItem(item) {
 if ((selectedCategoryId != item["cat\_id"] && selectedCategoryId != "0") ||
 item["item"].length == 0) {
 return Container();
 }
 return Container(
 padding: EdgeInsets.only(bottom: 0),
 width: MediaQuery.of(context).size.width,
 height: MediaQuery.of(context).size.height \* .55,
 child: GridView.builder(
 padding: const EdgeInsets.all(8),
 itemCount: item["item"].length,
 gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
 crossAxisCount: 3,
 crossAxisSpacing: 8,
 mainAxisSpacing: 20,
 childAspectRatio: .75, // Adjust the aspect ratio to fit your needs
 ),
 itemBuilder: (context, index) {
 var item2 = item["item"][index];
 String name = getTransValue(json.decode(item2["item\_name\_trans"]),
 item2["item\_name"]) ??
 "";

 String description = getTransValue(
 json.decode(item2["item\_description\_trans"]),
 item2["item\_description"]) ??
 "";
 /\* double price = item2["prices2"].isNotEmpty
 ? double.parse(item2["prices2"][0]["original\_price"])
 : 0.0; \*/

 return InkWell(
 onTap: () {
 onTap(item2);

 // Add your logic for adding the item to the cart
 },
 child: Container(
 padding: EdgeInsets.only(top: 0, right: 0, left: 0),
 //height: 180,
 child: Column(
 mainAxisAlignment: MainAxisAlignment.start,
 children: [
 Container(
 //width: MediaQuery.of(context).size.width,
 height: 90,
 decoration: BoxDecoration(
 borderRadius: BorderRadius.circular(8),
 color: Colors.grey[50],
 ),
 child: Stack(
 children: [
 CircleImage(
 borderRadius: 8,
 borderWidth: 0,
 child: CachedNetworkImage(
 imageUrl: item2["photo"],
 fit: BoxFit.cover,
 errorWidget: (context, url, error) =>
 const Image(
 image: AssetImage(
 "assets/images/item-placeholder.png"),
 fit: BoxFit.cover,
 ),
 placeholder: (context, text) =>
 const Image(
 image: AssetImage(
 "assets/images/item-placeholder.png"),
 //height: 90,
 fit: BoxFit.cover,
 ),
 ),
 ),
 Align(
 alignment: Alignment.bottomRight,
 child: FloatingActionButton(
 child: Icon(
 Icons.add\_rounded,
 size: 22,
 ),
 mini: true,
 onPressed: () {},
 ),
 )
 ],
 )),
 Padding(
 padding: EdgeInsets.only(top: 5),

 // padding: EdgeInsets.only(top: 120),
 child: Container(
 decoration: BoxDecoration(
 borderRadius: BorderRadius.circular(8),
 color: Colors.grey[50],
 ),
 child: Column(
 mainAxisAlignment: MainAxisAlignment.start,
 children: [
 ListView.builder(
 primary: false,
 shrinkWrap: true,
 itemCount: item2["prices2"].length,
 itemBuilder: (context, index) {
 var priceItem = item2["prices2"][index];
 bool hasDiscount =
 ("${priceItem["discount"]}"
 .isNotEmpty &&
 "${priceItem["discount"]}" !=
 "0");
 return Container(
 padding: const EdgeInsets.symmetric(
 vertical: 4),
 child: Row(
 children: [
 Icon(
 Icons.local\_offer,
 color: primaryColor,
 size: 16,
 ),
 const SizedBox(width: 8),
 Expanded(
 child: Container(
 padding:
 const EdgeInsets.only(
 right: 8.0),
 child: Row(
 mainAxisAlignment:
 MainAxisAlignment
 .spaceBetween,
 children: [
 PriceWidget(
 price: hasDiscount
 ? priceItem[
 "discounted\_price\_pretty"]
 : priceItem["original\_price\_json"]
 ["price"] ??
 priceItem[
 "original\_price"],
 oldPrice: hasDiscount
 ? priceItem[
 "original\_price"]
 : null,
 ),
 priceItem["original\_price\_json"]
 ["qty"] !=
 null
 ? Text(
 priceItem[
 "original\_price\_json"]
 ["qty"],
 style: const TextStyle(
 fontWeight:
 FontWeight
 .w600),
 )
 : const SizedBox(
 width: 0,
 height: 0,
 ),
 ],
 ),
 ),
 ),
 ],
 ),
 );
 },
 ),
 Text(
 name,
 textAlign: TextAlign.center,
 style: const TextStyle(
 fontSize: 12,
 fontWeight: FontWeight.bold,
 ),
 ),
 SizedBox(
 width: MediaQuery.of(context).size.width,
 child: Text(
 description == "null"
 ? ""
 : description,
 maxLines: 2,
 overflow: TextOverflow.ellipsis,
 style: const TextStyle(
 fontSize: 10,
 color: Colors.grey,
 ),
 ),
 ),
 /\* Text(
 '\$${price.toStringAsFixed(2)}',
 style: const TextStyle(
 fontSize: 14,
 color: Colors.grey,
 ),
 ), \*/
 ],
 ),
 )),
 ])));
 /\* var listItem = item["item"][index];
 return getItem(listItem);\*/
 },
 ));
 }
다음 코드를 확인하세요.위젯 getCategoryItem(item) { if ((selectedCategoryId != item["cat\_id"] && selectedCategoryId != "0") || item["item"].length == 0) { 반환 Container(); } return Container( padding: EdgeInsets.only(bottom: 0), width: MediaQuery.of(context).size.width, 높이: MediaQuery.of(context).size.height \* .55, child: GridView.builder( padding: const EdgeInsets.all(8), itemCount: item["item"].length, gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, crossAxisSpacing: 8, mainAxisSpacing: 20, childAspectRatio: .75, // 필요에 맞게 가로 세로 비율을 조정하세요. ), itemBuilder: (context, index) { var item2 = item["item"][index]; String name = getTransValue(json.decode(item2["item\_name\_trans"]), item2["item\_name"]) ?? ""; String description = getTransValue( json.decode(item2["item\_description\_trans"]), item2["item\_description"]) ?? ""; /\* double price = item2["prices2"].isNotEmpty ? double.parse(item2["prices2"][0]["original\_price"]) : 0.0; \*/ return InkWell( onTap: () { onTap(item2); // 장바구니에 아이템을 추가하기 위한 로직 추가 }, child: Container( padding: EdgeInsets.only(top: 0, right: 0, left: 0), //높이: 180, child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ Container( //폭: MediaQuery.of(context).size.width, 높이: 90, 장식: BoxDecoration( borderRadius: BorderRadius.원형(8), color: Colors.grey[50], ), child: Stack( children: [ CircleImage( borderRadius: 8, borderWidth: 0, child: CachedNetworkImage( imageUrl: item2["photo"], fit: BoxFit.cover, errorWidget: (컨텍스트, url, 오류) => const Image( image: AssetImage( "assets/images/item-placeholder.png"), fit: BoxFit.cover, ), 플레이스홀더: (컨텍스트, 텍스트) => const Image( image: AssetImage( "assets/images/item-placeholder.png"), //높이: 90, fit: BoxFit.cover, ), ), ), Align( alignment: Alignment.bottomRight, child: FloatingActionButton( child: Icon( Icons.add\_rounded, size: 22, ), mini: true, onPressed: () {}, ), ) ], )), 패딩( padding: EdgeInsets.only(top: 5), // 패딩: EdgeInsets.only(top: 120), child: Container( 장식: BoxDecoration( borderRadius: BorderRadius.원형(8), color: Colors.grey[50], ), child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ ListView.builder( primary: false, shrinkWrap: true, itemCount: item2["prices2"].length, itemBuilder: (context, index) { var priceItem = item2["prices2"][index]; bool hasDiscount = ("${priceItem["discount"]}" .isNotEmpty && "${priceItem["discount"]}" != "0"); 반환 컨테이너( padding: const EdgeInsets.symmetric( vertical: 4), child: Row( children: [ Icon( Icons.local\_offer, color: primaryColor, size: 16, ), const SizedBox(width: 8), Expanded( child: Container( 패딩: const EdgeInsets.only( 오른쪽: 8.0), child: Row( 메인축 정렬: MainAxisAlignment .spaceBetween, children: [ PriceWidget( 가격: hasDiscount ? priceItem[ "할인된\_가격\_예쁜"] : priceItem["original\_price\_json"] ["가격"] ?? priceItem[ "original\_price"], oldPrice: hasDiscount ? priceItem[ "original\_price"] : null, ), priceItem["original\_price\_json"] ["수량"] != null ? Text( priceItem[ "original\_price\_json"] ["수량"], 스타일: const TextStyle( fontWeight: FontWeight .w600), ) : const SizedBox( width: 0, 높이: 0, ), ], ), ), ), ], ), ); }, ), Text( name, textAlign: TextAlign.center, style: const TextStyle( fontSize: 12, fontWeight: FontWeight.bold, ), ), SizedBox( width: MediaQuery.of(context).size.width, child: Text( description == "null" ? "" : 설명, maxLines: 2, 오버플로: TextOverflow.줄임표, 스타일: const TextStyle( fontSize: 10, 색상: Colors.grey, ), ), ), /\* Text( '\$${price.toStringAsFixed(2)}', style: const TextStyle( fontSize: 14, color: Colors.grey, ), ), \*/ ], ), )), ]))); /\* var listItem = item["item"][index]; return getItem(listItem);\*// }, )); }