lock_orientation 0.0.2 copy "lock_orientation: ^0.0.2" to clipboard
lock_orientation: ^0.0.2 copied to clipboard

This library locks device's orientation (like PortraitUp,LandscapeLeft,LandscapeRight) and give you current orientation.

lock_orientation #

What does this library do? #

This library locks device's orientation (like PortraitUp,LandscapeLeft,LandscapeRight) and give you current orientation.

Usage #

Use lockOrientation() and unlockOrientation() whenever you want. You can also get current orientation with getOrientation().

Example #

Center(
  child: Column(mainAxisSize: MainAxisSize.min,
    children: [
      ElevatedButton(onPressed: (){
        getOrientation().then((ori) {
          setState(() {
            _orientation=ori.toString();
          });
        });
      },child: Text(_orientation),),
      Switch(value: islock, onChanged: (v){
        if(islock) {
          unlockOrientation();
        }else{
          lockOrientation();
        }
        setState(() {
          islock=v;
        });
      })
    ],
  ),
),
0
likes
110
pub points
26%
popularity

Publisher

unverified uploader

This library locks device's orientation (like PortraitUp,LandscapeLeft,LandscapeRight) and give you current orientation.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on lock_orientation