skykkm0810 / MFC

연구노트용 Repository
0 stars 0 forks source link

220623 #1

Open skykkm0810 opened 2 years ago

skykkm0810 commented 2 years ago

개발 내용

  1. Flutter 를 이용한 Component 화 System

ex) text


class _ClassName_ extends StatelessWidget (선택) {
final String
const _Title_ ({Key key, this.text}) : super(key: key);

@override Widget .... { return Text (text, style: ... )

}

}


2. 움직이는 위젯 , AnimatedPositioned

>Stack 위젯 안에서 사용 , position을 이용해 움직임.

Stack( children: [ AnimatedPositioned( bottom: selected ? 0 : -size.height, duration: const Duration(milliseconds: 300), curve: Curves.easeInOut, child: Container(


3. 위젯의 크기 
>GlobalKey를 사용하여 key값을 설정 /  renderBox, renderObject로 사이즈 측정

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;



  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 값을 넣을 필요