Skip to content

Commit

Permalink
Merge pull request #535 from xinoxapps/bugfix/piechart-resize
Browse files Browse the repository at this point in the history
Bugfix/piechart resize
  • Loading branch information
imaNNeo authored Jan 25, 2021
2 parents 7e898b9 + 00b38fa commit 34d3fe6
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 @@ -162,14 +161,18 @@ 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

0 comments on commit 34d3fe6

Please sign in to comment.