Last updated:
0 purchases
orientation picker
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!'),
),
),
);
}
copied to clipboard
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!'),
),
),
);
}
copied to clipboard
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!'),
),
),
);
}
copied to clipboard
Documentation #
To generate the documentation with dartdoc:
$ dartdoc
copied to clipboard
Tests #
To run the tests:
$ flutter test
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.