DefaultTextStyle constructor

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

Creates a default text style for the given subtree.

Consider using DefaultTextStyle.merge to inherit styling information from the current default text style for a given BuildContext.

The maxLines property may be null (and indeed defaults to null), but if it is not null, it must be greater than zero.

Implementation

const DefaultTextStyle({
  super.key,
  required this.style,
  this.textAlign,
  this.softWrap = true,
  this.overflow = TextOverflow.clip,
  this.maxLines,
  this.textWidthBasis = TextWidthBasis.parent,
  this.textHeightBehavior,
  required super.child,
}) : assert(maxLines == null || maxLines > 0);