center method

Widget center({
  1. Key? key,
  2. double? heightFactor,
  3. double? widthFactor,
})

Wraps the widget with a Center widget.

Allows for optional height and width factors to control the scaling of the centered child.

Example:

Container(width: 100, height: 100, color: Colors.red).center();

Implementation

Widget center({Key? key, double? heightFactor, double? widthFactor}) {
  return Center(
    key: key,
    heightFactor: heightFactor,
    widthFactor: widthFactor,
    child: this,
  );
}