I created a Flutter app based mostly on iphoneX. So, after I ran it on one other machine, the dimensions of the Widget was not what I supposed because of the totally different display screen dimension ratios of the gadgets.
So, how can we specify the Widget dimension in the identical ratio as the usual machine even for non-standard gadgets?
iphoneX’s dimension
top:896.0
width:414.0
devicePixelRatio:2.0,
aspectRatio:0.46205357142857145
I specified the dimensions of the widget by calculating as follows, however the structure collapsed.
sizedBox(
// iphoneX's devicePixelRatio = 2.0
top: MediaQuery.of(Dwelling.scaffoldKey.currentContext!).dimension.top / 2.0,
width: MediaQuery.of(Dwelling.scaffoldKey.currentContext!).dimension.width * 2.0,
)