当前位置:网站首页>Flutter TextField示例

Flutter TextField示例

2022-07-04 20:35:00 海阔天空6688

带边框效果

TextField(
  controller: _passWordController,
  autofocus: true,
  obscureText: true,
  maxLength: 20,
  decoration: InputDecoration(
    contentPadding: const EdgeInsets.all( 10),
    label: const Text(Strings.password),
    hintText: Strings.inputPassword,
    border: OutlineInputBorder(
      borderRadius: BorderRadius.circular(5),//圆角
      borderSide: BorderSide.merge( //边框宽度
        const BorderSide(width: 1, color: Colors.grey),
        const BorderSide(width: 1, color: Colors.grey),
      ),
    ),
  ),
)

在这里插入图片描述
在这里插入图片描述

不带边框效果

TextField(
  controller: _userNameController,
  autofocus: true,
  decoration: InputDecoration(
    prefixIcon: const Icon(Icons.account_circle_outlined
原网站

版权声明
本文为[海阔天空6688]所创,转载请带上原文链接,感谢
https://haikuotiankong.blog.csdn.net/article/details/125601984