aeyrium / aeyrium-sensor

A Flutter sensor plugin which provide easy access to the Pitch and Roll on Android and iOS devices.
https://aeyrium.com
MIT License
57 stars 33 forks source link

Update the Android sensor code. #2

Open slightfoot opened 5 years ago

slightfoot commented 5 years ago

This still requires similar changes on iOS.

diegoveloper commented 5 years ago

We'll wait until we complete the iOS changes. Thanks @slightfoot

diegoveloper commented 5 years ago

I was testing the PR, looks like there is an issue related with the lowPassFilter, this is a basic example to reproduce the issue :

class _RotationLayoutState extends State<RotationLayout> {
  StreamSubscription<dynamic> _streamSubscriptions;
  double rotation = 0.0;

  @override
  void dispose() {
    _streamSubscriptions?.cancel();
    super.dispose();
  }

  @override
  void initState() {
    _streamSubscriptions =
        AeyriumSensor.sensorEvents.listen((SensorEvent event) {
      setState(() {
        rotation = -event.roll;
      });
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Transform.rotate(
      angle: rotation,
      child: Center(
        child: Container(
          width: 250.0,
          height: 200.0,
          color: Colors.red,
        ),
      ),
    );
  }

When the device is rotated there are some glitches which doesn't happen without using the lowPassFilter.

@slightfoot

slightfoot commented 5 years ago

Ah good to find out the cause of the glitches. Me and @scotts2017 will look into it further and update the PR when we can.

RyanRamchandar commented 4 years ago

@slightfoot Any plans to resume work on this?

lovemory commented 3 years ago

@slightfoot Any plans to resume work on this?