flutter - How to achieve dashed textfield using flutter widgets
问题描述
I am stumped on how to achieve dashed text fields such as the images attached using flutter widgets. I have searched the textfield class but are unable to come up with a solution. Any assistance would be greatly appreciated
解决方案
Well I had the same layout requirement. So I used this
its bit length and I guess messy (because you need to playout with padding) but sure does the work.
Output
Code
Container(
padding: EdgeInsets.only(left: 25.0, right: 25.0),
width: MediaQuery.of(context).size.width,
height: 45.0,
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
new Flexible(
child: new Container(
padding: EdgeInsets.only(left: 5.0),
child: new TextField(
decoration: InputDecoration(
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.black))),
maxLength: 1,
))),
new SizedBox(width: 10.0),
new Flexible(
child: new Container(
padding: EdgeInsets.only(left: 5.0),
child: new TextField(
decoration: InputDecoration(
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.black))),
maxLength: 1,
))),
new SizedBox(width: 10.0),
new Flexible(
child: new Container(
padding: EdgeInsets.only(left: 5.0),
child: new TextField(
decoration: InputDecoration(
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.black))),
maxLength: 1,
))),
new SizedBox(width: 10.0),
new Flexible(
child: new Container(
padding: EdgeInsets.only(left: 5.0),
child: new TextField(
decoration: InputDecoration(
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.black))),
maxLength: 1,
))),
new SizedBox(width: 10.0),
new Flexible(
child: new Container(
padding: EdgeInsets.only(left: 5.0),
child: new TextField(
decoration: InputDecoration(
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.black))),
maxLength: 1,
))),
],
),
)
推荐阅读
- oracle - 如何在 PL/SQL 中声明和设置变量
- logging - GCP HTTPS LoadBalancer 访问日志和 istio 日志的区别
- python - 图形下的颜色区域
- javascript - Formvalidation.io:某个字段有效时的事件
- angular - 如何在 index.html 中隐式导入 metat utf-8?
- linux - 使用 LLVM 构建 SGX-SDK
- node.js - 另一个 nginx 入口重写目标问题
- java - 即使在更改 URL 后,Tomcat 也会继续重定向到 servlet
- android - 表不在android设备上创建,而是在虚拟设备上创建
- android - Android webview 麦克风捕获问题