简体   繁体   English

Flutter - 更改 TextFormField onPressed 的背景颜色(焦点)

[英]Flutter - Change background color of TextFormField onPressed (focus)

I have my InputDecoration as follows:我的InputDecoration如下:

InputDecoration(
  floatingLabelBehavior: FloatingLabelBehavior.always,
  labelText: 'Password',
  labelStyle: TextStyle(
    color: AppColors.labelInputFocus,
    fontWeight: FontWeight.w400,
    fontSize: 18.sp,
  ),
  focusedBorder: UnderlineInputBorder(
    borderSide: BorderSide(color: AppColors.secondaryBlue, width: 2.0),
  ),
)

Like how bordercolor changes if pressed I want to change background color of textformfield if user selects it.就像按下时边框颜色如何变化一样,如果用户选择它,我想更改 textformfield 的背景颜色。

在此处输入图像描述

I have my InputDecoration as follows:我的InputDecoration如下:

InputDecoration(
  floatingLabelBehavior: FloatingLabelBehavior.always,
  labelText: 'Password',
  labelStyle: TextStyle(
    color: AppColors.labelInputFocus,
    fontWeight: FontWeight.w400,
    fontSize: 18.sp,
  ),
  focusedBorder: UnderlineInputBorder(
    borderSide: BorderSide(color: AppColors.secondaryBlue, width: 2.0),
  ),
)

Like how bordercolor changes if pressed I want to change background color of textformfield if user selects it.就像按下时边框颜色如何变化一样,如果用户选择它,我想更改 textformfield 的背景颜色。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM