ReinBentdal/styled_widget

Merge down widgets when possible

Closed this issue · 0 comments

When for example you style like this:

Text('some text')
  .backgroundColor(Colors.blue)
  .borderRadius(all: 10)

they will output

DecoratedBox(
  decoration: BoxDecoration(borderRadius: BorderRadius.circular(10)),
  child: DecoratedBox(
    decoration: BoxDecoration(color: Colors.blue),
    child: Text('some text'),
  ),
);

The two [DecoratedBox] should be merged into one.
This will be the case for all widgets where the child is of the same type.

  • ConstrainedBox
  • DecoratedBox