mellowares_pie_chart 0.1.0
mellowares_pie_chart: ^0.1.0 copied to clipboard
A donut-style pie chart with rounded, gapped segments and a fully custom corner radius — segments can be rounded by any amount, not just half the ring's thickness.
import 'package:flutter/material.dart';
import 'package:mellowares_pie_chart/mellowares_pie_chart.dart';
void main() => runApp(const ExampleApp());
class ExampleApp extends StatelessWidget {
const ExampleApp({super.key});
@override
Widget build(final BuildContext context) {
return MaterialApp(
title: 'mellowares_pie_chart example',
home: Scaffold(
appBar: AppBar(title: const Text('mellowares_pie_chart')),
body: Center(
child: Padding(
padding: const EdgeInsets.all(32),
child: MellowaresPieChart(
cornerRadius: 8,
segments: const <PieChartSegment>[
PieChartSegment(value: 40, color: Colors.deepPurple, data: 'A'),
PieChartSegment(value: 25, color: Colors.blue, data: 'B'),
PieChartSegment(value: 20, color: Colors.teal, data: 'C'),
PieChartSegment(value: 10, color: Colors.orange, data: 'D'),
PieChartSegment(value: 5, color: Colors.pink, data: 'E'),
],
centerBuilder: (
final BuildContext context,
final PieChartSegment? touched,
final int index,
) {
if (touched == null) {
return const Text('Tap a segment');
}
return Text(
'${touched.data}: ${touched.value.toStringAsFixed(0)}');
},
),
),
),
),
);
}
}