build method

  1. @override
Widget build(
  1. Context context
)
override

Implementation

@override
Widget build(Context context) {
  final defaultStyle = Theme.of(context).defaultTextStyle.copyWith(
        font: Font.courier(),
        fontNormal: Font.courier(),
        fontBold: Font.courierBold(),
        fontItalic: Font.courierOblique(),
        fontBoldItalic: Font.courierBoldOblique(),
        lineSpacing: 1,
        fontSize: height != null ? height! * 0.2 : null,
      );
  final _textStyle = defaultStyle.merge(textStyle);

  Widget child = _BarcodeWidget(
    dataBytes,
    dataString,
    barcode,
    color,
    drawText,
    _textStyle,
    textPadding,
  );

  if (padding != null) {
    child = Padding(padding: padding!, child: child);
  }

  if (decoration != null) {
    child = DecoratedBox(
      decoration: decoration!,
      child: child,
    );
  } else if (backgroundColor != null) {
    child = DecoratedBox(
      decoration: BoxDecoration(color: backgroundColor),
      child: child,
    );
  }

  if (width != null || height != null) {
    child = SizedBox(width: width, height: height, child: child);
  }

  if (margin != null) {
    child = Padding(padding: margin!, child: child);
  }

  return child;
}