RaisedButton constructor Null safety

const RaisedButton(
  1. {Key? key,
  2. required VoidCallback? onPressed,
  3. VoidCallback? onLongPress,
  4. ValueChanged<bool>? onHighlightChanged,
  5. MouseCursor? mouseCursor,
  6. ButtonTextTheme? textTheme,
  7. Color? textColor,
  8. Color? disabledTextColor,
  9. Color? color,
  10. Color? disabledColor,
  11. Color? focusColor,
  12. Color? hoverColor,
  13. Color? highlightColor,
  14. Color? splashColor,
  15. Brightness? colorBrightness,
  16. double? elevation,
  17. double? focusElevation,
  18. double? hoverElevation,
  19. double? highlightElevation,
  20. double? disabledElevation,
  21. EdgeInsetsGeometry? padding,
  22. VisualDensity? visualDensity,
  23. ShapeBorder? shape,
  24. Clip clipBehavior: Clip.none,
  25. FocusNode? focusNode,
  26. bool autofocus: false,
  27. MaterialTapTargetSize? materialTapTargetSize,
  28. Duration? animationDuration,
  29. Widget? child}

Create a filled button.

The autofocus and clipBehavior arguments must not be null. Additionally, elevation, hoverElevation, focusElevation, highlightElevation, and disabledElevation must be non-negative, if specified.


const RaisedButton({
  Key? key,
  required VoidCallback? onPressed,
  VoidCallback? onLongPress,
  ValueChanged<bool>? onHighlightChanged,
  MouseCursor? mouseCursor,
  ButtonTextTheme? textTheme,
  Color? textColor,
  Color? disabledTextColor,
  Color? color,
  Color? disabledColor,
  Color? focusColor,
  Color? hoverColor,
  Color? highlightColor,
  Color? splashColor,
  Brightness? colorBrightness,
  double? elevation,
  double? focusElevation,
  double? hoverElevation,
  double? highlightElevation,
  double? disabledElevation,
  EdgeInsetsGeometry? padding,
  VisualDensity? visualDensity,
  ShapeBorder? shape,
  Clip clipBehavior = Clip.none,
  FocusNode? focusNode,
  bool autofocus = false,
  MaterialTapTargetSize? materialTapTargetSize,
  Duration? animationDuration,
  Widget? child,
}) : assert(autofocus != null),
     assert(elevation == null || elevation >= 0.0),
     assert(focusElevation == null || focusElevation >= 0.0),
     assert(hoverElevation == null || hoverElevation >= 0.0),
     assert(highlightElevation == null || highlightElevation >= 0.0),
     assert(disabledElevation == null || disabledElevation >= 0.0),
     assert(clipBehavior != null),
       key: key,
       onPressed: onPressed,
       onLongPress: onLongPress,
       onHighlightChanged: onHighlightChanged,
       mouseCursor: mouseCursor,
       textTheme: textTheme,
       textColor: textColor,
       disabledTextColor: disabledTextColor,
       color: color,
       disabledColor: disabledColor,
       focusColor: focusColor,
       hoverColor: hoverColor,
       highlightColor: highlightColor,
       splashColor: splashColor,
       colorBrightness: colorBrightness,
       elevation: elevation,
       focusElevation: focusElevation,
       hoverElevation: hoverElevation,
       highlightElevation: highlightElevation,
       disabledElevation: disabledElevation,
       padding: padding,
       visualDensity: visualDensity,
       shape: shape,
       clipBehavior: clipBehavior,
       focusNode: focusNode,
       autofocus: autofocus,
       materialTapTargetSize: materialTapTargetSize,
       animationDuration: animationDuration,
       child: child,