Programming/Flutter 4

[Flutter] ConstrainedBox를 사용하여 SingleChildScrollView full Height 채우기

SingleChildScrollView( child: ConstrainedBox( constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height), child: Column( children: [ Expanded( child: GridView.count( crossAxisCount: 2, children: List.generate(some.length, (index) { return Container( child: some(index), ); }), ), ), ], ), ), ); 1. SingleChildScrollView를 지정하고 바로 GridView를 사용하면 height가 지정되지 않아서 화면이 그려지지 않는다. 2. 에러 문..

Programming/Flutter 2022.03.17

[Flutter] image full width 채우기

ClipRRect( borderRadius: BorderRadius.circular(8), child: Image( width: 1000, image: AssetImage('assets/image/announcement-test.png'), fit: BoxFit.fitWidth, ), ), 1. ClipRRect: BoderRadius를 주려면 ClipRect가 아니라 ClipRRect를 써야한다(...) 2. Image에는 fit 이 존재한다. 3. Image width를 매우 큰값을 주고, BoxFit으로 제한을 걸어주면, container(바깥 위젯)에 맞춰서 영역을 잡게된다.

Programming/Flutter 2022.03.17

[Flutter] overflow 처리하기

다음과 같은 flutter 코드가 있다. Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only(bottom: 4.0), child: Row( children: [ Text( category, style: TextStyle(fontSize: 12), ) ], ), ), Row( children: [ Text( title, style: TextStyle(fontSize: 24), ), ], ) ], ); 카테고리와 제목을 표현하는 리스트 항목 컴포넌트이다. 하지만 이를 구현하면 음.. css였으면 overflow를 통해서 해결할 수 있었을 텐데, 한 번 넣어보자. 다음 st..

Programming/Flutter 2022.01.28