parseCrossAxisAlignment method

CrossAxisAlignment parseCrossAxisAlignment(
  1. Token name
)

Implementation

CrossAxisAlignment parseCrossAxisAlignment(Token name) {
  consume(TokenType.leftParen, "Expect '(' after EdgeInsets method.");
  CrossAxisAlignment result;
  switch (name.lexeme) {
    case 'CrossAxisAlignmentStart':
      result = const CrossAxisAlignmentStart();
      break;
    case 'CrossAxisAlignmentCenter':
      result = const CrossAxisAlignmentCenter();
      break;
    case 'CrossAxisAlignmentEnd':
      result = const CrossAxisAlignmentEnd();
      break;
    case 'CrossAxisAlignmentStretch':
      result = const CrossAxisAlignmentStretch();
      break;
    case 'CrossAxisAlignmentBaseline':
      result = const CrossAxisAlignmentBaseline();
      break;
    default:
      throw error(name, "Unknown CrossAxisAligment method: ${name.lexeme}");
  }

  consume(TokenType.rightParen, "Expect ')' after EdgeInsets parameters.");
  return result;
}