build method

  1. @override
Widget build(
  1. BuildContext context,
  2. LegendEntry legendEntry,
  3. TappableLegend legend,
  4. bool isHidden, {
  5. bool showMeasures = false,
})
override

Implementation

@override
Widget build(BuildContext context, common.LegendEntry legendEntry,
    TappableLegend legend, bool isHidden,
    {bool showMeasures = false}) {
  final rowChildren = <Widget>[];

  // TODO: Allow setting to configure the padding.
  final padding = new EdgeInsets.only(right: 8.0); // Material default.
  final symbol = createSymbol(context, legendEntry, legend, isHidden);
  final label = createLabel(context, legendEntry, legend, isHidden);

  final measure = showMeasures
      ? createMeasureValue(context, legendEntry, legend, isHidden)
      : null;

  rowChildren.add(symbol);
  rowChildren.add(new Container(padding: padding));
  rowChildren.add(label);
  if (measure != null) {
    rowChildren.add(new Container(padding: padding));
    rowChildren.add(measure);
  }

  // Row automatically reverses the content if Directionality is rtl.
  return new Row(children: rowChildren);
}