inflearn logo
강의

Khóa học

Chia sẻ kiến thức

Tạo ứng dụng Flutter dựa trên GetX

Tạo màn hình chính

PageTransition 적용 후 뷰 적용 되지 않는 문제가 있습니다.

Đã giải quyết

214

Gavin

1 câu hỏi đã được viết

0

아래와 같이 작성후 navbar 버튼을 클릭해도 타이틀은 변경되지만, 화면 변경이 안됩니다.

 return Scaffold(
      appBar: AppBar(
        title: Obx(() => Text(controller.title.value)),
      ),
      body: SafeArea(
        child: PageTransitionSwitcher(
            transitionBuilder: (Widget child, Animation<double> anim,
                Animation<double> secondAnim) {
              return FadeThroughTransition(
                animation: secondAnim,
                secondaryAnimation: secondAnim,
                child: child,
              );
            },
            child:
                Obx(() => RouteInfo.navBarPages[controller.navBarIdx.value])),
      ),
      bottomNavigationBar: Obx(() => NavigationBar(
            selectedIndex: controller.navBarIdx.value,
            onDestinationSelected: controller.onChangeNavBar,
            destinations: [
              NavigationDestination(
                icon: const Icon(Icons.home_filled),
                label: 'navBar.home'.tr,
              ),
              NavigationDestination(
                icon: const Icon(Icons.list_alt),
                label: 'navBar.post'.tr,
              ),
              NavigationDestination(
                icon: const Icon(Icons.photo),
                label: 'navBar.photo'.tr,
              ),
            ],
          )),
    );

flutter getx

Câu trả lời 1

0

Sirius B

안녕하세요 Gavin님,

시리우스 B입니다.

저의 강의를 수강해 주셔서 정말 감사합니다!


작성해주신 코드에 오타가 하나 있어서 안되는 것 같습니다.

FadeThroughTransition

animation: secondAnim 부분을

animation: anim 으로 고치면 정상적으로 화면 전환이 될 것으로 보입니다.


작성해주신 코드의 해당 부분이 secondaryAnimation 항목과 같아서 문제가 생긴 것으로 보여요.

한번 해보시고 그래도 안 되면, 다시 한번 문의 주시기 바랍니다.

감사합니다!

 

[반영된 코드]

return Scaffold(
      appBar: AppBar(
        title: Obx(() => Text(controller.title.value)),
      ),
      body: SafeArea(
        child: PageTransitionSwitcher(
            transitionBuilder: (Widget child, Animation<double> anim,
                Animation<double> secondAnim) {
              return FadeThroughTransition(
                animation: anim,
                secondaryAnimation: secondAnim,
                child: child,
              );
            },
            child:
                Obx(() => RouteInfo.navBarPages[controller.navBarIdx.value])),
      ),
      bottomNavigationBar: Obx(() => NavigationBar(
            selectedIndex: controller.navBarIdx.value,
            onDestinationSelected: controller.onChangeNavBar,
            destinations: [
              NavigationDestination(
                icon: const Icon(Icons.home_filled),
                label: 'navBar.home'.tr,
              ),
              NavigationDestination(
                icon: const Icon(Icons.list_alt),
                label: 'navBar.post'.tr,
              ),
              NavigationDestination(
                icon: const Icon(Icons.photo),
                label: 'navBar.photo'.tr,
              ),
            ],
          )),
    );

0

Gavin

감사합니다. 오타였엇네요.

강의 잘 봤습니다.

0

22

2

25강 앱 아이콘 만드는 방법에서 그래픽 소스는 어디에 있나요?

0

26

1

자동화 프로그램 프로젝트

0

36

1

198강 (){onTap(e);}의 이해 돕기

0

52

1

Node 관련 질문입니다

0

60

3

구글 소셜 로그인 후 로그인 시 구글에러

0

49

2

실습중(개인 비용 관리 앱) 문의드려요

0

54

2

6강에 비디오가 이상해요

0

43

2

Isar 마지막 업데이트는 2년전입니다.

0

48

0

Chat GPT API 설정하기 프롬프트

0

77

2

FlutterSecureStorage 질문

0

49

0

구글 플레이 등록 시, Privact Policy URL 등록 팁

0

66

1

질문있습니다!

0

30

0

2-8강 Websocket server running on port가 안 뜹니다.

0

53

2

video_call 플러그인 설치후 에러 발생

0

64

1

회차마다 있는 실습

1

55

2

계정 관련 문의

0

72

2

구글 플레이스토어 배포시 테스트 요건

1

95

2

model, viewmodel

0

172

1

material theme

0

218

1

강의자료는 어디서 다운 받나요?

0

405

2

route의 pages

0

579

3

onChangeNavBar 질문

0

298

1

라우트 명은 어떻게 지정하나요?

0

376

1