Flutter module을 가지고 이것 저것 테스트 하는데 이상한 현상이 있어서 기록해요. Flutter module에서 Local notification 기능을 넣고, 그 상태로 iOS에서 로컬 푸시를 보내면 Foreground background 아주 잘 오는데 이상하게 이 module을 다시 native iOS에 넣어서 테스트를 하면 foreground 에서는 푸시가 오지 않는 현상이 있습니다. 이것을 해결하기위해 아래 처럼 코드를 수정을 하면 정상 동작을 확인할수 있습니다. // // moduletestApp.swift // moduletest import SwiftUI import Flutter // The following library connects plugins with iOS plat..
Flutter 로 공통 화면이나 기능을 구현후 각각의 Native(Android, iOS )에서 동일하게 사용이 가능해요. 기존 네이티브 앱이 개발된 상태에서 Flutter로 만든 기능을 추가하고 싶다면, 한번 따라해 보세요 ! Flutter로 모듈을 생성 후 native(Android, iOS)에서 플러터 모듈을 사용 하는 방법에 대해 알아볼게요. 1. 먼저 Flutter module을 생성 합니다. Flutter module은 두가지 방법으로 생성이 가능 합니다. Command 생성 방법 flutter create -t module --org com.example flutter_ble_module Android Studio -> new -> flutter project 생성시 Project type ..
Flutter에 Firebase 설정하고 나니 에러가 발생하기 시작한다. 에러 내용은 아래와 같다. FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:mapDebugSourceSetPaths'. > Error while evaluating property 'extraGeneratedResDir' of task ':app:mapDebugSourceSetPaths' > Failed to calculate the value of task ':app:mapDebugSourceSetPaths' property 'extraGeneratedResDir'. > Querying the mapped value..
https://console.shorebird.dev/ Shorebird Console Code Push for Flutter. console.shorebird.dev 이제 iOS 에서도 shorebird를 이용한 code push 가 가능 하다고 해서 본격적으로 도입에 앞서 사용방법을 알아보려고 해요. 1. shorebird cli 를 설치해보아요. MacOS/Linux curl --proto '=https' --tlsv1.2 https://raw.githubusercontent.com/shorebirdtech/install/main/install.sh -sSf | bash Windows Set-ExecutionPolicy RemoteSigned -scope CurrentUser # Needed to ..
핸드폰 번호를 입력하면 자동으로 '-'를 입력해 주는 TextField Formatter를 만들어 보려구 해요. 회원가입이나 여러가지 이벤트 페이지 정보 작성 시 핸드폰 번호를 입력할 일이 있으면 쉽게 사용 가능해요. 물론 라이브러리를 사용해도 되긴 하지만 이정도는 그냥 코드로 만들어보아요. 아래코드로 얼마든지 다른 형식도 응용이 가능하니 유용하게 사용해 주세요. PhoneNumberTextInputFormatter.dart import 'package:flutter/services.dart'; class PhoneNumberTextInputFormatter extends TextInputFormatter { ///전체 번호 010-1234-5678 기준 final firstLength = 3; ///첫..
Flutter web으로 만든 웹 페이지를 Flutter App webview에 띄우고 웹 페이지에서 버튼을 눌렀을 때 네이티브 App에 특정 이벤트를 발생 시키려고 하는데 생각보다 잘 되지 않네요..... 여기저기 자료를 찾아보다가 살짝 방식이 다르다는걸 깨닫고 혹시 삽질 하는 사람이 있을까 봐 글을 남겨 놓아요 ㅎㅎ 먼저 Flutter web 프로젝트의 web 폴더에 script.js 파일을 생성해요. (이름은 뭐로 하든 상관없어요.) script.js function showAlert() { channelName.postMessage("Hello from JS"); } channelName 부분은 Flutter App에서 JavascriptChannel name 부분에 들어갈 이름을 적어주시면 돼요..
Flutter로 웹 페이지 추가 작업이 웹으로 프로젝트를 만들다가 혹시 몰라서 정리를 해두려 해요. 실행 명령어 Html 랜더링 모드로 실행 해요. flutter run --web-renderer html CanvasKit 랜더링 모드로 실행 해요 flutter run --web-renderer canvaskit 빌드 명령어 html 랜더링 모드로 빌드해요 flutter build web --web-renderer html canvaskit 랜더링 모드로 빌드해요 flutter build web --web-renderer canvaskit 응용 방법 canvaskit 랜더링 모드로 빌드 하고 base href를 /web/ 디렉터리로 설정해요. flutter build web --web-renderer ..
그려진 모든 원들은 서로 연결 될수 있게 만들어진 코드이다. 가작 작은원을 child Node라 할때 바로 위의 부모가 가지는 child node 의 개수에 따라 다양한 모양이 나온다. chil node 노드 개수에 따른 모양은 아래와 같다. 1. child node = 1 2. child node = 2 3. child node = 3 4. child node = 4 5. child node = 5 6. child node = 6 7. child node = 7 8. child node = 8 9. child node = 9 10. child node = 10 11. child node = 11 11. child node = 15 11. child node = 30 child node의 개수가 늘어날수..
그냥 아무 이유 없이 도형 그리기 구현 코드 import 'package:flutter/material.dart'; class CirclePyramidPainter extends CustomPainter { final int pyramidSize; final double baseRadius; CirclePyramidPainter({required this.pyramidSize, required this.baseRadius}); @override void paint(Canvas canvas, Size size) { final paint = Paint()..color = Colors.blue; for (int level = 0; level < pyramidSize; level++) { final levelO..
flutter로 프로젝트를 만들면서 대부분의 키워드 같은 경우는 잘 사용한다고 생각했는데, mixin과 with는 헷갈리는 부분이 있어서 다시 정리를 해보려 해요. 1. extends extends는 흔히 우리가 다른 언어에서 상속으로 사용하는 키워드예요. dart 언어에서는 다중 상속이 불가능하고, 모든 속성과 메소드들을 상속받기 때문에 특별한 구현 없이 바로 사용이 가능해요. ※ 당연한 이야기 이지만 abstract class를 상속받으면 구현을 해주어야 해요. 하지만 abstract class 도 함수 몸체를 구현해 놓았다면, 따로 구현할 필요는 없어요! class CheesePizza extends Pizza { String name() { return "나는 치즈 피자에요"; } } class ..