어느 순간
앱바 theme: ThemeData 의 primarySwatch
백그라운드 컬러 버튼 컬러 등이
갑자기 적용이 안되었다.
After upgrading to Flutter 3.16, the app bar, background color, button size, and spaces change
I upgraded my Flutter version to 3.16. When I run my app, I notice a lot of changes in the UI. The app bar doesn't have shadows anymore. When I scroll, the app bar is now tinted with a color and s...
stackoverflow.com
이글에 의하면
Flutter 3.16 으로 업그레이드 해서 그렇다는데 ..
이 플러터 버전부터 Material3 가 적용되어서 그렇다고 한다.
Material3 에서 색상 적용하는 것은 도저히 어떻게 하는지 모르겠고
위 글대로
return MaterialApp(
debugShowCheckedModeBanner: false, //디버그 리본 없애기
theme: ThemeData(
useMaterial3: false,
// 기타 코드
),
home: {홈에 넣을 위젯 작성}
);
이런식으로
useMaterial3: false, 비활성화 시키면
이전의 Material 2가 적용된다고 한다.
비활성화 하니
이전에 적용한 앱바와 버튼의 색상이 다시 보였다.
두 버전의 차이
To see the differences between Material 2 and Material 3, go to this interactive demo: https://flutter.github.io/samples/web/material_3_demo/#/
To see all the breaking changes in the Flutter 3.16 update, go to this link:
https://docs.flutter.dev/release/breaking-changes#released-in-flutter-316
위 stack overflow 에는
Material3 를 비활성화 하는 방법 말고도 몇가지 방법이 더 있으므로
참조하면 좋겠다.
'IT 정보 > 플러터 flutter' 카테고리의 다른 글
플러터 폰트 적용 (0) | 2024.01.22 |
---|---|
백 키 막기 WillPopScope 코드 지원이 멈춘다고 합니다. 수정법 (0) | 2024.01.17 |
fluttertoast 플러터에서 토스트 메시지 쓰기 (0) | 2024.01.14 |
플러터 파이어베이스 설정 연동 (0) | 2023.12.27 |
플러터 상단 메뉴 홈바 appbar (0) | 2023.10.23 |
댓글