donut_chart 0.0.1 copy "donut_chart: ^0.0.1" to clipboard
donut_chart: ^0.0.1 copied to clipboard

Rounded Donut Chart with a custom tooltip

example/example.dart

import 'package:donut_chart/donut_chart.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Donut Chart Package',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const DonutChartApp(),
    );
  }
}

class DonutChartApp extends StatelessWidget {
  const DonutChartApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Donut Chart Example'),
        ),
        body: DonutChartWidget(
          size: 200,
          strokeWidth: 30,
          tooltipBgColor: const Color.fromARGB(154, 178, 178, 178),
          data: [
            DonutSectionModel(label: "Instagram", value: 40, color: const Color(0xFFcd2e64)),
            DonutSectionModel(label: "Facebook", value: 30, color: const Color(0xFF4453b3)),
            DonutSectionModel(label: "X", value: 20, color: const Color(0xFF5aa9f2)),
            DonutSectionModel(label: "Threads", value: 10, color: const Color(0xFFe35655)),
          ],
        ),
      ),
    );
  }
}
5
likes
150
points
28
downloads

Publisher

unverified uploader

Weekly Downloads

Rounded Donut Chart with a custom tooltip

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on donut_chart