@@ -52,54 +52,61 @@ class _MyHomePageState extends State<MyHomePage> {
5252 body: Center (
5353 child: SfRadialGauge (axes: < RadialAxis > [
5454 RadialAxis (
55- axisLineStyle: AxisLineStyle (
56- thickness: 0.2 , thicknessUnit: GaugeSizeUnit .factor),
57- showTicks: false ,
58- showLabels: true ,
59- pointers: < GaugePointer > [
60- RangePointer (
61- value: 60 ,
62- onValueChanged: onPointerValueChanged,
63- enableDragging: true ,
64- width: 0.2 ,
65- sizeUnit: GaugeSizeUnit .factor),
66- ],
67- annotations: < GaugeAnnotation > [
68- GaugeAnnotation (
69- widget: Row (
70- children: < Widget > [
71- Text (
72- '$_annotationValue ' ,
73- style: TextStyle (
74- fontSize: 16 ,
75- fontFamily: 'Times' ,
76- fontWeight: FontWeight .bold,
77- color: const Color (0xFF00A8B5 )),
78- ),
79- Text (
80- ' %' ,
81- style: TextStyle (
82- fontSize: 16 ,
83- fontFamily: 'Times' ,
84- fontWeight: FontWeight .bold,
85- color: const Color (0xFF00A8B5 )),
86- )
87- ],
55+ axisLineStyle: AxisLineStyle (
56+ thickness: 0.2 ,
57+ thicknessUnit: GaugeSizeUnit .factor,
58+ ),
59+ showTicks: false ,
60+ showLabels: true ,
61+ pointers: [
62+ RangePointer (
63+ value: _pointerValue,
64+ onValueChanged: onPointerValueChanged,
65+ enableDragging: true ,
66+ width: 0.2 ,
67+ sizeUnit: GaugeSizeUnit .factor,
68+ ),
69+ ],
70+ annotations: [
71+ GaugeAnnotation (
72+ widget: Row (
73+ mainAxisSize: MainAxisSize .min,
74+ children: [
75+ Text (
76+ '${_pointerValue .toInt ()}' ,
77+ style: TextStyle (
78+ fontSize: 16 ,
79+ fontFamily: 'Times' ,
80+ fontWeight: FontWeight .bold,
81+ color: const Color (0xFF00A8B5 ),
82+ ),
8883 ),
89- positionFactor: 0.13 ,
90- angle: 0 )
91- ])
84+ Text (
85+ ' %' ,
86+ style: TextStyle (
87+ fontSize: 16 ,
88+ fontFamily: 'Times' ,
89+ fontWeight: FontWeight .bold,
90+ color: const Color (0xFF00A8B5 ),
91+ ),
92+ ),
93+ ],
94+ ),
95+ positionFactor: 0 ,
96+ angle: 0 ,
97+ ),
98+ ],
99+ ),
92100 ]),
93101 ),
94102 );
95103 }
96104
97105 void onPointerValueChanged (double value) {
98106 setState (() {
99- final int _value = value.toInt ();
100- _annotationValue = '$_value ' ;
107+ _pointerValue = value;
101108 });
102109 }
103110
104- String _annotationValue = '60' ;
111+ double _pointerValue = 60.0 ;
105112}
0 commit comments