bubble_chart 0.3.0 bubble_chart: ^0.3.0 copied to clipboard
A simple Dart implementation of bubble chart. It creates bubbles in random points and collide its all to container center. Can be implemented with any features.
import 'package:bubble_chart/bubble_chart.dart';
import 'package:flutter/material.dart';
final root = BubbleNode.node(
padding: 15,
children: [
BubbleNode.node(
padding: 30,
children: [
BubbleNode.leaf(
options: BubbleOptions(
color: Colors.brown,
),
value: 2583,
),
BubbleNode.leaf(
options: BubbleOptions(
color: Colors.brown,
),
value: 4159,
),
BubbleNode.leaf(
options: BubbleOptions(
color: Colors.brown,
),
value: 4159,
),
],
),
BubbleNode.leaf(
value: 4159,
),
BubbleNode.leaf(
value: 2074,
),
BubbleNode.leaf(
value: 4319,
),
BubbleNode.leaf(
value: 2074,
),
BubbleNode.leaf(
value: 2074,
),
BubbleNode.leaf(
value: 2074,
),
BubbleNode.leaf(
value: 2074,
),
],
);
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
brightness: Brightness.dark,
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
height: 600,
width: 600,
child: BubbleChartLayout(
root: root,
),
),
);
}
}