728x90
가로모드와 세로모드에 맞게 위젯을 설정하는 방법을 적어보겠다.
Scaffold(
body: SizedBox(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: OrientationBuilder(
builder: (context, layout) {
if (layout == Orientation.landscape) {
return const Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text('H'),
Text('M'),
Text('S'),
],
);
} else {
return const Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('H'),
Text("M"),
],
);
}
},
),
),
);
728x90
'⭐️ 개발' 카테고리의 다른 글
Flutter가 대세다!! 중고나라에서도 플러터 사용한다!! (1) | 2023.08.08 |
---|---|
flutter 라이트, 다크모드 만들기 (0) | 2023.08.08 |
함수 작동 시간 체크 (0) | 2023.07.06 |
Node - Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client (0) | 2023.07.03 |