withoutPressLift method

ButtonStyle withoutPressLift()

This style with the same elevation whether the button is pressed or not. A style with no elevation of its own is left for the theme to decide.

Implementation

ButtonStyle withoutPressLift() {
  final resting = elevation?.resolve(const <WidgetState>{});
  if (resting == null) return this;
  return copyWith(
    elevation: WidgetStateProperty.fromMap(<WidgetStatesConstraint, double>{
      WidgetState.disabled: 0,
      WidgetState.any: resting,
    }),
  );
}