英文:
How to do focus node and colour change in flutter
问题
设计:
![](https://i.stack.imgur.com/eEoYm.png)
上述设计的Flutter代码
英文:
Design:
Flutter code for the above design
答案1
得分: 1
以下是代码的中文翻译:
你可以使用这段代码:
class InputFil extends StatelessWidget{
String Labletext;
IconData RightIcon;
IconButton ?LeftIcon;
bool ShowPass;
TextEditingController ?Control;
TextInputType KeyType;
final validator;
InputFil({required this.Labletext,required this.RightIcon, this.LeftIcon,required this.ShowPass, this.Control,required this.KeyType,this.validator,});
@override
Widget build(BuildContext context) {
return TextFormField(
controller: Control,
obscureText: ShowPass,
validator: validator,
style: TextStyle(color: Colors.white,fontSize: 15),
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(width: 1.5, color: Colors.white),
),
////你的答案.
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(width: 1.5, color: Colors.white), ),
prefixIcon: Icon(RightIcon,color: Colors.white,),
contentPadding: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0),
labelText: Labletext,
suffixIcon : LeftIcon,
labelStyle: TextStyle(color: Colors.white),
iconColor: Colors.white,
suffixIconColor: Colors.white,
prefixIconColor: Colors.white,
border: OutlineInputBorder(borderRadius: BorderRadius.circular(10.0)),
),
keyboardType: KeyType,
);
}
}
希望对你有所帮助!如果你有任何其他问题或需要进一步的帮助,请随时告诉我。
英文:
You can use this code :
class InputFil extends StatelessWidget{
String Labletext;
IconData RightIcon;
IconButton ?LeftIcon;
bool ShowPass;
TextEditingController ?Control;
TextInputType KeyType;
final validator;
InputFil({required this.Labletext,required this.RightIcon, this.LeftIcon,required this.ShowPass, this.Control,required this.KeyType,this.validator,});
@override
Widget build(BuildContext context) {
return TextFormField(
controller: Control,
obscureText: ShowPass,
validator: validator,
style: TextStyle(color: Colors.white,fontSize: 15),
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(width: 1.5, color: Colors.white),
),
////your answer.
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(width: 1.5, color: Colors.white), ),
prefixIcon: Icon(RightIcon,color: Colors.white,),
contentPadding: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0),
labelText: Labletext,
suffixIcon : LeftIcon,
labelStyle: TextStyle(color: Colors.white),
iconColor: Colors.white,
suffixIconColor: Colors.white,
prefixIconColor: Colors.white,
border: OutlineInputBorder(borderRadius: BorderRadius.circular(10.0)),
),
keyboardType: KeyType,
);
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论