Line data Source code
1 : // Copyright 2023 The terCAD team. All rights reserved. 2 : // Use of this source code is governed by a CC BY-NC-ND 4.0 license that can be found in the LICENSE file. 3 : 4 : import 'package:app_finance/charts/interface/chart_value.dart'; 5 : import 'package:app_finance/charts/painter/pie_radius_painter.dart'; 6 : import 'package:flutter/material.dart'; 7 : 8 : class PieRadiusChart extends StatelessWidget { 9 : final double width; 10 : final double indent; 11 : final List<ChartValue> data; 12 : 13 0 : const PieRadiusChart({ 14 : super.key, 15 : required this.data, 16 : required this.width, 17 : this.indent = 0.0, 18 : }); 19 : 20 0 : @override 21 : Widget build(BuildContext context) { 22 0 : data.sort((a, b) => b.value.compareTo(a.value)); 23 0 : return SizedBox( 24 0 : width: width / 2, 25 0 : height: width / 2, 26 0 : child: CustomPaint( 27 0 : painter: PieRadiusPainter( 28 : indent: 0.015, 29 0 : data: data, 30 : ), 31 : ), 32 : ); 33 : } 34 : }