getMarginForAlignment function
Implementation
EdgeInsets getMarginForAlignment({
required double top,
required double bottom,
required double left,
required double right,
required String horizontalAlignment,
required String verticalAlignment,
double scaleWidth = 1.0,
double scaleHeight = 1.0,
required String id,
}) {
EdgeInsets getMargin(String horAl, String verAl) {
if (id.contains("container")) {
return EdgeInsets.only(
top: top * scaleHeight,
bottom: bottom * scaleHeight,
left: left * scaleWidth,
right: right * scaleWidth,
);
}
switch (verAl) {
case 'top':
switch (horAl) {
case 'left':
return EdgeInsets.only(
top: top * scaleHeight,
left: left * scaleWidth,
);
case 'right':
return EdgeInsets.only(
top: top * scaleHeight,
right: right * scaleWidth,
);
default:
return EdgeInsets.only(
top: top * scaleHeight,
left: left * scaleWidth,
// right: right * scaleWidth,
);
}
case 'bottom':
switch (horAl) {
case 'left':
return EdgeInsets.only(
bottom: bottom * scaleHeight,
left: left * scaleWidth,
);
case 'right':
return EdgeInsets.only(
bottom: bottom * scaleHeight,
right: right * scaleWidth,
);
default:
return EdgeInsets.only(
bottom: bottom * scaleHeight,
left: left * scaleWidth,
// right: right * scaleWidth,
);
}
default:
switch (horAl) {
case 'left':
return EdgeInsets.only(
top: top * scaleHeight,
// bottom: bottom * scaleHeight,
left: left * scaleWidth,
);
case 'right':
return EdgeInsets.only(
top: top * scaleHeight,
// bottom: bottom * scaleHeight,
right: right * scaleWidth,
);
default:
return EdgeInsets.only(
top: top * scaleHeight,
bottom: bottom * scaleHeight,
left: left * scaleWidth,
right: right * scaleWidth,
);
}
}
}
return getMargin(horizontalAlignment, verticalAlignment);
}