Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/src/legend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ class Legend extends StatelessWidget {
required this.color,
required this.style,
required this.legendShape,
required this.legendSize,
Key? key,
}) : super(key: key);

final String title;
final Color color;
final TextStyle style;
final BoxShape legendShape;
final double legendSize;

@override
Widget build(BuildContext context) {
Expand All @@ -22,8 +24,8 @@ class Legend extends StatelessWidget {
children: <Widget>[
Container(
margin: const EdgeInsets.symmetric(vertical: 2.0),
height: 20.0,
width: 18.0,
height: legendSize,
width: legendSize,
decoration: BoxDecoration(
shape: legendShape,
color: color,
Expand Down
2 changes: 2 additions & 0 deletions lib/src/legend_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class LegendOptions {
final BoxShape legendShape;
final LegendPosition legendPosition;
final Map<String,String> legendLabels;
final double legendSize;

const LegendOptions({
this.showLegends = true,
Expand All @@ -16,5 +17,6 @@ class LegendOptions {
this.legendShape = BoxShape.circle,
this.legendPosition = LegendPosition.right,
this.legendLabels = const {},
this.legendSize = defaultLegendSize
});
}
1 change: 1 addition & 0 deletions lib/src/pie_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ class _PieChartState extends State<PieChart>
children: legendTitles!
.map(
(item) => Legend(
legendSize: widget.legendOptions.legendSize,
title: item,
color: isGradientPresent
? getGradient(
Expand Down
2 changes: 2 additions & 0 deletions lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const defaultLegendStyle = TextStyle(
fontWeight: FontWeight.bold,
);

const defaultLegendSize = 20.0;

const List<Color> defaultColorList = [
Color(0xFFff7675),
Color(0xFF74b9ff),
Expand Down