如何在 Flutter 中向 TextFormField 添加阴影

编程入门 行业动态 更新时间:2024-10-21 09:21:32
本文介绍了如何在 Flutter 中向 TextFormField 添加阴影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个颤动的文本表单字段,我想给它添加一个阴影.我该怎么做?

I have a text form field in flutter I want to add a drop shadow to it. how should I do that?

final password = TextFormField( obscureText: true, autofocus: false, decoration: InputDecoration( icon: new Icon(Icons.lock, color: Color(0xff224597)), hintText: 'Password', fillColor: Colors.white, filled: true, contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), enabledBorder: OutlineInputBorder(borderRadius:BorderRadius.circular(5.0), borderSide: BorderSide(color: Colors.white, width: 3.0)) ), );

推荐答案

您可以使用 Material 小部件包装您的 TextFormField 并编辑其属性,例如 elevation 和 shadowColor.

You can Wrap your TextFormField with a Material widget and edit its properties such as elevation and shadowColor.

例子:

Material( elevation: 20.0, shadowColor: Colors.blue, child: TextFormField( obscureText: true, autofocus: false, decoration: InputDecoration( icon: new Icon(Icons.lock, color: Color(0xff224597)), hintText: 'Password', fillColor: Colors.white, filled: true, contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), enabledBorder: OutlineInputBorder(borderRadius:BorderRadius.circular(5.0), borderSide: BorderSide(color: Colors.white, width: 3.0)) ), ), )

您将获得类似于下图的内容.

You will Get something similar to the image below.

更多推荐

如何在 Flutter 中向 TextFormField 添加阴影

本文发布于:2023-11-12 03:55:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1580445.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:阴影   中向   如何在   Flutter   TextFormField

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!