variant property

StyleVariant? variant
final

The style variant of Material Design used by ElevatedButton.

Set this to StyleVariant.material3Expressive to opt elevated buttons into the Material 3 Expressive style.

If null, the variant is inherited from the closest enclosing ElevatedButtonTheme that specifies one, and then from ThemeData.elevatedButtonTheme. If none of them specify a variant, ElevatedButton uses StyleVariant.material3. To keep a subtree on Material 3 when an ancestor opts into Material 3 Expressive, set this to StyleVariant.material3.

An enclosing ElevatedButtonTheme takes precedence over ThemeData.elevatedButtonTheme, even when a closer Theme specifies a different variant. This matches ElevatedButtonTheme.of, which only uses ThemeData.elevatedButtonTheme when there is no enclosing ElevatedButtonTheme. To change the variant of a subtree, wrap it in an ElevatedButtonTheme.

See also:

Implementation

final StyleVariant? variant;