CustomAppBar 적용 중에 해당 오류가 발생하여 CustomAppBar 최상단에 위치한
Positioned 위젯을 삭제하고 LoginScreen, MainCalendar 둘 다 정상적으로 동작하는 것을 확인했습니다.
Positioned는 Stack 내부에만 존재해야 하는데,
위의 구조처럼 Column 안에 위치하여 발생하는 문제로,
단순히 CustomAppBar의 Positioned 위젯만 삭제했습니다.
======== Exception caught by widgets library =======================================================
The following assertion was thrown while applying parent data.:
Incorrect use of ParentDataWidget.
The ParentDataWidget Positioned(left: 0.0, top: 0.0, right: 0.0) wants to apply ParentData of type StackParentData to a RenderObject, which has been set up to accept ParentData of incompatible type FlexParentData.
Usually, this means that the Positioned widget has the wrong ancestor RenderObjectWidget. Typically, Positioned widgets are placed directly inside Stack widgets.
The offending Positioned is currently placed inside a Column widget.
The ownership chain for the RenderObject that received the incompatible parent data was:
ConstrainedBox ← Container ← PreferredSize ← _VisibilityScope ← Visibility ← Positioned ← CustomAppBar ← Column ← Stack ← MediaQuery ← ⋯
When the exception was thrown, this was the stack:
#0 RenderObjectElement._updateParentData.<anonymous closure> (package:flutter/src/widgets/framework.dart:6675:11)
#1 RenderObjectElement._updateParentData (package:flutter/src/widgets/framework.dart:6692:6)
#2 RenderObjectElement.attachRenderObject (package:flutter/src/widgets/framework.dart:6735:7)
#3 RenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6597:5)
#4 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6899:11)
... Normal element mounting (37 frames)
#41 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4468:16)
#42 MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:7035:36)
#43 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:7047:32)
#44 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4468:16)
#45 MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:7035:36)
#46 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:7047:32)
... Normal element mounting (40 frames)
#86 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4468:16)
#87 MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:7035:36)
#88 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:7047:32)
... Normal element mounting (105 frames)
#193 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4468:16)
#194 Element.updateChild (package:flutter/src/widgets/framework.dart:3957:20)
#195 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5642:16)
#196 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5780:11)
#197 Element.rebuild (package:flutter/src/widgets/framework.dart:5333:7)
#198 BuildScope._tryRebuild (package:flutter/src/widgets/framework.dart:2693:15)
#199 BuildScope._flushDirtyElements (package:flutter/src/widgets/framework.dart:2752:11)
#200 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:3048:18)
#201 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:1162:21)
#202 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:468:5)
#203 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1397:15)
#204 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1318:9)
#205 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1176:5)
#206 _invoke (dart:ui/hooks.dart:312:13)
#207 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:419:5)
#208 _drawFrame (dart:ui/hooks.dart:283:31)
====================================================================================================
현재
main_calendar.dart
에서의 build 내부 구조입니다.CustomAppBar 적용 중에 해당 오류가 발생하여 CustomAppBar 최상단에 위치한 Positioned 위젯을 삭제하고 LoginScreen, MainCalendar 둘 다 정상적으로 동작하는 것을 확인했습니다.
Positioned는 Stack 내부에만 존재해야 하는데, 위의 구조처럼 Column 안에 위치하여 발생하는 문제로, 단순히 CustomAppBar의 Positioned 위젯만 삭제했습니다.