containerized method Null safety

CodeInputBuilder containerized(
  1. {Duration animationDuration = const Duration(milliseconds: 50),
  2. required Size totalSize,
  3. required Size emptySize,
  4. required Size filledSize,
  5. required BoxDecoration emptyDecoration,
  6. required BoxDecoration filledDecoration,
  7. required TextStyle emptyTextStyle,
  8. required TextStyle filledTextStyle}
)

Builds the input inside an animated container.

Implementation

static CodeInputBuilder containerized({
  Duration animationDuration = const Duration(milliseconds: 50),
  required Size totalSize,
  required Size emptySize,
  required Size filledSize,
  required BoxDecoration emptyDecoration,
  required BoxDecoration filledDecoration,
  required TextStyle emptyTextStyle,
  required TextStyle filledTextStyle,
}) {
  return (bool hasFocus, String char) => Container(
      width: totalSize.width,
      height: totalSize.height,
      alignment: Alignment.center,
      child: AnimatedContainer(
        duration: Duration(milliseconds: 100),
        decoration: char.isEmpty ? emptyDecoration : filledDecoration,
        width: char.isEmpty ? emptySize.width : filledSize.width,
        height: char.isEmpty ? emptySize.height : filledSize.height,
        alignment: Alignment.center,
        child: Text(char,
            style: char.isEmpty ? emptyTextStyle : filledTextStyle),
      ));
}