Reputation: 143
I am trying to use the piechart widget from the flutter_charts dependency in my flutter app but it has a margin around it taking up space inside the container widget please how can I remove the margin or padding around the pie chart. How can I remove margin or padding from the PieChart() widget
Upvotes: 1
Views: 2825
Reputation: 583
use layoutConfig
property of PieChart
layoutConfig: charts.LayoutConfig(
leftMarginSpec: charts.MarginSpec.fixedPixel(0),
topMarginSpec: charts.MarginSpec.fixedPixel(0),
rightMarginSpec: charts.MarginSpec.fixedPixel(0),
bottomMarginSpec:charts.MarginSpec.fixedPixel(0),
),
Upvotes: 6
Reputation: 141
Please use transform instead of margin
Container( transform: Matrix4.translationValues(-230.0, 0.0, 0.0), child:new charts.PieChart() )
Upvotes: 2
Reputation: 276
I also had faced the same problem but for me that one is due to the improper ratio of defining height and width on its parent widgets. Try to use 1:1 ratio for pie chart. because it always try to align on center.
Upvotes: 1