Dev 283

[Flutter] 오류 해결(기타)

* What went wrong: A problem occurred configuring project ':firebase_core'. > com.android.builder.errors.EvalIssueException: defaultConfig contains custom BuildConfig fields, but the feature is disabled. 해당 플러그인 라이브러리에 접근해서 build.gradle 에서 BuildConfig 를 사용할 수 있게 설정하면 된다 buildFeatures { buildConfig = true } Running Gradle task 'assembleDebug'... ../../.pub-cache/hosted/pub.dev/stream_chat_flutter..

Dev/Flutter 2023.06.30

[Flutter] AAPT: error: failed to read PNG signature: file does not start with PNG signature.

> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable > Android resource compilation failed ERROR:/Users/.../android/app/src/main/res/drawable/app_icon.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature. ERROR:/Users/.../android/app/src/main/res/drawable/app_icon.png: AAPT: error: file failed to compile. 아이콘으로 쓸 app_ic..

Dev/Flutter 2023.06.28

Bluetooth 관련 정리

1. BluetoothGatt.discoverServices() 연결된 블루투스에 호출할 수 있는 서비스를 호출하는 기능이다. 해당 함수를 호출하면 블루투스 연결을 할때 등록해 놓은 BluetoothGattCallback 콜백 클래스의 onServicesDiscovered() 로 이벤트가 온다. private val bluetoothGattCallback = object : BluetoothGattCallback() { override fun onConnectionStateChange(gatt: BluetoothGatt?, status: Int, newState: Int) { ... } override fun onServicesDiscovered(gatt: BluetoothGatt?, status: In..

Dev/Android 2023.03.09

[Flutter] ListView.Builder 를 사용할때 주의할 점

ListView.builder or ListView.seperated 를 사용해서 리스트를 구현할때, UI 관점에서 주의할 점이 있습니다. ListView 를 생성해서 UI 만들어진 리스트를 보게되면 위 아래 공백이 생깁니다. 자세히 보다보니 ListView 에는 기본적인 Padding 값이 존재합니다. 그렇기때문에 Padding 값을 설정하고 ListView 를 만들어줘야 합니다. ListView.separated( shrinkWrap: true, padding: EdgeInsets.zero, itemCount: items.length, separatorBuilder: (BuildContext context, int index) => const SizedBox(height: 15), itemBuilde..

Dev/Flutter 2022.12.23

[Flutter] Border 테두리 - 라운드 사각형 디자인

플러터로 테두리에 라인을 그리는 형태의 박스를 디자인 하기 위해서 Container 위젯을 사용해도 되고, Card 위젯을 사용해서 구현하면 됩니다. Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(6), color: Colors.white, border: Border.all(color: color), ), padding: const EdgeInsets.only(left: 6, right: 6, top: 4, bottom: 4), child: item, ) Card( elevation: 0, margin: EdgeInsets.zero, shape: RoundedRectangleBorder( side: BorderSide(..

Dev/Flutter 2022.12.07

[프로그래머스] 자릿수 더하기 LV1 / kotlin

자릿수 더하기 자연수 N이 주어지면, N의 각 자릿수의 합을 구해서 return 하는 solution 함수를 만들어 주세요. 예를들어 N = 123이면 1 + 2 + 3 = 6을 return 하면 됩니다. 문제 링크 : https://school.programmers.co.kr/learn/courses/30/lessons/12931 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 1차 시도 class Solution { fun solution(n: Int): Int { var answer = 0 if (n < 10) { answer = n } else { ..

Dev/Algorithm 2022.12.04

[Flutter] Mockito 를 이용한 테스트 코드 설정 방법

Mock 클래스 셋팅 방법 1. yaml 설정 dev_dependencies: flutter_test: sdk: flutter mockito: ^5.3.2 build_runner: ^2.3.2 2. 테스트 진행할 클래스 파일의 Mock 클래스 생성 class MainViewModelMock extends Mock implements MainViewModel {} 3. main() 함수 위에 Generate 선언 @GenerateMocks([MainViewModelMock]) void main() { .... } 4. 터미널에서 Mock 파일 생성 flutter pub run build_runner build 5. 테스트를 진행할 main() 함수에서 Mock 클래서 선언 및 호출 late MockMain..

Dev/Flutter 2022.11.25