return SfRadialGauge(
title: GaugeTitle(
text: 'Speedometer',
textStyle:
const TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold)),
axes: <RadialAxis>[
RadialAxis(
minimum: 0,
maximum: 320,
startAngle: 180,
endAngle: 0,
// showLabels: false,
maximumLabels: 320,
onLabelCreated: _handleLabelCreated,
canRotateLabels: true,
labelsPosition: ElementsPosition.outside,
ticksPosition: ElementsPosition.outside,
showTicks: false,
radiusFactor: 1.1,
axisLineStyle: AxisLineStyle(
thickness: 5,
dashArray: <double>[(320+100) / 5, 3],
// color: Color(0xFF66BB6A)
gradient: SweepGradient(colors: <Color>[
Color(0xFFE7627D),
Color(0xFF231557),
Color(0xFF44107A),
Color(0xFFFF1361),
Color(0xFFFFF800),
], stops: <double>[
0,
100,
190,
240,
320
])
),
/* ranges: <GaugeRange>[
GaugeRange(
startValue: 0,
endValue: 100,
color: Colors.green,
),
GaugeRange(
startValue: 100,
endValue: 210,
color: Colors.orange,
),
GaugeRange(
startValue: 210,
endValue: 320,
color: Colors.red,
)
],*/
annotations: <GaugeAnnotation>[
GaugeAnnotation(
angle: 180,
horizontalAlignment: GaugeAlignment.near,
positionFactor: 0.78,
verticalAlignment: GaugeAlignment.near,
widget: Text(
"0",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 14,
),
)),
GaugeAnnotation(
angle: 0,
horizontalAlignment: GaugeAlignment.far,
positionFactor: 0.85,
verticalAlignment: GaugeAlignment.near,
widget: Text(
"320",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 14,
),
)),
GaugeAnnotation(
axisValue: 100,
positionFactor: 0.5,
angle: 90,
widget: Column(children: [
Center(
child: RichText(
textAlign: TextAlign.center,
text: TextSpan(
text: '223\n',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 30,
),
children: [
TextSpan(
text: 'Points earned this month',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.normal,
fontSize: 12,
),
)
],
)),
)
]))
],
pointers: <GaugePointer>[
MarkerPointer(
value: 223,
markerHeight: 15,
markerWidth: 15,
enableDragging: true,
overlayRadius: 12,
borderColor: Colors.green,
borderWidth: 2,
color: Colors.white,
markerType: MarkerType.circle)
],
)
]);
void _handleLabelCreated(AxisLabelCreatedArgs args) {
if (args.text == '30') {
args.text = '£0 - £4';
} else if (args.text == '100') {
args.text = '£4 - £8';
} else if (args.text == '165') {
args.text = '£8 - £12';
} else if (args.text == '235') {
args.text = '£12 - £16';
} else if (args.text == '290') {
args.text = '£16 - £20';
} else {
args.text = '';
}
I have to develop this type of UI using plugin.but there is some point remaining like color we are not achieve after pointer and how equally segment divided and how responsive for all device that need to check.
I have done below part from my side and remaining thing need to add that i mention .So suggest me how can i achieve .