getFocusElevation method Null safety

double getFocusElevation(
  1. MaterialButton button

The button's elevation when it is enabled and has focus.

Returns the button's MaterialButton.focusElevation if it is non-null.

If button is a FlatButton then the focus elevation is 0.0, otherwise the highlight elevation is 4.0.


double getFocusElevation(MaterialButton button) {
  if (button.focusElevation != null)
    return button.focusElevation!;
  if (button is FlatButton)
    return 0.0;
  return 4.0;