Search code examples
flutterflutter-layoutflutter-theme

Forcing child widget to inherit its parent's style in flutter


Many flutter widgets forces their child to inherit their style, like:

ElevatedButton(
    child: Text("Click Me."),
    onPressed: (){},
);

this ElevatedButton() will force its Text() child to inherit a specific text color, weight and so on...

My question is how to make a widget that forces its child to inherit a style from it, and Thank you ^^.

I tried using Theme widget but it's useless.


Solution

  • as pskink mentioned in the comments DefaultTextStyle worked well.