xbAnnulusChartDefBottomBuilder function

Widget xbAnnulusChartDefBottomBuilder(
  1. List<XBAnnulusChartModel> models
)

Implementation

Widget xbAnnulusChartDefBottomBuilder(List<XBAnnulusChartModel> models) {
  final total = xbAnnulusChartTotal(models);
  return LayoutBuilder(
    builder: (context, constraints) {
      double gap = 15;
      return Padding(
        padding: const EdgeInsets.only(top: 10),
        child: Wrap(
          children: List.generate(models.length, (index) {
            final model = models[index];
            return SizedBox(
              width: constraints.maxWidth * 0.5,
              child: Padding(
                padding: EdgeInsets.only(
                    bottom: 5,
                    right: index % 2 == 0 ? gap * 0.5 : 0,
                    left: index % 2 != 0 ? gap * 0.5 : 0),
                child: XBAnnulusChartNameWidget(
                  color: model.color,
                  name: model.name,
                  textColor: model.isSelected ? model.color : Colors.black,
                  value: '${model.value.toStringAsFixed(0)}次',
                  scale: total == 0
                      ? '0.00%'
                      : '${(model.value / total * 100).toStringAsFixed(2)}%',
                ),
              ),
            );
          }),
        ),
      );
    },
  );
}