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 SfCircularChart.
Implementation
@override
Widget build(BuildContext context) {
_initialRender = (_widgetNeedUpdate && !_isLegendToggled)
? _needExplodeAll
: (_initialRender == null);
_prevSize = _prevSize ?? MediaQuery.of(context).size;
_didSizeChange = _prevSize != MediaQuery.of(context).size;
_prevSize = MediaQuery.of(context).size;
_oldDeviceOrientation = _oldDeviceOrientation == null
? MediaQuery.of(context).orientation
: _deviceOrientation;
_deviceOrientation = MediaQuery.of(context).orientation;
return RepaintBoundary(
child: _ChartContainer(
child: GestureDetector(
child: Container(
decoration: BoxDecoration(
color:
widget.backgroundColor ?? _chartTheme.plotAreaBackgroundColor,
image: widget.backgroundImage != null
? DecorationImage(
image: widget.backgroundImage!, fit: BoxFit.fill)
: null,
border: Border.all(
color: widget.borderColor, width: widget.borderWidth)),
child: Column(
children: <Widget>[_renderChartTitle(this), _renderChartElements()],
),
)),
));
}