Gridview:
code:
GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 4.0,
mainAxisSpacing: 4.0,
childAspectRatio: MediaQuery.of(context).size.width /
(MediaQuery.of(context).size.height / 1.7),
),
itemCount: getproducttypelength.length,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ProdDetails(
prodDetailsId:
"${jsonDecode(getproducttype)['Response'][index]['productImage']['ProductId']}",
prodDetailsName:
"${jsonDecode(getproducttype)['Response'][index]['productImage']['Product']['ProductName']}",
// jsonDecode(orderdata)['Response'][index]
// ['FullName'],
),
),
);
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Card(
elevation: 10,
child: Column(
children: [
SizedBox(height: 4),
Container(
child: Image.network(
"${jsonDecode(getproducttype)['Response'][index]['productImage']['PictureBinary']}",
width: 125.0,
height: 120.0,
fit: BoxFit.cover,
),
),
Divider(color: Colors.grey),
Container(
child: Center(
child: Text(
"${jsonDecode(getproducttype)['Response'][index]['productImage']['Product']['ProductName']}",
maxLines: 4,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
fontFamily: "ProximaNovaAExtrabold",
),
),
),
),
Container(
child: Center(
child: Text(
"MRP.${jsonDecode(getproducttype)['Response'][index]['productImage']['Product']['MRP']}",
maxLines: 4,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 17,
fontWeight: FontWeight.bold,
fontFamily: "ProximaNovaAltRegular",
),
),
),
),
],
),
),
),
);
},
);
0 Comments