본문 바로가기
Flutter/Flutter FAQ

Flutter 플러터 - 텍스트 필드 힌트 색상 변경 방법?, Flutter - How to change TextField hint color?

by 베타코드 2023. 6. 24.
반응형

질문


I'm a bit confused how to change the hint color of the textfield. Someone can guide me how to do it.Thanks

child: TextField(
   style: TextStyle(fontSize: 20),
   decoration: InputDecoration(
                  hintText: "Password",
                  border: new OutlineInputBorder(
                            borderSide: new BorderSide(
                              color: Colors.teal,
                            ),
                          ),
                   prefixIcon: const Icon(
                            Icons.security,
                            color: Colors.white,
                          ),
                ),
   ),

답변


당신은 InputDecoration에서 hintStyle을 사용할 수 있습니다.

TextField(
        style: TextStyle(fontSize: 20),
        decoration: InputDecoration(
          hintText: "비밀번호",
          hintStyle: TextStyle(fontSize: 20.0, color: Colors.redAccent),
          border: OutlineInputBorder(
            borderSide: BorderSide(
              color: Colors.teal,
            ),
          ),
          prefixIcon: const Icon(
            Icons.security,
            color: Colors.white,
          ),
        ),
      ),
반응형

댓글