alignCenter method
Aligns the widget to the center of its parent container. Optionally, width and height can be provided to constrain the widget's size.
Example usage:
Text('Center').alignCenter(width: 150, height: 50);
Parameters:
width: Optional width for the widget.height: Optional height for the widget.
Implementation
Widget alignCenter({double? width, double? height}) {
return Align(
alignment: Alignment.center,
child: SizedBox(
width: width,
height: height,
child: this,
),
);
}