Flutter(플러터) 28

[플러터/Flutter] TextField 포커스 사라질 때 키보드 내리기

가장 바깥 위젯을 GestureDetector()를 사용합니다. 그리고 onTap() 에서 FocusScope.of(context).unfocus(); 를 사용하면 됩니다. @override Widget build(BuildContext context) { return GestureDetector( onTap: () { FocusScope.of(context).unfocus(); }, child: Scaffold( ,,, ,, } 이런 식으로 사용하면, TextField 에서 포커스가 사라졌을 때 키보드가 같이 사라지게 됩니다. 끝!

Flutter(플러터) 2023.06.09

[플러터/Flutter] AppBar leading icon remove 앱바 리딩 아이콘 자동 생성 막기

AppBar 의 leading 아이콘을 만들지 않았는데도, Navigator.push 를 통해 생성된 위젯에서는 리딩아이콘이 자동으로 생성됩니다. 이 경우 자동 생성되는 리딩 아이콘을 생성되지 않도록 막을 수 있습니다. AppBar 의 속성 중 automaticallyImplyLeading 이라는 값이 있는데 이 값은 기본 값이 true 입니다. 요 놈의 값을 false로 변경해주면 됩니다.

Flutter(플러터) 2023.05.31

[플러터/Flutter] Dart 3.0, Flutter 3.10.0 업그레이드 시 Error: The argument type 'void Function(TapDownDetails)' can't be assigned to the parameter type 'void Function(TapDragDownDetails)?'. 에러 날 때 해결책

이 해결책은 flutter_html 을 사용할 경우에 해당됩니다. 얼마 전 구글 I/O 2023 에서 Dart, Flutter 의 새로운 버전을 발표 했고 저는 신나게 버전을 올렸습니다. 그러나..... 이게 웬걸 갑자기 에러가 본 적 없는 에러가 발생했씁니다. ../../.pub-cache/hosted/pub.dev/flutter_math_fork-0.5.0/lib/src/widgets/selection/gesture_detector_builder.dart:186:20: Error: The argument type 'void Function(TapDownDetails)' can't be assigned to the parameter type 'void Function(TapDragDownDetails)..

Flutter(플러터) 2023.05.25

[플러터/Flutter] Don't use 'BuildContext's across async gaps.Try rewriting the code to not reference the 'BuildContext' 경고 해결 방법

await 다음에 Navigator.of(context).pop();처럼 BuildContext 를 사용하는 코드를 작성할 경우 Don't use 'BuildContext's across async gaps. Try rewriting the code to not reference the 'BuildContext' 요런 경고 메시지가 뜨는데요. 해결하는 방법은 간단합니다. context 를 포함하는 코드 바로 위에 if(!mounted) return;

Flutter(플러터) 2023.05.17

[플러터/Flutter] android build.gradle GradleException unable to resolve class GradleException 에러 해결하기

플러터 개발 시 android 의 build.gradle(:app) 파일을 열면 def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") } 이런 코드가 있는데 throw new GradleException에 빨간 줄이 하나 생기면서 unable to resolve class GradleException 이런 에러가 있다고 알려줍니다. 크게 문제되지는 않지만 에러를 없애고 싶다면 아래 방법을 사용하면 됩..

Flutter(플러터) 2023.05.16

[플러터/Flutter] create and show Flutter Custom Dialog

Show CustomDialog showDialog( context: context, builder: (BuildContext context) { return Widget(); } ); Create CustomDialog 원하는 UI 의 위젯을 만들면 됩니다. 만약 다이얼로그에서 이전 화면으로 데이터를 전달하고 싶다면 아래처럼 호출하시고 void showCustomDialog() async { final result = await showDialog( context: context, builder: (BuildContext context) { return Widget(); } ); setState(() { aaa = result; }); } 다이얼로그에서 Navigator.of(context).pop(d..

Flutter(플러터) 2023.04.25