Flutter 에서 DropdowButton 의 텍스트를 중앙정렬 하기 위한 방법
1. DropdownButton 을 최대로 확장한다.
DropdownButton(
isExpanded: true,
...
)
2. DropdownButton 의 DropdownMenuItem 에서 child 를 Center 로 감싸준다.
return DropdownMenuItem<String>(
value: value,
child: Center(
child: Text(
value,
textAlign: TextAlign.center,
),
),
);
https://stackoverflow.com/a/63995395/3897810
How to center text in DropdownButton?
I'm trying to make the DropdownButton hint, text and menu items appear in the center instead of left but TextAlign.center does not seem to be doing anything. Image of Dropdown with the hint: Imag...
stackoverflow.com
반응형
'Dev > Flutter' 카테고리의 다른 글
[Flutter] 버튼 Radius 주는 방법은 Style 로!!! (0) | 2024.11.18 |
---|---|
Flutter iOS 이슈 (0) | 2024.02.04 |
Flutter - TextFormField (0) | 2023.11.22 |
Flutter - Could not build the precompiled application for the device (0) | 2023.11.10 |
Flutter TextField 에 텍스트 입력하는 방법 (0) | 2023.10.27 |