build method

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

Describes the part of the user interface represented by this widget.

The framework calls this method in a number of different situations. For example:

Here it is called whenever the user interaction is performed and it removes the old widget and updates a chart with a new widget in SfCartesianChart.

Implementation

@override
Widget build(BuildContext context) {
  _stateProperties.renderingDetails.oldDeviceOrientation =
      _stateProperties.renderingDetails.oldDeviceOrientation == null
          ? MediaQuery.of(context).orientation
          : _stateProperties.renderingDetails.deviceOrientation;
  _stateProperties.renderingDetails.deviceOrientation =
      MediaQuery.of(context).orientation;
  _stateProperties.renderingDetails.initialRender =
      _stateProperties.renderingDetails.initialRender == null;
  _stateProperties.requireInvertedAxis = false;
  _stateProperties.triggerLoaded = false;
  _stateProperties.isSeriesLoaded = _stateProperties.isSeriesLoaded ?? true;
  _findVisibleSeries(context);
  _stateProperties.isSeriesLoaded = false;

  return RepaintBoundary(
      child: ChartContainer(
          child: Container(
    decoration: BoxDecoration(
        color: widget.backgroundColor ??
            _stateProperties.renderingDetails.chartTheme.backgroundColor,
        border:
            Border.all(color: widget.borderColor, width: widget.borderWidth)),
    child: Container(
        margin: EdgeInsets.fromLTRB(widget.margin.left, widget.margin.top,
            widget.margin.right, widget.margin.bottom),
        child: Column(
          children: <Widget>[_renderTitle(), _renderChartElements(context)],
        )),
  )));
}