Obx로 감싸진 버튼을 클릭하면 함수로 Modal Bottom Sheet를 불러오는데 한 번 클릭 했을 때는 문제가 없었는데 두 번 째 클릭했을 때는 해당 오류가 떴다.
Obx((){
...
OnTap:(){
showBottomContainer(context);
}
...
})
showBottomContainer(BuildContext context)
{showModalBottomSheet(
context: context,
builder: (BuildContext context) {
return Container(
);
},
);}
이런 식으로 작성되었었음.
이 함수는 Getx로 관리되는, 즉 Obx로 불러오는데 showModalBottomSheet를 사용하여 또 다시 빌드를 하여 생기는 문제였다.
Obx((){
...
OnTap:(){
showBottomContainer(context);
}
...
})
showBottomContainer(BuildContext context)
{Get.bottomSheet(Container());}
이런식으로 showModalBottomSheet를 Get.bottomSheet로 바꾸어 해결하였다.
'Flutter' 카테고리의 다른 글
[Flutter] Window 빌드 하는 방법 (0) | 2024.01.15 |
---|---|
[Flutter] Json 데이터 받아올 시 DateFormat 불가 오류 해결 (0) | 2023.03.08 |
[Flutter] ERROR : No application found for TargetPlatform.android_arm64 (0) | 2023.03.03 |
[Flutter] Could not resolve all artifacts for configuration ':classpath'. 해결 (0) | 2023.02.09 |
[Flutter] java.lang.RuntimeException : Unable to instantiate activity ComponentInfo 해결 (0) | 2023.02.07 |