without building apk when i dont build apk in flutter this type of gridview is build and when i build apk this type of gridveiw list build in flutter when apk is build
this is my code i want to build an apk so any one can fix this issue i am getting this issue while building an app in flutter otherwise it is ok and give no issue but when i build this app i got error like this is gridview.builder and listview .builder also and i am using scaffold and in body i try everything but nothing work
here is my code
body: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text('Select Your City'),
Expanded(child: GridView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
padding: const EdgeInsets.symmetric(horizontal: 20),
itemCount: serviceDataList.length,
itemBuilder: (ctx, i) {
// print(serviceDataList);
return GestureDetector(
onTap: () {
setState(() async {
if(isRedundentClick(DateTime.now())){
Fluttertoast.showToast(
msg: "hold on, processing",
toastLength: Toast.LENGTH_SHORT,
timeInSecForIosWeb: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0,
);
return;
}else{
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setString('City_Id', serviceDataList[i]['city_id']);
prefs.setString('City_Name', serviceDataList[i]['city_name']);
prefs.setString('City_Lat', serviceDataList[i]['city_lat']);
prefs.setString('City_Long', serviceDataList[i]['city_long']);
print(serviceDataList[i]['city_id']);
print(serviceDataList[i]['city_name']);
int? rowsEffected2 = await dbHelper?.deletecart();
print(rowsEffected2);
Navigator.push(context, MaterialPageRoute(builder:(context)=>Navigation()));
}
});
},
child: Card(
elevation: 4,
color: Colors.white,
child: Column(
children: [
Container(
height: 210,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20)),
margin: EdgeInsets.all(5),
padding: EdgeInsets.all(5),
child: Stack(
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
ConstrainedBox(
constraints: new BoxConstraints(
// minHeight: 35.0,
maxHeight: 200.0,
),
child: Expanded(
child: Image.network(
serviceDataList[i]['city_img'] ?? '',
fit: BoxFit.fill,
),
),
),
// Row(
// children: [
// Text(
// 'Subtitle',
// style: TextStyle(
// fontWeight: FontWeight.bold,
// fontSize: 15,
// ),
// ),
// ],
// )
],
),
],
),
),
SizedBox(
height: 35,
child: Container(
color: Colors.grey.shade300,
child: Center(
child: Text(
serviceDataList[i]['city_name'],
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
),
),
),
],
)
),
);
},
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: 1.0,
crossAxisSpacing: 5,
mainAxisSpacing: 5,
mainAxisExtent: 264,
),
),)
])))
// bottomNavigationBar:Row(
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// children: [
// SizedBox(
// height: 40,
// width: (MediaQuery.of(context).size.width/1.5),
// child: ElevatedButton(onPressed: (){Navigator.push(context, MaterialPageRoute(builder: (context)=> HomePage()),);
// }, child: Text('Save'))),
// ],
// )
);
pls help me with this code
Avoid wrapping your image within an Expanded widget when the parent is a ConstrainedBox. This is because the parent of the expanded widget cannot be a ConstrainedBox, which is an incorrect use of the parent widget. In debug mode, this will only display a warning, but in release mode, it will not render correctly.
Replace this:
With this: