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.
  const padding = 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(Container(padding: padding));
  rowChildren.add(label);
  if (measure != null) {
    rowChildren.add(Container(padding: padding));
    rowChildren.add(measure);
  }

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