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

1.1k Views Asked by At

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.

1

There are 1 best solutions below

0
Ahmed Mahdy On BEST ANSWER

as pskink mentioned in the comments DefaultTextStyle worked well.