builder

728x90
반응형
·Flutter
웹에서 데이터를 받아왔을 때 제대로 받아왔는지 확인하고 싶다. 이럴 경우 어떻게 하는지 작성해보고자 한다.1. if문 사용하기데이터를 서버에서 가져와서 쓰는 경우)데이터가 없는데 보여주고자 하면 에러가 난다. 서버와 통신하는 시간이 좀 걸린다. 그래서 if문을 써서 변수 안에 데이터가 있는지 체크한다.if(data.isNotEmpty){ }else { return Text('로딩중'); }로딩중 대신 CircularProgressIndicator()등의 위젯을 사용하여 가독성있게 보여줄 수도 있다.return Center( child: SizedBox( width: 100, height: 100, child: Column( ..
·Flutter
DatePicker는 날짜를 선택하는 모달을 표시한다. DatePicker의 경우 showDatePicker 메소드를 호출해서 DatePicker 표시할 수 있다. 변수 알아보기 Future _selectDate() async { DateTime? picked = await showDatePicker( context: context, initialDate: DateTime.now(), firstDate: DateTime(2016), lastDate: DateTime(2029)); builder: (BuildContext context, Widget? child) { return Theme( data: ThemeData.dark(), //다크 테마 child: child!, ); }, if (picked ..
·Flutter
ListView ListView: Creates a scrollable, linear array of widgets from an explicit List. This constructor is appropriate for list views with a small number of children because constructing the List requires doing work for every child that could possibly be displayed in the list view instead of just those children that are actually visible. → ListView의 생성자에서 아이템(ListTile)을 직접 구현하여 ListView를 구성하는 방..
728x90
반응형
Uheeking
'builder' 태그의 글 목록