image - 如何在prefixIcon内的flutter TextFormField中添加图像

标签 image flutter size textfield assets

在 TextFormField 中,prefixIcon 采用一个小部件,
我使用了 Image.asset(lock,width: 10,height: 10,),
但它的尺寸比 20 大,
我所做的?

最佳答案

您可以在 TextFormField 小部件中添加 prefixIcon,如下所示,

prefixIcon: Padding(
                padding: const EdgeInsets.all(10.0),
                child: Image.asset(
                  'assets/facebook_logo.jpg',
                  width: 20,
                  height: 20,
                  fit: BoxFit.fill,
                ),
              ),

prefixIcon is a 48*48 px wide widget by default as per flutter documentation. so to decrease the size of the icon add the padding on all the size and you will be able to adjust as per your requirements.

关于image - 如何在prefixIcon内的flutter TextFormField中添加图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59529028/

相关文章:

ios - 从内存中释放图像, swift

Flutter:错误: 'await'只能在 'async'或 'async*'方法中使用。甚至认为该方法是异步的

regex - Flutter - TextFormField 中的正则表达式

python - 使用从 txt 文件中提取的尺寸裁剪图像

excel - 代码不会从某些 URL 中提取图像

java - 如何使用 Picasso 指定多个后备图像?

android-studio - Flutter:NoSuchMethodError: “The getter ' month'被调用为null是什么意思? (DateTime包)

android - 使用非 native 工具在 Qt 中检测平板电脑或手机的正确方法

c# - 嵌套字典大小增长

ios - 品牌 Assets 的大小应该是多少?