getLayerWidget function
Widget
getLayerWidget(
- BuildContext context,
- ChartLayer layer,
- BoundingBox bounds,
- List<
double> xIntervals, - List<
double> yIntervals, - ValueNotifier<
double?> selectedXNotifier, - EdgeInsets padding, {
- ValueChanged<
double> ? onXPressed,
Implementation
Widget getLayerWidget(
BuildContext context,
ChartLayer layer,
BoundingBox bounds,
List<double> xIntervals,
List<double> yIntervals,
ValueNotifier<double?> selectedXNotifier,
EdgeInsets padding, {
ValueChanged<double>? onXPressed,
}) =>
switch (layer) {
ChartHorizontalGridLineLayer(:final lineBuilder) =>
HorizontalChartGridLines(
padding: padding,
bounds: bounds,
intervals: yIntervals,
lineBuilder: lineBuilder,
),
ChartVerticalGridLineLayer(:final lineBuilder) => VerticalChartGridLines(
padding: padding,
bounds: bounds,
intervals: xIntervals,
lineBuilder: lineBuilder,
),
ChartSelectionLayer(
:final builder,
:final isSticky,
:final translation,
:final initialSelectedX,
:final isStatic,
) =>
ValueListenableBuilder(
valueListenable: selectedXNotifier,
builder: (context, selectedX, child) => ChartSelection(
padding: padding,
bounds: bounds,
selectedX: selectedX,
initialSelectedX: initialSelectedX,
builder: builder,
isSticky: isSticky,
translation: translation,
isStatic: isStatic,
),
),
ChartLineLayer(
:final items,
:final positiveColor,
:final negativeColor,
:final lineWidth,
:final dashArray,
) =>
Padding(
padding: padding,
child: ChartLine(
bounds: bounds,
points: items,
positiveColor: positiveColor,
negativeColor: negativeColor,
lineWidth: lineWidth,
dashArray: dashArray,
),
),
ChartAreaLayer(
:final items,
:final positiveColor,
:final negativeColor,
) =>
Padding(
padding: padding,
child: ChartArea(
bounds: bounds,
points: items,
positiveColor: positiveColor,
negativeColor: negativeColor,
),
),
ChartBarLayer(:final items) => ValueListenableBuilder(
valueListenable: selectedXNotifier,
builder: (context, selectedX, child) => Padding(
padding: padding,
child: ChartBars(
bounds: bounds,
barStacks: items,
selectedBarStacks:
items.where((item) => item.x == selectedX).toList(),
onXPressed: onXPressed,
),
),
),
ChartCursorLayer(:final builder, :final point) => Padding(
padding: padding,
child: ChartCursor(
bounds: bounds,
builder: builder,
point: point,
),
),
ChartCustomLayer(:final builder) => builder(context, bounds, padding),
};