frame method
Frames this widget position.
For example, this, in conjunction with other extensions, can be used to create an icon with a circle background.
Icon(ZdsIcons.walk)
.frame(width: 30, height: 30, alignment: Alignment.center)
.backgroundColor(Theme.of(context).colorScheme.primary.withLight(0.1))
.circle(30),
Implementation
Widget frame({
double? width = double.infinity,
double? height = double.infinity,
Alignment? alignment,
}) {
Widget content = this;
if (alignment != null) {
content = Align(
alignment: alignment,
child: this,
);
}
return SizedBox(
width: width,
height: height,
child: content,
);
}