diff --git a/lib/src/legend.dart b/lib/src/legend.dart index fddcfa8..d6720a2 100644 --- a/lib/src/legend.dart +++ b/lib/src/legend.dart @@ -6,6 +6,7 @@ class Legend extends StatelessWidget { required this.color, required this.style, required this.legendShape, + required this.legendSize, Key? key, }) : super(key: key); @@ -13,6 +14,7 @@ class Legend extends StatelessWidget { final Color color; final TextStyle style; final BoxShape legendShape; + final double legendSize; @override Widget build(BuildContext context) { @@ -22,8 +24,8 @@ class Legend extends StatelessWidget { children: [ Container( margin: const EdgeInsets.symmetric(vertical: 2.0), - height: 20.0, - width: 18.0, + height: legendSize, + width: legendSize, decoration: BoxDecoration( shape: legendShape, color: color, diff --git a/lib/src/legend_options.dart b/lib/src/legend_options.dart index fa177fa..05e3bca 100644 --- a/lib/src/legend_options.dart +++ b/lib/src/legend_options.dart @@ -8,6 +8,7 @@ class LegendOptions { final BoxShape legendShape; final LegendPosition legendPosition; final Map legendLabels; + final double legendSize; const LegendOptions({ this.showLegends = true, @@ -16,5 +17,6 @@ class LegendOptions { this.legendShape = BoxShape.circle, this.legendPosition = LegendPosition.right, this.legendLabels = const {}, + this.legendSize = defaultLegendSize }); } diff --git a/lib/src/pie_chart.dart b/lib/src/pie_chart.dart index 46a89a8..8ef7a31 100644 --- a/lib/src/pie_chart.dart +++ b/lib/src/pie_chart.dart @@ -244,6 +244,7 @@ class _PieChartState extends State children: legendTitles! .map( (item) => Legend( + legendSize: widget.legendOptions.legendSize, title: item, color: isGradientPresent ? getGradient( diff --git a/lib/src/utils.dart b/lib/src/utils.dart index 1148119..c7b6cd1 100644 --- a/lib/src/utils.dart +++ b/lib/src/utils.dart @@ -11,6 +11,8 @@ const defaultLegendStyle = TextStyle( fontWeight: FontWeight.bold, ); +const defaultLegendSize = 20.0; + const List defaultColorList = [ Color(0xFFff7675), Color(0xFF74b9ff),