android - 如何创建字符串输入字段颤动?
解决方案
改变
keyboardType: TextInputType.text
检查我的 main.dart 文件
import 'package:flutter/material.dart';void main() => runApp(new MyApp());
class MyApp extends StatelessWidget{
@override
Widget build(BuildContext context){
Color hexToColor(String code) {
return new Color(int.parse(code.substring(1, 7), radix: 16) + 0xFF000000);
}return MaterialApp(
debugShowCheckedModeBanner: false,
title: "End User Page",
home: new Material(
child: new Container (
padding: const EdgeInsets.all(30.0),
color: Colors.white,
child: new Container(
child: new Center(
child: new Column(
children : [
new Padding(padding: EdgeInsets.only(top: 140.0)),
new Text('Name:',
style: new TextStyle(color: hexToColor("#F2A03D"), fontSize: 25.0),),
new Padding(padding: EdgeInsets.only(top: 50.0)),
new TextFormField(
decoration: new InputDecoration(
labelText: "Enter Name",
fillColor: Colors.white,
border: new OutlineInputBorder(
borderRadius: new BorderRadius.circular(25.0),
borderSide: new BorderSide(
),
),
//fillColor: Colors.green
),
validator: (val) {
if(val.length==0) {
return "Name cannot be empty";
}else{
return null;
}
},
keyboardType: TextInputType.text,
style: new TextStyle(
fontFamily: "Poppins",
),
),
]
)
),)
)
)
);}
}
输出:
干杯!
推荐阅读
- java - 在 Java 中,您可以遍历嵌套 zip 文件的内容而不膨胀父级吗?
- javascript - require() 发现 process.version 未定义
- c - 使用管道和 read() write() 进行 SSH 通信
- python - Django REST Framework lookup_field to ReadOnlyField with source
- matlab - 在 Matlab 中使用 Curl (Windows 10) 请求给出错误消息
- javascript - 真的——window.document和window里面的document是不一样的。铬合金
- python-3.x - 美丽的汤奇怪地返回'/photo-missing.png'
- reactjs - 用redux sgas直接调用生成器方法可以吗
- sql - 具有特定值的计数列
- azure - 通过 Terraform 检索 VNET 的位置