ReinBentdal / styled_widget

Simplifying widget style in Flutter.
https://pub.dev/packages/styled_widget
MIT License
1.27k stars 103 forks source link

Make extension params nullable #61

Closed f69 closed 3 years ago

f69 commented 3 years ago

Please, make extension params nullable, where underlying class params are nullable. For example, now (in version 0.3.1) you cant write:

Text(message).textColor(isError ? Colors.red : null)

to change text color (from default) only for some condition. All params of TextStyle class are nullable.

ReinBentdal commented 3 years ago

Yes that should be fixed.

I would suggest adding styles applied to a widget in the traditional way

Text(message, style: TextStyle(color: isError ? Colors.red : null))

The method applied to the Text widget mutates the original widget before applying the new changes. This is less performant compared to applying style when the widget is created.

ReinBentdal commented 3 years ago

fixed