LabelContainer constructor

LabelContainer({
  1. required String label,
  2. required double labelMaxWidth,
  3. required Matrix2 labelTiltMatrix,
  4. required LabelStyle labelStyle,
})

Constructs an instance for a label, it's text style, and label's maximum width.

Does not set parent container's _layoutExpansion and _chartTopContainer. It is currently assumed clients will not call any methods using them.

Implementation

LabelContainer({
  required String label,
  required double labelMaxWidth,
  required vector_math.Matrix2 labelTiltMatrix,
  required LabelStyle labelStyle,
})  : _labelMaxWidth = labelMaxWidth,
      _labelTiltMatrix = labelTiltMatrix,
      // _labelStyle = labelStyle,
      _textPainter = widgets.TextPainter(
        text: widgets.TextSpan(
          text: label,
          style: labelStyle.textStyle, // All labels share one style object
        ),
        textDirection: labelStyle.textDirection,
        textAlign: labelStyle.textAlign,
        // center in available space
        textScaleFactor: labelStyle.textScaleFactor,
        // removed, causes lockup: ellipsis: "...", // forces a single line - without it, wraps at width
      ),
      //  textScaleFactor does nothing ??
      super() {
  // var text = new widgets.TextSpan(
  //   text: label,
  //   style: _labelStyle.textStyle, // All labels share one style object
  // );
  // _textPainter = new widgets.TextPainter(
  //   text: text,
  //   textDirection: _labelStyle.textDirection,
  //   textAlign: _labelStyle.textAlign,
  //   // center in available space
  //   textScaleFactor: _labelStyle.textScaleFactor,
  //   // todo-02 add to test - was removed, causes lockup: ellipsis: "...", // forces a single line - without it, wraps at width
  // ); //  textScaleFactor does nothing ??
}