본문 바로가기

MaterialStateProperty3

Flutter 둥근 테두리가 있는 버튼 만들기 [중복], Create a button with rounded border [duplicate] 질문 FlatButton을 둥근 테두리 버튼으로 만드는 방법은 어떻게 하시겠습니까? RoundedRectangleBorder를 사용하여 둥근 테두리 모양을 가지고 있지만 경계를 색칠해야합니다. new FlatButton( child: new Text("Button text), onPressed: null, shape: new RoundedRectangleBorder(borderRadius: new BorderRadius.circular(30.0)) ) 둥근 버튼 예시 : 답변 FlatButton 대신 OutlinedButton을(를) 사용하세요. OutlinedButton( onPressed: null, style: ButtonStyle( shape: MaterialStateProperty.all(Rou.. 2023. 5. 31.
Flutter에서 함수를 통해 Elevated Button의 배경색을 어떻게 변경할 수 있나요?, How can I change the background color of Elevated Button in Flutter from function? 질문 저는 Flutter를 처음 사용하고 지난 주에 Flutter를 시작했습니다. 이제 간단한 Xylophone 애플리케이션을 만들고 싶습니다. UI를 성공적으로 만들었고 playSound(int soundNumber) 함수를 만들었지만, 이 함수를 호출하여 소리를 재생하려고 하면 다음 오류가 발생합니다. 다음과 같은 _TypeError가 발생하여 Body(dirty, state: _BodyState#051c2)를 빌드할 수 없습니다: '_MaterialStatePropertyAll' 유형은 'MaterialStateProperty?' 유형의 하위 유형이 아닙니다. 여기 playSound(int soundNumber) 함수에 대한 작성한 코드가 있습니다. void playSound(int soundNum.. 2023. 5. 13.
Flutter에서 border-radius가 있는 둥근 버튼 / 버튼을 만드세요., Create a rounded button / button with border-radius in Flutter 질문 I'm currently developing an Android app in Flutter. How can I add a rounded button? 답변 1. 솔루션 요약 FlatButton과 RaisedButton은 더 이상 사용되지 않습니다. 따라서 TextButton과 ElevatedButton에 대해 style 속성에 배치된 shape를 사용할 수 있습니다. Flutter 2.0 이후에는 몇 가지 변경 사항이 있습니다. style: 속성 유형이 ButtonStyle로 변경되었습니다. shape: 속성 유형이 MaterialStateProperty로 변경되었습니다. 2. 둥근 버튼 style 속성 내부에 shape 속성이 있습니다. style: ButtonStyle( shape: Materi.. 2023. 5. 8.