custom_pie_chart_label 1.0.0
custom_pie_chart_label: ^1.0.0 copied to clipboard
A customizable Pie Chart widget for Flutter with hover effects, labels, and legend support.
import 'package:flutter/material.dart';
import 'package:custom_pie_chart_label/custom_pie_chart_label.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: ChartScreen(),
);
}
}
class ChartScreen extends StatefulWidget {
const ChartScreen({super.key});
@override
State<ChartScreen> createState() => _ChartScreenState();
}
class _ChartScreenState extends State<ChartScreen> {
final ScrollController _hScroll = ScrollController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Custom Pie Chart Label Example')),
body: Center(
child: SizedBox(
child: Scrollbar(
controller: _hScroll,
thumbVisibility: true,
trackVisibility: true,
interactive: true,
thickness: 6,
notificationPredicate: (notif) =>
notif.metrics.axis == Axis.horizontal,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
controller: _hScroll,
primary: false,
child: SizedBox(
width: MediaQuery.of(context).size.width,
child: CustomChartWithLabel(
space: 2,
data: const [
PieData("Flutter", 171.06, Color(0xFF8979FF)),
PieData("Dart", 223.09, Color(0xFFFF928A)),
PieData("Firebase", 191.76, Color(0xFF3CC3DF)),
PieData("Other", 231.04, Color(0xFFFFAE4C)),
],
),
),
),
),
),
),
);
}
}