• 카테고리

    질문 & 답변
  • 세부 분야

    모바일 앱 개발

  • 해결 여부

    미해결

ThemeData 미적용

22.02.07 17:08 작성 조회수 353

0

 
 
메인에 테마를 바꿀려고 primaryColor와 accentColor를 적용했는데 파란색에서 색이 바뀌질 않습니다.
primarySwatch를 지워도 계속 파란색이던데 무엇이 문제인가요?
 
 
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요!
- 먼저 유사한 질문이 있었는지 검색해보세요.
- 서로 예의를 지키며 존중하는 문화를 만들어가요.
- 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요.

답변 1

답변을 작성해보세요.

0

어두운 테마를 원하시는 거라면 canvasColor로 배경색을 textTheme에서 글자 색상을 조절하는 방법이 있습니다. 앱바는 appBarTheme 속성을 수정해야 하고 ThemeData에는 엄청 많은 여러 테마를 따로 설정하도록 되어 있습니다. 샘플코드를 제시해 드릴테니 참고하세요.

theme: ThemeData(

        unselectedWidgetColor: Colors.white,

        canvasColor: darkGray,

        floatingActionButtonTheme:

            Theme.of(context).floatingActionButtonTheme.copyWith(

                  backgroundColor: Colors.white,

                  foregroundColor: darkGray,

                ),

        appBarTheme: Theme.of(context).appBarTheme.copyWith(

              backgroundColor: darkGray,

            ),

        textTheme: Theme.of(context).textTheme.apply(

              bodyColor: Colors.white,

            ),

      )