toMainAxisAlignment method

MainAxisAlignment toMainAxisAlignment({
  1. MainAxisAlignment? defaultMainAxisAlignment,
})

Implementation

MainAxisAlignment toMainAxisAlignment({
  MainAxisAlignment? defaultMainAxisAlignment,
}) {
  if ([Alignment.centerLeft, Alignment.bottomLeft, Alignment.topLeft]
      .contains(this)) {
    return MainAxisAlignment.start;
  }
  if ([Alignment.centerRight, Alignment.topRight, Alignment.bottomRight]
      .contains(this)) {
    return MainAxisAlignment.end;
  }
  return defaultMainAxisAlignment ?? MainAxisAlignment.center;
}