본문 바로가기

분류 전체보기

(132)
[j Flutter] Incorrect use of ParentDataWidget. 에러 해결법 flutter에서 해당 에러가 발생했다면, ======== Exception caught by widgets library ======================================================= The following assertion was thrown while applying parent data.: Incorrect use of ParentDataWidget. The ParentDataWidget Positioned(top: 0.0, bottom: 0.0, width: 192.0) wants to apply ParentData of type StackParentData to a RenderObject, which has been set up to accept Pare..
[j Android] 코틀린 handler() 몇 초 후 실행하기 코틀린에서 handler를 사용하여 해당 초 뒤에 실행하는 코드 Handler(Looper.getMainLooper()).postDelayed({ // 실행 할 코드 }, 5000) 1000 -> 1초
[j Android] 캡쳐,녹화 방지 및 캡쳐방지 해제 - 앱에서 캡쳐 및 녹화 방지를 하기 위해서는 해당 액티비티에 코드를 추가해준다. 캡쳐나 녹화를 하면 화면이 검은색으로 나오게 된다. window.addFlags(WindowManager.LayoutParams.FLAG_SECURE) - 반대로 캡쳐방지를 해제하고 싶으면 해당 소스를 추가해준다. window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
[j Flutter] pageview indicator 추가하기 pageview에 indicator를 추가해보자. 1. smooth_page_indicator 플러그인을 설치해준다. dependencies: smooth_page_indicator: ^1.0.0+2 2. 코드 PageController _pageController = PageController(); SmoothPageIndicator( controller: _pageController, // PageController count: 3, effect: WormEffect( activeDotColor: Theme.of(context).primaryColor, dotColor: Theme.of(context) .colorScheme .background, radius: 2, dotHeight: 4, dotW..
[j Flutter] Currency Text Input Formatter 사용해 화폐단위 사용 및 콤마 찍어주기 Currency Text Input Formatter를 사용하면 TextFormField 입력 시 화폐단위 사용 및 콤마를 찍어 줄 수 있다. 1. Currency Text Input Formatter 플러그인 설치 dependencies: currency_text_input_formatter: ^2.1.8 2. TextFormField 적용 - 한국 화폐단위 적용 import 'package:currency_text_input_formatter/currency_text_input_formatter.dart'; import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget {..
[j Flutter] TextFormField 커서 맨 뒤로 보내기 TextFormField 사용 시 커서를 맨 뒤로 보내보자. 해당 코드를 추가해 주면 된다. _Controller.selection =TextSelection.collapsed( offset: _Controller.text.length) * 적용한 소스 TextEditingController _Controller = TextEditingController(); TextFormField( controller: _Controller, onChanged: (value) { if (value == '') { _Controller.clear(); } setState(() { _Controller.text = value; }); _Controller.selection = TextSelection.collapsed(..
[j Flutter] go_router 업데이트 후 Log 안 찍힐 때 go_router 플러그인 업데이트 후 로그가 안 찍힐 때 logging 플러그인을 추가해 로그를 찍어주는 방법이다. 1. logging 플러그인 설치 https://pub.dev/packages/logging logging | Dart Package Provides APIs for debugging and error logging, similar to loggers in other languages, such as the Closure JS Logger and java.util.logging.Logger. pub.dev dependencies: go_router: ^6.0.0 logging: ^1.1.0 pubspec.yaml 파일에 플러그인 추가 후 flutter pub get 실행해준다. 2. lo..
[j Android] 디바이스 높이, status bar, navigation bar 높이 가져오기 * Anroid P 이상 높이 1. device 사이즈 가져오기 fun getScreenSize(activity: Activity): DisplayMetrics { val displayMetrics = DisplayMetrics() return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { val display = activity.display display?.getRealMetrics(displayMetrics) displayMetrics } else { @Suppress("DEPRECATION") val display = activity.windowManager.defaultDisplay @Suppress("DEPRECATION") display.ge..