build method

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

Implementation

@override
Widget build(Context context) {
  final datasets = Chart.of(context).datasets;

  final Widget wrap = Wrap(
    direction: direction,
    spacing: 10,
    runSpacing: 10,
    crossAxisAlignment: direction == Axis.horizontal
        ? WrapCrossAlignment.center
        : WrapCrossAlignment.start,
    children: <Widget>[
      for (final Dataset dataset in datasets)
        if (dataset.legend != null) _buildLegend(context, dataset)
    ],
  );

  return Align(
    alignment: position,
    child: Container(
      decoration: decoration ?? const BoxDecoration(color: PdfColors.white),
      padding: padding,
      child: wrap,
    ),
  );
}