columnsContainer static method

Container columnsContainer({
  1. required List<List<Widget>> columns,
  2. EdgeInsetsGeometry? margin,
  3. EdgeInsetsGeometry? padding,
  4. Color color = Colors.transparent,
  5. MainAxisAlignment? mainAxisAlignment,
  6. CrossAxisAlignment? crossAxisAlignment,
  7. MainAxisSize mainAxisSize = MainAxisSize.max,
})

Multiple Columns container to display

Implementation

static Container columnsContainer({
  required List<List<Widget>> columns,
  EdgeInsetsGeometry? margin,
  EdgeInsetsGeometry? padding,
  Color color = Colors.transparent,
  MainAxisAlignment? mainAxisAlignment,
  CrossAxisAlignment? crossAxisAlignment,
  MainAxisSize mainAxisSize = MainAxisSize.max,
}) {
  if (margin == null) margin = EdgeInsets.all(0);
  if (crossAxisAlignment == null) {
    crossAxisAlignment = CrossAxisAlignment.center;
  }
  if (mainAxisAlignment == null) mainAxisAlignment = MainAxisAlignment.start;

  List<Widget> children = [];
  columns.forEach((column) {
    children.add(
      Expanded(
          child: Column(
              crossAxisAlignment: crossAxisAlignment!,
              mainAxisAlignment: mainAxisAlignment!,
              mainAxisSize: mainAxisSize,
              children: column)),
    );
  });
  return Container(
    margin: margin,
    padding: padding,
    color: color,
    child: Row(
      crossAxisAlignment: crossAxisAlignment,
      mainAxisAlignment: mainAxisAlignment,
      mainAxisSize: mainAxisSize,
      children: children,
    ),
  );
}