wrap method
Return a copy of this inherited theme with the specified child
.
This implementation for TooltipTheme is typical:
Widget wrap(BuildContext context, Widget child) {
return TooltipTheme(data: data, child: child);
}
Implementation
@override
Widget wrap(BuildContext context, Widget child) {
ComponentTheme<T>? ancestorTheme =
context.findAncestorWidgetOfExactType<ComponentTheme<T>>();
// if it's the same type, we don't need to wrap it
if (identical(this, ancestorTheme)) {
return child;
}
return ComponentTheme<T>(
data: data,
child: child,
);
}