I have an image that doesn\'t match the aspect ratio of my device\'s screen. I want to stretch the image so that it fully fills the screen, and I don\'t want to crop any par
Your Question contains the first step, but you need width and height. you can get the width and height of the screen. Here is a small edit
//gets the screen width and height
double Width = MediaQuery.of(context).size.width;
double Height = MediaQuery.of(context).size.height;
Widget background = new Image.asset(
asset.background,
fit: BoxFit.fill,
width: Width,
height: Height,
);
return new Stack(
children: [
background,
foreground,
],
);
You can also use Width and Height to size other objects based on screen size.
ex: width: Height/2, height: Height/2 //using height for both keeps aspect ratio