CustomOrientationBuilder.portrait constructor

CustomOrientationBuilder.portrait({
  1. Key? key,
  2. required WidgetBuilder builder,
  3. ValueChanged<Orientation>? onChanged,
})

Wraps an OrientationBuilder that automatically determines the orientation and calls the appropriate builder.

Forces Orientation.portrait.

Implementation

CustomOrientationBuilder.portrait({
  super.key,
  required WidgetBuilder builder,
  this.onChanged,
})  : landscapeBuilder = builder,
      portraitBuilder = builder,
      onDispose = _defaultOnDispose {
  SystemChrome.setPreferredOrientations(<DeviceOrientation>[
    DeviceOrientation.portraitUp,
    DeviceOrientation.portraitDown,
  ]);
}