buildWithChild method
A build method that receives an extra child
parameter.
This method may be called with a child
different from the parameter
passed to the constructor of SingleChildStatelessWidget.
It may also be called again with a different child
, without this widget
being recreated.
Implementation
@override
Widget buildWithChild(BuildContext context, Widget? child) {
MediaQueryData mediaQuery =
MediaQuery.maybeOf(context) ?? const MediaQueryData();
TextStyle defaultTextStyle = _defaultTestStyle();
final Brightness platformBrightness =
_wildnessProperties.forzeThemeMode ?? mediaQuery.platformBrightness;
// MediaQuery.platformBrightnessOf(context);
return WildnessProvider(
data: Wildness(
components: _wildnessProperties.components(
brightness: platformBrightness,
),
fundations: _wildnessProperties.fundations(
brightness: platformBrightness,
),
physics: _wildnessProperties.physics,
),
child: MediaQuery(
data: mediaQuery.copyWith(
textScaler: mediaQuery.textScaler.clamp(
minScaleFactor: _wildnessProperties.minScaleFactor,
maxScaleFactor: _wildnessProperties.maxScaleFactor,
),
platformBrightness: platformBrightness,
),
child: DefaultTextStyle(
style: defaultTextStyle,
child: child ?? const SizedBox.shrink(),
),
),
);
}