Flutter Dev Portfolio – part 4 (using extensions)

ref – https://medium.com/flutter-community/using-extension-methods-in-flutter-612b8db532ae

We extend all classes that derives from Widget with the ability of having:

1) a black colored border of width 5
2) Background color of red
3) circular border radius of 8
4) padding and margin of 16

We do so by returning a Container where we specify the decoration property.
We assign it to an instance of BoxDecoration.

From there, we simply fill in the properties of BoxDecoration.
this refers to the original Widget we are applying these attributes to. So in our case it is
AutoSizeText. When we call addContainer extension, it would return a Container where its child references
the AutoSizeText. Thus wrapping our AutoSizeText with a Container.

Then, just use like so: