syncfusion_flutter_gauges 18.1.54 syncfusion_flutter_gauges: ^18.1.54 copied to clipboard
Syncfusion Flutter gauges library includes data visualization widgets such as radial gauge, which is written in dart, to create modern, interactive, and animated gauges.
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_gauges/gauges.dart';
import 'package:syncfusion_flutter_core/core.dart';
void main() {
// Register your license here
SyncfusionLicense.registerLicense(null);
return runApp(GaugeApp());
}
class GaugeApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Radial Gauge Demo',
theme: ThemeData(primarySwatch: Colors.blue),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
// ignore: prefer_const_constructors_in_immutables
MyHomePage({Key key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Syncfusion Flutter Radial Gauge')),
body: SfRadialGauge(
title: GaugeTitle(
text: 'Speedometer',
textStyle: const TextStyle(
fontSize: 20.0, fontWeight: FontWeight.bold)),
axes: <RadialAxis>[
RadialAxis(minimum: 0, maximum: 150, ranges: <GaugeRange>[
GaugeRange(
startValue: 0,
endValue: 50,
color: Colors.green,
startWidth: 10,
endWidth: 10),
GaugeRange(
startValue: 50,
endValue: 100,
color: Colors.orange,
startWidth: 10,
endWidth: 10),
GaugeRange(
startValue: 100,
endValue: 150,
color: Colors.red,
startWidth: 10,
endWidth: 10)
], pointers: <GaugePointer>[
NeedlePointer(value: 90)
], annotations: <GaugeAnnotation>[
GaugeAnnotation(
widget: Container(
child: const Text('90.0',
style: TextStyle(
fontSize: 25, fontWeight: FontWeight.bold))),
angle: 90,
positionFactor: 0.5)
])
]));
}
}