makeContainingTable static method
Widget
makeContainingTable(
- BuildContext context,
- List<
Widget> widgets, - MemberMediumModel image,
- PresentationRelativeImagePosition relativeImagePosition,
- PresentationImageAlignment imageAlignment,
- double imageSize,
Implementation
static Widget makeContainingTable(
BuildContext context,
List<Widget> widgets,
MemberMediumModel image,
PresentationRelativeImagePosition relativeImagePosition,
PresentationImageAlignment imageAlignment,
double imageSize) {
//var accessState = AccessBloc.getState(context);
/*
if (image == null) {
return _makeBox(widgets);
}
*/
if (relativeImagePosition == PresentationRelativeImagePosition.unknown) {
relativeImagePosition = PresentationRelativeImagePosition.above;
}
if (imageAlignment == PresentationImageAlignment.unknown) {
imageAlignment = PresentationImageAlignment.left;
}
double? size;
size = fullScreenWidth(context) * imageSize;
Widget widgetImage;
if (image.url != null) {
widgetImage = FadeInImage.memoryNetwork(
placeholder: kTransparentImage,
image: image.url!,
width: size,
);
} else {
widgetImage = Text("Image does not exist");
}
if (relativeImagePosition == PresentationRelativeImagePosition.aside) {
Widget column1;
Widget column2;
column1 = Container(
alignment: Alignment.topCenter,
width: size, // set this
child: widgetImage,
);
column2 = Container(
alignment: Alignment.topCenter,
width: fullScreenWidth(context) - size, // set this
child: _makeBox(widgets),
);
if (imageAlignment == PresentationImageAlignment.left) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
verticalDirection: VerticalDirection.down,
children: [column1, column2]);
} else {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
verticalDirection: VerticalDirection.down,
children: [column2, column1]);
}
}
Widget alignedWidget = _toAlignment(imageAlignment, widgetImage);
if (relativeImagePosition == PresentationRelativeImagePosition.below) {
var widgets = <Widget>[];
widgets.addAll(widgets);
widgets.add(alignedWidget);
return _makeBox(widgets);
}
if (relativeImagePosition == PresentationRelativeImagePosition.above) {
var newList = <Widget>[];
newList.add(alignedWidget);
newList.addAll(widgets);
return _makeBox(newList);
}
if (relativeImagePosition == PresentationRelativeImagePosition.behind) {
return Stack(children: <Widget>[
alignedWidget,
_makeBox(widgets),
]);
}
if (relativeImagePosition == PresentationRelativeImagePosition.inFront) {
return Stack(children: <Widget>[
_makeBox(widgets),
alignedWidget,
]);
}
// error, not expecting this. Anyhu... return the box, just the box, drop the image
return _makeBox(widgets);
}