CenteredWidget extension

Extension on Widget to provide a convenience method for centering widgets.

This extension allows any widget to be easily wrapped in a Center widget, making it simple to align elements centrally in a layout.

Example usage:

Text('Hello').center();

Parameters:

  • heightFactor: Multiplier for the child's height (optional).
  • widthFactor: Multiplier for the child's width (optional).
  • key: An optional key for the Center widget.
on

Methods

center({Key? key, double? heightFactor, double? widthFactor}) → Widget

Available on Widget, provided by the CenteredWidget extension

Wraps the widget with a Center widget.