wrap method

  1. @override
Widget wrap (
  1. BuildContext context,
  2. Widget child

Return a copy of this inherited theme with the specified child.

If the identical inherited theme is already visible from context then just return the child.

This implementation for TooltipTheme is typical:

Widget wrap(BuildContext context, Widget child) {
  final TooltipTheme ancestorTheme = context.findAncestorWidgetOfExactType<TooltipTheme>());
  return identical(this, ancestorTheme) ? child : TooltipTheme(data: data, child: child);


Widget wrap(BuildContext context, Widget child) {
  final DefaultTextStyle defaultTextStyle = context.findAncestorWidgetOfExactType<DefaultTextStyle>();
  return identical(this, defaultTextStyle) ? child : DefaultTextStyle(
    style: style,
    textAlign: textAlign,
    softWrap: softWrap,
    overflow: overflow,
    maxLines: maxLines,
    textWidthBasis: textWidthBasis,
    textHeightBehavior: textHeightBehavior,
    child: child,