본문 바로가기

전체 글324

[플러터] Flutter Dart Null Check Operaors 널 체크 ?? 특정 변수를 널체크하고 널일 경우 다른 값을 대입한다. String result; String x = 'x value'; String y; result = x?? y // x가 널이 아니기 때문에 x가 대입된다. print(result); // x value String result; String x; String y = 'y value'; result = x?? y // x가 널이기 때문에 y가 대입된다. print(result); // y value ??= 특정 변수를 널체크하고 초기 값을 대입한다. String result; String x ; String y = 'y value'; x ??= y; print(x); // y value ?. 특정 변수를 널체크하고 메소드를 실행한다. Map x.. 2021. 10. 14.
[플러터] Flutter Getx 페이지 전환 및 데이터 전달 페이지 이동 및 전환 Get.to(() => SecondPage()); Get.to(SecondPage()); 전환되는 페이지로 데이터 보내기 (첫 번째 페이지에서 두 번째 페이지로 데이터 전달) Get.to(() => SecondPage(), arguments: value); Get.to(SecondPage(), arguments: value); 그리고 두 번째 페이지에서 데이터 받기 var value = Get.arguments; 전환되는 페이지로부터 데이터 받기 (두 번째 페이지에서 첫 번째 페이지로 데이터 전달) var value = await Get.to(SecondPage()); 그리고 두 번째 페이지에서 데이터를 전달 Get.back(result: value); 2021. 10. 11.
[플러터] Flutter GridView 사이 간격 scrollDirection 방향에 따라서 mainAxisSpacing, crossAxisSpacing 값을 주면 된다. GridView.count( scrollDirection: Axis.vertical, mainAxisSpacing: 4.0, // 간격 조절 crossAxisSpacing: 4.0, // 간격 조절 crossAxisCount: 5, children: List.generate(5, (index) { return Text(index.toString()); }), ), 2021. 10. 10.
[플러터] Flutter Rounded Corners Image 이미지 둥근 모서리 ClipRRect 위젯으로 감싸주고 borderRadius를 주면 된다. ClipRRect( borderRadius: BorderRadius.circular(8.0), child: Image.network( imagePath, fit: BoxFit.fill, ), // Text(key['title']), ), 2021. 10. 9.
[플러터] Flutter Text overflow overflow: TextOverflow.ellipsis, SizedBox( width: 100.0, child: Padding( padding: EdgeInsets.all(8.0), child: Text( '123456789123456789123456789123456789123456789123456789', overflow: TextOverflow.ellipsis, ), ), ), 2021. 10. 8.
[플러터] Flutter TextField icon, 테두리 적용 TextField 안에 Icon 위치 prefixIcon TextField( onChanged: (value){}, decoration: const InputDecoration( prefixIcon: Icon(Icons.search,color: Colors.blueAccent,), ), ), suffixIcon TextField( onChanged: (value){}, decoration: const InputDecoration( suffixIcon: Icon(Icons.cancel,color: Colors.blueAccent,), ), ), 테두리 적용 및 아이콘 클릭 시 텍스트 초기화 상단에 TextEditingController 선언 final TextEditingController _textEdi.. 2021. 10. 7.
[플러터] Flutter setState() called after dispose() 에러 내용 : Unhandled Exception: setState() called after dispose(): 해결 방법 : setState((){}) 호출한 부분을 찾아서 아래처럼 감싸주자. if (this.mounted) { setState(() { }); } 2021. 10. 6.
Git 설치 - Windows 1. 검색창에 download git을 검색하여 다운로드 페이지로 들어갑니다. 아래는 다운로드 페이지 주소입니다. 클릭해서 들어가세요. https://git-scm.com/downloads Git - Downloads Downloads macOS Windows Linux/Unix Older releases are available and the Git source repository is on GitHub. GUI Clients Git comes with built-in GUI tools (git-gui, gitk), but there are several third-party tools for users looking for a platform-specific exp git-scm.com 2. Wind.. 2021. 9. 7.
코틀린 표준함수 (1) 코틀린의 표준함수를 이용하면 코드를 더 단수화하고 읽기 좋게 만들어 줍니다. 표준함수는람다식과 고차함수를 이용해 선언되어 있습니다. 람다식과 고차 함수 복습하기 람다식 val 변수 이름: 자료형 = { 매개 변수[,,] -> 람다식 본문 } val sum :(Int, Int) -> Int = { x, y -> x + y} println(sum(1,2)) // 3 val mul: (Int, Int) -> Int = {x, y -> x * y } println(mul(2,2)) // 4 // 매개 변수 1개 일 경우, it으로 표기할 수 있음. val add:(Int) -> Int = {it +1} println(add(1)) // 2 추론된 반환 자료형이 Unit이 아닌 경우에는 본문의 마지막 표현식이 반.. 2020. 9. 6.