Easy Pie Chart Package
The Easy Pie Chart package provides a versatile pie chart widget for Flutter applications. It offers various customization options to create interactive and visually appealing pie charts.
Features
- Three Pie Chart Variants:
- Crust: Only border, no fill.
- TriCrust: Borders around each pie slice.
- Fill: Filled pie slices.
- Interactive Pie Slices:
- Each pie slice is interactive and responds to user taps.
- Customization Options:
- Adjustable gap between pie slices.
- Control over the border edge style (rounded, squared, etc.).
- Start angle of the pie chart can be customized.
- Text or widget display options inside the pie chart.
- Animations: Clockwise and anti-clockwise animations with adjustable duration.
Getting started
To use this package, add the following line to your pubspec.yaml
file:
dependencies: easy_pie_chart: ^version
Then, import the package in your Dart file:
import 'package:easy_pie_chart/easy_pie_chart.dart';
Usage
Here’s a simple example of creating a Easy pie chart:
PieChart( children: [ PieData(value: 30, color: Colors.red), PieData(value: 50, color: Colors.blue), ], )
For more examples, check out the /example folder in this repository.
Properties
NameDescriptionDefault ValueData TypeRequiredchildrenList of PieData objects representing each pie slice.–ListYesshowValueDetermines whether the value is shown on each pie slice.trueboolNostartStarting angle of the pie chart in degrees.-90doubleNogapGap between pie chart slices.0.0doubleNoborderWidthWidth of the border for crust and triCrust pie types.30.0doubleNoborderEdgeEdge shape of the border for crust pie type.StrokeCap.roundStrokeCapNoshouldAnimateDetermines if the pie chart animates clockwise during build.trueboolNoanimateDurationDuration of the animation.1500msDuration?NoanimateFromEndIf true, animation starts anti-clockwise.falseboolNocenterTextText to be displayed at the center of the pie chart.nullString?NostyleTextStyle for centerText.nullTextStyle?NocenterStyleTextStyle for the value displayed on each pie slice.nullTextStyle?NopieTypeEnum defining the pie chart type (crust, triCrust, fill).PieType.crustPieTypeNoonTapFunction triggered when a pie slice is tapped.nullvoid Function(int)?NosizeSize of the pie chart.200.0doubleNo
Contribution and Issues
Contributions and bug reports are welcome! Feel free to create pull requests and issues on the GitHub repository.
License
This package is available under the MIT License.