backgroundBuilder property
final
Creates a widget that becomes the child of the button's Material
and whose child is the rest of the button, including the button's
child
parameter.
The widget created by backgroundBuilder is constrained to be the same size as the overall button and will appear behind the button's child. The widget created by foregroundBuilder is constrained to be the same size as the button's child, i.e. it's inset by ButtonStyle.padding and aligned by the button's ButtonStyle.alignment.
By default the returned widget is clipped to the Material's ButtonStyle.shape.
See also:
- foregroundBuilder, to create a widget that's as big as the button's child and is layered behind the child.
- ButtonStyleButton.clipBehavior, for more information about configuring clipping.
Implementation
final ButtonLayerBuilder? backgroundBuilder;