Widget _buildBody(context) {
final RenderBox renderBox =
_widgetKey.currentContext?.findRenderObject() as RenderBox;
final Size size = renderBox.size;
AnimatedPositioned(
bottom: selected ? 0 : -size.height,
duration: const Duration(milliseconds: 300),
curve: Curves.easeInOut,
child: Container(
key: _widgetKey,
width: MediaQuery.of(context).size.width,
```
### ISSUE
새로 Render 시 , RenderBox의 값을 null로 인식해, error 뜨는 경우 생김
key값이 주어진 후 (renderBox 값이 생기니) size 값을 넣을 필요
개발 내용
@override Widget .... { return Text (text, style: ... )
}
}
Stack( children: [ AnimatedPositioned( bottom: selected ? 0 : -size.height, duration: const Duration(milliseconds: 300), curve: Curves.easeInOut, child: Container(
class _FirstState extends State {
bool selected = false;
final GlobalKey _widgetKey = GlobalKey();
@override Widget build(BuildContext context) { return Scaffold(backgroundColor: Colors.yellow, body: _buildBody(context)); }
Widget _buildBody(context) { final RenderBox renderBox = _widgetKey.currentContext?.findRenderObject() as RenderBox; final Size size = renderBox.size;