본문 바로가기

Flutter2.44

Flutter 플러터에서 DropdownButtons와 DropdownMenuItems를 어떻게 사용자 정의해야 하나요?, How should I customize DropdownButtons and DropdownMenuItems in Flutter? 질문 기본 DropdownButton은 DropdownMenuItems와 함께 연결되어 연한 회색 드롭다운을 반환합니다. 드롭다운을 어떻게 사용자 정의할 수 있을까요? (예: 배경색, 드롭다운 너비) DropdownButton과 DropdownMenuItem의 style 속성을 변경할 수 있습니다. 아래와 같이: return new DropdownButton( value: ..., items: ..., onChanged: ..., style: new TextStyle( color: Colors.white, ), ); 하지만 이렇게 해도 드롭다운의 배경색은 변경되지 않습니다. DropdownMenu를 복사하고 확장해야 할까요? Flutter는 가까운 미래에 이 위젯에 대한 사용자 정의 기능을 추가할 계획이.. 2023. 12. 15.
Flutter 플러터 이미지 사전로드, Flutter image preload 질문 앱 시작 시 이미지를 어떻게 미리 로드할 수 있을까요? 드로어에 배경 이미지가 있지만 처음 드로어를 열 때 이미지가 자산에서 가져와서 표시되는 것처럼 깜박거리는 것을 볼 수 있고, 이는 처음으로 보는 순간에 나쁜 경험을 제공합니다. 드로어를 여는 다른 경우에는 예상대로 동작하므로 캐시되기 때문입니다. 앱 로드 시 미리 가져와서 이런 효과가 없도록 하고 싶습니다. 답변 드로어가 구축되기 전에 이미지를 로드하기 위해 precacheImage 함수를 사용하세요. 예를 들어, 드로어를 포함하는 위젯에서 다음과 같이 사용할 수 있습니다: class MyWidgetState extends State { @override void didChangeDependencies() { // 이미지 유형에 따라 공급자를 .. 2023. 12. 11.
Flutter 플러터 앱스토어/플레이스토어 URL 열기, Flutter Open AppStore/PlayStore URL 질문 플러터에서 안드로이드와 IOS에서 실행되는 스마트폰에 따라 PlayStore/AppStore의 특정 URL을 어떻게 열 수 있을까요? 즉, 브라우저가 아닌 애플리케이션을 열고 싶습니다. 이 스레드에서 안드로이드에 대한 일부 네이티브 방법을 찾았는데, 플러터로 어떻게 할 수 있을까요? final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object try { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName))); } catch (android.content.Activi.. 2023. 12. 11.
Flutter 플러터 - 플러터에서 숫자 키보드에 완료 버튼을 추가하는 방법, Flutter - how to add done button in number keyboard in flutter 질문 나는 TextFormField에서 숫자 형식 입력에 done 버튼을 추가하려고 시도하고 있지만, 그렇게 할 수 없었습니다. TextFormField( key: Key(keyValue), initialValue: valueBuilder, onSaved: (text) { fieldsController.text = text.trim(); }, inputFormatters: [inputFormatters], keyboardType: TextInputType.phoneNumber,) 아래와 같은 키보드를 입력 텍스트 폼 필드에 생성하고 싶습니다. 답변 Change keyboardType: TextInputType.number to keyboardType: TextInputType.numberWithOptio.. 2023. 12. 11.