shape property Null safety

ShapeBorder shape

The shape of a button's material.

The button's highlight and splash are clipped to this shape. If the button has an elevation, then its drop shadow is defined by this shape as well.

Defaults to a rounded rectangle with circular corner radii of 4.0 if textTheme is ButtonTextTheme.primary, a rounded rectangle with circular corner radii of 2.0 otherwise.

See also:

Implementation

ShapeBorder get shape {
  if (_shape != null)
    return _shape!;
  switch (textTheme) {
    case ButtonTextTheme.normal:
    case ButtonTextTheme.accent:
      return const RoundedRectangleBorder(
        borderRadius: BorderRadius.all(Radius.circular(2.0)),
      );
    case ButtonTextTheme.primary:
      return const RoundedRectangleBorder(
        borderRadius: BorderRadius.all(Radius.circular(4.0)),
      );
  }
}