카테고리 없음

[flutter] dropdownbuttonformfield 글씨 잘리는 현상

뚜개 2024. 12. 25. 08:15
Expanded(
                      child: DropdownButtonFormField<DdeugaeType>(
                        borderRadius: BorderRadius.circular(20),
                        decoration: InputDecoration(
                          labelText: '뜨개종류',
                          border: OutlineInputBorder(
                            borderRadius: BorderRadius.circular(20),
                          ),
                        ),
                        value: _selectedType,
                        items: DdeugaeType.values.map((DdeugaeType type) {
                          return DropdownMenuItem<DdeugaeType>(
                            value: type,
                            child: Text(type.name),
                          );
                        }).toList(),
                        onChanged: (DdeugaeType? newValue) {
                          setState(() {
                            _selectedType = newValue!;
                          });
                        },
                      ),
                    ),

 

나는 dropdownbuttonformfield를 이렇게 구성했는데 안에 있는 글씨가 미묘하게 잘리는 현상이 발생했다.

신경 안쓰려면 안 쓸 수 있지만 나는 신경이 쓰이는 걸

 

 

   Expanded(
                      child: DropdownButtonFormField<DdeugaeType>(
                        isDense: false,
                        borderRadius: BorderRadius.circular(20),
                        decoration: InputDecoration(
                          labelText: '뜨개종류',
                          contentPadding:
                              EdgeInsets.symmetric(vertical: 5, horizontal: 16),
                          border: OutlineInputBorder(
                            borderRadius: BorderRadius.circular(20),
                          ),
                        ),
                        value: _selectedType,
                        items: DdeugaeType.values.map((DdeugaeType type) {
                          return DropdownMenuItem<DdeugaeType>(
                            value: type,
                            child: Text(type.name),
                          );
                        }).toList(),
                        onChanged: (DdeugaeType? newValue) {
                          setState(() {
                            _selectedType = newValue!;
                          });
                        },
                      ),
                    ),

 

isDense를 false로 주고 넓어진 default padding을 contentPadding 옵션으로 줄여주면 된다!!