ButtonDensity class

Defines the padding density for button components.

ButtonDensity controls how much internal padding buttons have, affecting their overall size and touch target area. Different density levels are appropriate for different use cases and layout constraints.

Example:

Button.primary(
  style: ButtonStyle.primary().copyWith(density: ButtonDensity.compact),
  child: Text('Compact Button'),
);

Constructors

ButtonDensity.new(DensityModifier modifier)
Creates a ButtonDensity with the specified padding modifier.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
modifier DensityModifier
Function that modifies base padding to achieve the desired density.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

comfortable → const ButtonDensity
Increased padding for more comfortable touch targets.
compact → const ButtonDensity
Minimal padding for very compact layouts (zero padding).
dense → const ButtonDensity
Reduced padding for tighter layouts (50% of normal).
icon → const ButtonDensity
Square padding suitable for icon-only buttons.
iconComfortable → const ButtonDensity
Comfortable square padding for icon-only buttons.
iconDense → const ButtonDensity
Dense square padding for compact icon buttons.
normal → const ButtonDensity
Standard padding density (no modification).