merge static method

Widget merge({
  1. TextStyle? style,
  2. TextAlign? textAlign,
  3. bool? softWrap,
  4. int? maxLines,
  5. TextOverflow? overflow,
  6. required Widget child,
})

Implementation

static Widget merge({
  TextStyle? style,
  TextAlign? textAlign,
  bool? softWrap,
  int? maxLines,
  TextOverflow? overflow,
  required Widget child,
}) {
  return Builder(
    builder: (Context context) {
      final parent = Theme.of(context);

      return DefaultTextStyle(
        style: parent.defaultTextStyle.merge(style),
        textAlign: textAlign ?? parent.textAlign,
        softWrap: softWrap ?? parent.softWrap,
        overflow: overflow ?? parent.overflow,
        maxLines: maxLines ?? parent.maxLines,
        child: child,
      );
    },
  );
}