orientation_picker 0.1.0 copy "orientation_picker: ^0.1.0" to clipboard
orientation_picker: ^0.1.0 copied to clipboard

A simple convenience widget for Flutter to conditionally display (or hide) other widgets based on device orientation (or aspect ratio).

orientation_picker #

A simple convenience widget for Flutter to conditionally display (or hide) other widgets based on device orientation (or aspect ratio).

Usage #

OrientationPicker({required Widget portrait, required Widget landscape}) #

Supply two widgets, one for portrait layout and the other for landscape layout. The widget will pick the appropriate one based on the current orientation.

Widget build(BuildContext context) {
  return MaterialApp(
    home: Scaffold(
      body: OrientationPicker(
        landscape: Text('Now in landscape-mode!'),
        portrait: Text('Now in portrait-mode!'),
      ),
    ),
  );
}

OrientationPicker.portraitOnly(Widget widget) #

Supply a widget, which will only be displayed when the orientation is portrait.

Widget build(BuildContext context) {
  return MaterialApp(
    home: Scaffold(
      body: OrientationPicker.portraitOnly(
        Text('Only visible in portrait-mode!'),
      ),
    ),
  );
}

OrientationPicker.landscapeOnly(Widget widget) #

Supply a widget, which will only be displayed when the orientation is landscape.

Widget build(BuildContext context) {
  return MaterialApp(
    home: Scaffold(
      body: OrientationPicker.landscapeOnly(
        Text('Only visible in landscape-mode!'),
      ),
    ),
  );
}

Documentation #

To generate the documentation with dartdoc:

$ dartdoc

Tests #

To run the tests:

$ flutter test
2
likes
140
pub points
0%
popularity

Publisher

unverified uploader

A simple convenience widget for Flutter to conditionally display (or hide) other widgets based on device orientation (or aspect ratio).

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on orientation_picker