createSymbol method
Widget
createSymbol(
- BuildContext context,
- LegendEntry legendEntry,
- TappableLegend legend,
- bool isHidden,
Implementation
Widget createSymbol(
BuildContext context,
common.LegendEntry legendEntry,
TappableLegend legend,
bool isHidden,
) {
// TODO: Consider allowing scaling the size for the symbol.
// A custom symbol renderer can ignore this size and use their own.
const materialSymbolSize = Size(12, 12);
// Get the SymbolRendererBuilder wrapping a common.SymbolRenderer if needed.
final symbolRendererBuilder =
legendEntry.symbolRenderer! is SymbolRendererBuilder
? legendEntry.symbolRenderer! as SymbolRendererBuilder
: SymbolRendererCanvas(
legendEntry.symbolRenderer!,
legendEntry.dashPattern,
);
return GestureDetector(
onTapUp: makeTapUpCallback(context, legendEntry, legend),
child: symbolRendererBuilder.build(
context,
size: materialSymbolSize,
color: legendEntry.color,
enabled: !isHidden,
),
);
}