Skip to content

Commit

Permalink
Merge branch 'dev' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
shripal17 committed Jan 25, 2021
2 parents 8f97298 + 34d3fe6 commit 4fda5a4
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/src/chart/pie_chart/pie_chart.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import 'package:flutter/material.dart';

import 'package:fl_chart/src/chart/base/base_chart/base_chart_painter.dart';
import 'package:fl_chart/src/chart/base/base_chart/touch_input.dart';
import 'package:fl_chart/src/chart/pie_chart/pie_chart_painter.dart';
import 'package:fl_chart/src/utils/utils.dart';
import 'package:flutter/material.dart';

import 'pie_chart_data.dart';

Expand Down Expand Up @@ -199,15 +198,19 @@ class _PieChartState extends AnimatedWidgetBaseState<PieChart> {
});
},
),
child: badgeWidgets(),
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return badgeWidgets(constraints);
},
),
),
),
);
}

Widget badgeWidgets() {
final chartSize = _getChartSize();
if (chartSize != null && _widgetsPositionHandler != null) {
Widget badgeWidgets(BoxConstraints constraints) {
final chartSize = constraints.biggest;
if (_widgetsPositionHandler != null) {
final offsetsMap = _widgetsPositionHandler.getBadgeOffsets(chartSize);
if (offsetsMap.isNotEmpty) {
return CustomMultiChildLayout(
Expand Down

1 comment on commit 4fda5a4

@roberteverman
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The addition of line 201-205 (LayoutBuilder) new breaks PieCharts that do not specify a "badgeWidget" due to the return of null for a LayoutBuilder.

Please sign in to comment.