Skip to content

Commit

Permalink
Merge pull request imaNNeo#524 from imaNNeoFighT/hotfix/pie-chart-fir…
Browse files Browse the repository at this point in the history
…st-frame

Fixed PieChart badges draw in first frame problem, imaNNeo#513.
  • Loading branch information
imaNNeo authored Dec 24, 2020
2 parents 3f83ebd + 97f730c commit 21b3b78
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## newVersion
* [Bugfix] Fixed PieChart badges draw in first frame problem, #513.

## 0.12.1
* [Bugfix] Fixed PieChart badges bug with re-implementing the solution, #507
* [Bugfix] Fix the setState issue using PieChart in the ListView, #467
Expand Down
11 changes: 11 additions & 0 deletions lib/src/chart/pie_chart/pie_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ class _PieChartState extends AnimatedWidgetBaseState<PieChart> {
/// this is used to retrieve the chart size to handle the touches
final GlobalKey _chartKey = GlobalKey();

@override
void initState() {
/// Make sure that [_widgetsPositionHandler] is updated.
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) {
setState(() {});
}
});
super.initState();
}

@override
Widget build(BuildContext context) {
final PieChartData showingData = _getData();
Expand Down

0 comments on commit 21b3b78

Please sign in to comment.