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
130
points
22
downloads

Publisher

unverified uploader

Weekly Downloads

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

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on lock_orientation

Packages that implement lock_orientation