build method
Describes the part of the user interface represented by this widget.
The framework calls this method in a number of different situations. For example:
- After calling initState.
- After calling didUpdateWidget.
- After receiving a call to setState.
- After a dependency of this State object changes.
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) {
_oldDeviceOrientation = _oldDeviceOrientation == null
? MediaQuery.of(context).orientation
: _deviceOrientation;
_deviceOrientation = MediaQuery.of(context).orientation;
_initialRender = _initialRender == null;
_requireInvertedAxis = false;
_triggerLoaded = false;
_isSeriesLoaded = _isSeriesLoaded ?? true;
_findVisibleSeries(context);
_isSeriesLoaded = false;
return RepaintBoundary(
child: _ChartContainer(
child: Container(
decoration: BoxDecoration(
color: widget.backgroundColor ?? _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)],
)),
)));
}