fix: show correct indicator on pie chart
This commit is contained in:
parent
af04accabf
commit
bd17e12e1b
1 changed files with 30 additions and 2 deletions
|
@ -428,11 +428,39 @@ class _CategoriesPieChartState extends State<CategoriesPieChart> {
|
||||||
(index) => Padding(
|
(index) => Padding(
|
||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
child: Indicator(
|
child: Indicator(
|
||||||
size: touchedIndex == index ? 18 : 16,
|
size: (touchedIndex != -1 &&
|
||||||
|
touchedIndex ==
|
||||||
|
widget.categories
|
||||||
|
.where(
|
||||||
|
(element) => widget.entries
|
||||||
|
.where(
|
||||||
|
(w) =>
|
||||||
|
w.category.id ==
|
||||||
|
element
|
||||||
|
.id, // TODO: more elegant fix
|
||||||
|
)
|
||||||
|
.isNotEmpty,
|
||||||
|
)
|
||||||
|
.toList()
|
||||||
|
.indexOf(widget.categories[index]))
|
||||||
|
? 18
|
||||||
|
: 16,
|
||||||
color: widget.categories[index].color,
|
color: widget.categories[index].color,
|
||||||
text: widget.categories[index].name,
|
text: widget.categories[index].name,
|
||||||
textStyle: TextStyle(
|
textStyle: TextStyle(
|
||||||
fontWeight: (touchedIndex == index)
|
fontWeight: (touchedIndex != -1 &&
|
||||||
|
touchedIndex ==
|
||||||
|
widget.categories
|
||||||
|
.where(
|
||||||
|
(element) => widget.entries
|
||||||
|
.where(
|
||||||
|
(w) =>
|
||||||
|
w.category.id == element.id,
|
||||||
|
)
|
||||||
|
.isNotEmpty,
|
||||||
|
)
|
||||||
|
.toList()
|
||||||
|
.indexOf(widget.categories[index]))
|
||||||
? FontWeight.bold
|
? FontWeight.bold
|
||||||
: FontWeight.normal,
|
: FontWeight.normal,
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue