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.0, 12.0);
final entryColor = legendEntry.color;
final color = entryColor == null ? null : ColorUtil.toDartColor(entryColor);
// Get the SymbolRendererBuilder wrapping a common.SymbolRenderer if needed.
final SymbolRendererBuilder 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: color,
enabled: !isHidden,
));
}