defaultTextStyle method

Widget defaultTextStyle({
  1. required TextStyle style,
  2. bool merge = true,
  3. Key? key,
  4. TextAlign? textAlign,
  5. bool softWrap = true,
  6. TextOverflow overflow = TextOverflow.clip,
  7. int? maxLines,
  8. TextWidthBasis textWidthBasis = TextWidthBasis.parent,
  9. TextHeightBehavior? textHeightBehavior,
})

The text style to apply to descendant Text widgets which don't have an explicit style.

If merge is true, the style is merged with other inherited text attributes.

Implementation

Widget defaultTextStyle({
  required TextStyle style,
  bool merge = true,
  Key? key,
  TextAlign? textAlign,
  bool softWrap = true,
  TextOverflow overflow = TextOverflow.clip,
  int? maxLines,
  TextWidthBasis textWidthBasis = TextWidthBasis.parent,
  TextHeightBehavior? textHeightBehavior,
}) {
  if (merge) {
    return DefaultTextStyle.merge(
      key: key,
      style: style,
      textAlign: textAlign,
      softWrap: softWrap,
      overflow: overflow,
      maxLines: maxLines,
      textWidthBasis: textWidthBasis,
      child: this,
    );
  }
  return DefaultTextStyle(
    key: key,
    style: style,
    textAlign: textAlign,
    softWrap: softWrap,
    overflow: overflow,
    maxLines: maxLines,
    textWidthBasis: textWidthBasis,
    textHeightBehavior: textHeightBehavior,
    child: this,
  );
}