addMargins method

Widget addMargins(
  1. Widget view
)

applies margins to the view based on the widget model

Implementation

Widget addMargins(Widget view) {
if (model?.marginTop != null ||
    model?.marginBottom != null ||
    model?.marginRight != null ||
    model?.marginLeft != null) {
  var inset = EdgeInsets.only(
      top: model?.marginTop ?? 0,
      right: model?.marginRight ?? 0,
      bottom: model?.marginBottom ?? 0,
      left: model?.marginLeft ?? 0);
  view = Padding(padding: inset, child: view);
}
return view;
  }