ButtonTheme constructor Null safety

ButtonTheme(
  1. {Key? key,
  2. ButtonTextTheme textTheme = ButtonTextTheme.normal,
  3. ButtonBarLayoutBehavior layoutBehavior = ButtonBarLayoutBehavior.padded,
  4. double minWidth = 88.0,
  5. double height = 36.0,
  6. EdgeInsetsGeometry? padding,
  7. ShapeBorder? shape,
  8. bool alignedDropdown = false,
  9. Color? buttonColor,
  10. Color? disabledColor,
  11. Color? focusColor,
  12. Color? hoverColor,
  13. Color? highlightColor,
  14. Color? splashColor,
  15. ColorScheme? colorScheme,
  16. MaterialTapTargetSize? materialTapTargetSize,
  17. required Widget child}
)

Creates a button theme.

The textTheme, minWidth, height, and colorScheme arguments must not be null.

Implementation

ButtonTheme({
  super.key,
  ButtonTextTheme textTheme = ButtonTextTheme.normal,
  ButtonBarLayoutBehavior layoutBehavior = ButtonBarLayoutBehavior.padded,
  double minWidth = 88.0,
  double height = 36.0,
  EdgeInsetsGeometry? padding,
  ShapeBorder? shape,
  bool alignedDropdown = false,
  Color? buttonColor,
  Color? disabledColor,
  Color? focusColor,
  Color? hoverColor,
  Color? highlightColor,
  Color? splashColor,
  ColorScheme? colorScheme,
  MaterialTapTargetSize? materialTapTargetSize,
  required super.child,
}) : assert(textTheme != null),
     assert(minWidth != null && minWidth >= 0.0),
     assert(height != null && height >= 0.0),
     assert(alignedDropdown != null),
     assert(layoutBehavior != null),
     data = ButtonThemeData(
       textTheme: textTheme,
       minWidth: minWidth,
       height: height,
       padding: padding,
       shape: shape,
       alignedDropdown: alignedDropdown,
       layoutBehavior: layoutBehavior,
       buttonColor: buttonColor,
       disabledColor: disabledColor,
       focusColor: focusColor,
       hoverColor: hoverColor,
       highlightColor: highlightColor,
       splashColor: splashColor,
       colorScheme: colorScheme,
       materialTapTargetSize: materialTapTargetSize,
     );