티스토리 뷰

반응형

플러터에서 화면전환을 하고 싶다면

NavigatorCupertinoPageRoute를 보면 됩니다.

 

 

CupertinoPageRoute

전체 화면을 iOS 전환으로 대체하는 모달 경로 (modal route) 라고 합니다. 

생성자는 이렇게 생겼어요

 

 

이런식으로 이동하고자 하는 위젯을 builder에 넣어주면 됩니다. 

CupertinoPageRoute(builder: (context) => SignupWidget())

 

 

그리고 fullScreenDialog 디폴트값이 false인데요,

false이면 push처럼 동작하고 (오른쪽에서 왼쪽으로 새로운 페이지가 나타남)

 

The page slides in from the right and exits in reverse. The page also shifts to the left in parallax when another page enters to cover it.

 

 

true이면 present처럼 동작합니다.  (밑에서 위로 새로운 페이지가 올라옴) 

 

The page slides in from the bottom and exits in reverse with no parallax effect for fullscreen dialogs.

 

 

 

그리고 maintainState는 디폴트값이 true인데요,

false로 하면 화면 전환이 되고 불필요한 리소스들을 날려버린다고 합니다.

 

when a modal route is replaced by another, the previous route remains in memory. 
To free all the resources when this is not necessary, set maintainState to false.

 

 

 

 

Navigator

 

네비게이터에는 많은 Static Methods가 있습니다.

문서를 참고해주세요

 

 

저는 push, pop 써줬습니다. 

 

로그인화면에서 회원가입 버튼 누를때 push

 

회원가입화면에서 뒤로가기 누를때 pop

반응형
댓글