1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Customize PieChartSectionData title with different styles

Discussão em 'Mobile' iniciado por Stack, Setembro 28, 2024 às 12:43.

  1. Stack

    Stack Membro Participativo

    I have a pie chart visualisation, and I want to customize its sections. Specifically, I want fund.name to be in FontWeight.bold, and fund.amount.toStringAsFixed(2) to be in green. But I do not know how to dot it, because title must be a String.

    I tried for example to convert rich text to String, but it did not work.

    I am using fl_charts: ^0.68.0

    List<PieChartSectionData> _getSections(List<fund> allFunds) {
    return allFunds.map((fund) {
    return PieChartSectionData(
    color: fund.color,
    value: fund.amount,
    title: '${fund.name}\n ${fund.amount.toStringAsFixed(2)} €',
    titlePositionPercentageOffset: 2,
    badgeWidget: SvgPicture.asset(
    fund.svg,
    height: 26,
    color: fund.color,
    ),
    badgePositionPercentageOffset: 0.5
    );
    }).toList();
    }

    Continue reading...

Compartilhe esta Página