본문 바로가기

IconButton5

Flutter 플러터에서 IconButton의 크기(높이와 너비)를 조정하는 방법은 무엇인가요?, How to resize (height and width) of an IconButton in Flutter 질문 Flutter에서 IconButton의 크기(높이와 너비)를 조절하는 방법은 무엇인가요? 기본적으로 기본 너비와 높이를 가지는 것 같습니다. 높이나 너비 속성이 없는 것 같습니다. new IconButton( padding: new EdgeInsets.all(0.0), color: themeData.primaryColor, icon: new Icon(Icons.clear, size: 18.0), onPressed: onDelete, ) 답변 다음과 같이 SizedBox를 사용하여 크기를 지정할 수 있습니다. SizedBox( height: 18.0, width: 18.0, child: IconButton( padding: EdgeInsets.all(0.0), color: themeData.prima.. 2023. 9. 22.
Flutter - Container onPressed? 플러터 - 컨테이너 onPressed?, Flutter - Container onPressed? 질문 나는 이 컨테이너를 가지고 있습니다: new Container( width: 500.0, padding: new EdgeInsets.fromLTRB(20.0, 40.0, 20.0, 40.0), color: Colors.green, child: new Column( children: [ new Text("Ableitungen"), ] ), ), 사용자가 Container를 클릭하면 IconButton과 같은 방식으로 onPressed() 메서드가 실행되기를 원합니다. Container로 이러한 동작을 어떻게 구현할 수 있을까요? 답변 다음과 같이 GestureDetector 위젯을 사용할 수 있습니다: new GestureDetector( onTap: (){ print("Container clicke.. 2023. 6. 14.
Flutter 텍스트 폼 필드에서 비밀번호를 표시/숨기는 방법은 무엇인가요?, How to show/hide password in TextFormField? 질문 현재 비밀번호는 다음과 같이 설정되어 있습니다: TextFormField TextFormField( decoration: const InputDecoration( labelText: 'Password', icon: const Padding( padding: const EdgeInsets.only(top: 15.0), child: const Icon(Icons.lock), )), validator: (val) => val.length _password = val, obscureText: true, ); 비밀번호를 보이게 하거나 숨기는 버튼과 같은 상호작용 버튼이 필요합니다. TextFormField 내에서.. 2023. 5. 29.
Flutter TextField 위젯에 Clear 버튼을 추가하는 방법, How to add clear button to TextField Widget 질문 TextField에 클리어 버튼을 추가하는 올바른 방법이 있나요? Material design 가이드라인에서 보는 것처럼: 찾아본 결과, InputDecoration의 suffixIcon에 클리어 IconButton을 설정하는 것이 맞는 방법인가요? 답변 출력: 변수를 만드세요 var _controller = TextEditingController(); 그리고 TextField를 추가하세요: TextField( controller: _controller, decoration: InputDecoration( hintText: '메시지를 입력하세요', suffixIcon: IconButton( onPressed: _controller.clear, icon: Icon(Icons.clear), ), ), ) 2023. 5. 18.