Open makruhz opened 4 months ago
Describe the bug The center of the pie chart has an incorrect color when it has one PieChartSectionData in the sections parameter and the PieChartSectionData color has opacity
To Reproduce
import 'package:collection/collection.dart'; import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; void main() => runApp(const FlChartPieCharts()); class FlChartPieCharts extends StatelessWidget { const FlChartPieCharts({super.key}); static const List<double> pieChartData1 = [1]; static const List<double> pieChartData2 = [0.5, 0.5]; @override Widget build(BuildContext context) { return const MaterialApp( title: 'FL Chart Pie Charts', home: Scaffold( body: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ TestPieChart(pieChartData: pieChartData1), SizedBox(height: 32), TestPieChart(pieChartData: pieChartData2) ], ), ), ); } } class TestPieChart extends StatefulWidget { const TestPieChart({super.key, required this.pieChartData}); final List<double> pieChartData; @override State<TestPieChart> createState() => _TestPieChartState(); } class _TestPieChartState extends State<TestPieChart> { int touchedIndex = -1; @override Widget build(BuildContext context) { return AspectRatio( aspectRatio: 2, child: PieChart( PieChartData( centerSpaceColor: Colors.white, pieTouchData: PieTouchData( touchCallback: (FlTouchEvent event, pieTouchResponse) { setState(() { if (pieTouchResponse == null || pieTouchResponse.touchedSection == null) { return; } touchedIndex = pieTouchResponse.touchedSection!.touchedSectionIndex; }); }, ), sections: [ ...widget.pieChartData.mapIndexed( (index, data) => PieChartSectionData( value: data, radius: 32, color: touchedIndex == index ? Colors.green : Colors.green.withOpacity(0.5), ), ), ], ), ), ); } }
Screenshots
Versions
0.65.0 ✅
0.66.0 ❌ (and until last one)
Describe the bug The center of the pie chart has an incorrect color when it has one PieChartSectionData in the sections parameter and the PieChartSectionData color has opacity
To Reproduce
Screenshots
Versions