如何在flutter中更改OTP文本字段小部件的边框颜色?通过 OTPfieldStyle 更改不起作用?

问题描述 投票:0回答:1

 OTPTextField( length: 5, keyboardType: TextInputType.number, width: MediaQuery.of(context).size.width, fieldWidth: 30, style: TextStyle(fontSize: 17, color: gettcolor(context)), textFieldAlignment: MainAxisAlignment.spaceAround, fieldStyle: FieldStyle.box, onCompleted: (pin) { otp = pin; }, ),
在这里,无论我是否使用 otpfieldstyle 并将颜色设置为任何内容,它都保持不变

flutter widget border textfield
1个回答
0
投票

尝试设置以下属性:

OTPTextField(

otpFieldStyle: OtpFieldStyle(focusBorderColor: Colors.amber,),
borderColor: Colors.purple,

),
© www.soinside.com 2019 - 2024. All rights reserved.