OrientationBuilder 화면을 회전할때마다 다른 UI를 보여주거나 다른 값을 보여주고 싶을때 사용하는 widget 입니다.
class OrientationBuilderExample extends StatelessWidget {
const OrientationBuilderExample({Key? key}) : super(key: key);
Widget build(BuildContext context) {
return Scaffold(
body: OrientationBuilder(
builder: (context, orientation) {
return Text('화면 회전 감지: ${orientation.toString()}');
},
),
);
}
}
orientation.portrait: 가로 방향
orientation.landscape: 세로 방향