Guest User

Radial gauge bug

a guest
Aug 20th, 2024
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 5.08 KB | None | 0 0
  1.           child: Container(
  2.             decoration: BoxDecoration(
  3.               border: Border.all(color: Colors.blue, width: 2),
  4.             ),
  5.             child: SfRadialGauge(
  6.               enableLoadingAnimation: false,
  7.               axes: [
  8.                 ...List.generate(vendor.items.length, (index) {
  9.                   final el = vendor.items[index];
  10.  
  11.                   final pointer = RangePointer(
  12.                     value: el.endValue - el.startValue + 1,
  13.                     color: el.color,
  14.                     cornerStyle: CornerStyle.bothCurve,
  15.                     width: 10,
  16.                     enableAnimation: false,
  17.                   );
  18.  
  19.                   double sAngle = (el.startValue - vendor.bad.min) / ((vendor.buren.max - vendor.bad.min) + 40) * 180;
  20.                   double eAngle = pointer.value / ((vendor.buren.max - vendor.bad.min) + 40) * 180;
  21.  
  22.                   return RadialAxis(
  23.                     axisLineStyle: const AxisLineStyle(cornerStyle: CornerStyle.endCurve),
  24.                     radiusFactor: 0.75,
  25.                     showAxisLine: false,
  26.                     showTicks: false,
  27.                     showLabels: false,
  28.                     startAngle: 180 + sAngle,
  29.                     endAngle: 180 + sAngle + eAngle,
  30.                     minimum: 0,
  31.                     maximum: pointer.value,
  32.                     showLastLabel: true,
  33.                     pointers: [pointer],
  34.                   );
  35.                 }).toList(),
  36.                 RadialAxis(
  37.                   axisLineStyle: const AxisLineStyle(cornerStyle: CornerStyle.endCurve),
  38.                   radiusFactor: 0.75,
  39.                   showAxisLine: false,
  40.                   showTicks: false,
  41.                   showLabels: false,
  42.                   startAngle: 180,
  43.                   endAngle: 360,
  44.                   minimum: vendor.bad.min,
  45.                   maximum: vendor.buren.max + 40,
  46.                   showLastLabel: true,
  47.                   pointers: [
  48.                     MarkerPointer(
  49.                       // value: provider.visibility ? point : 0,
  50.                       value: vendor.formattedPoint,
  51.                       markerType: MarkerType.circle,
  52.                       color: provider.visibility ? (vendor.scoreItem?.color != null ? Colors.white : Colors.transparent) : Colors.transparent,
  53.                       // borderColor: kTheme.primaryColor.withOpacity(0.6),
  54.                       borderColor: provider.visibility ? vendor.scoreItem?.color ?? Colors.transparent : Colors.transparent,
  55.                       borderWidth: 5,
  56.                       markerHeight: 18,
  57.                       markerWidth: 18,
  58.                       enableAnimation: true,
  59.                     ),
  60.                   ],
  61.                   annotations: [
  62.                     const GaugeAnnotation(
  63.                       widget: Padding(
  64.                         padding: EdgeInsets.only(top: 30),
  65.                         child: Text(
  66.                           '300',
  67.                           style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
  68.                         ),
  69.                       ),
  70.                       angle: 180,
  71.                       positionFactor: 1,
  72.                     ),
  73.                     const GaugeAnnotation(
  74.                       widget: Padding(
  75.                         padding: EdgeInsets.only(top: 30),
  76.                         child: Text(
  77.                           '999',
  78.                           style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
  79.                         ),
  80.                       ),
  81.                       angle: 360,
  82.                       positionFactor: 1,
  83.                     ),
  84.                     GaugeAnnotation(
  85.                       angle: 90,
  86.                       positionFactor: 0.0,
  87.                       verticalAlignment: GaugeAlignment.far,
  88.                       widget: Transform.translate(
  89.                         offset: const Offset(0, -10),
  90.                         child: Column(
  91.                           mainAxisSize: MainAxisSize.min,
  92.                           children: [
  93.                             Column(
  94.                               mainAxisAlignment: MainAxisAlignment.end,
  95.                               children: [
  96.                                 Text(
  97.                                   provider.visibility ? '${initialPoint.toInt()}' : '***',
  98.                                   style: const TextStyle(fontSize: 24, fontWeight: FontWeight.bold, color: Color(0xff24272C)),
  99.                                 ),
  100.                                 const SizedBox(height: 8),
  101.                                 Text(
  102.                                   provider.visibility ? (vendor.scoreItem?.text ?? "") : "***",
  103.                                   style: const TextStyle(fontSize: 28, fontWeight: FontWeight.bold),
  104.                                 ),
  105.                               ],
  106.                             ),
  107.                           ],
  108.                         ),
  109.                       ),
  110.                     ),
  111.                   ],
  112.                 )
  113.               ],
  114.             ),
  115.           ),
  116.  
Advertisement
Add Comment
Please, Sign In to add comment