Open abdimussa87 opened 1 year ago
Same here
Listen compass events for accuracy. If accuracy is null, compass needs to be calibrated.
StreamSubscription<CompassEvent>? _compassSubscription;
bool _isCompassCalibrated = true;
@override
void initState() {
super.initState();
_compassSubscription = FlutterCompass.events?.listen((event) {
if (!mounted) return;
setState(() {
_currentHeading = event.heading;
_isCompassCalibrated = event.accuracy != null;
});
});
}
if (!_isCompassCalibrated)
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Compass is not calibrated. Please wave your device in a figure-8 motion.',
style: TextStyle(
color: Colors.red,
),
textAlign: TextAlign.center,
),
),
I wanted to show a calibration required gif if the compass requires calibration. How can I detect that?