flutter - 如何制作可调整大小的TextField?
问题描述
我想让 TextField 可以垂直调整大小,对此我有一个想法
Expanded(
child: TextField(
cursorColor: Colors.black,
decoration: new InputDecoration.collapsed(
// border: new OutlineInputBorder(
// borderSide: new BorderSide(color: hexToColor('#5c6277'),style: BorderStyle())
// ),
hintText: "El Baraka",hintStyle: TextStyle(fontFamily: 'RobotoLight',color: Colors.grey,fontSize: 16),
),
),
解决方案
这可以通过以下方式实现maxLines: null
:
TextField(
cursorColor: Colors.black,
decoration: new InputDecoration.collapsed(
hintText: "El Baraka",hintStyle: TextStyle(fontFamily: 'RobotoLight',color: Colors.grey,fontSize: 16),
),
maxLines: null,
)
现在TextField
将在您的文本到达边缘时添加一个新行。
推荐阅读
- php - 在 Laravel 应用程序中使用 ini_set 的最佳位置在哪里
- solidity - 如何使用solidity为非对称加密创建私钥-公钥对
- excel - Excel 范围的唯一值不适用于公式结果
- angular - Angular 中的主题在 500 个内部错误后停止工作
- vue.js - VueJS - 数据更改后选择列表不更新
- f# - 您如何在 F# 中从任务中编写 SelectMany
- vue.js - Vue组件未呈现度数符号
- salesforce - 增强型笔记正文中附加的图像存储在哪里?
- outlook - 从 Outlook Web/Office Online 更新任务时,Office 互操作无法从 Outlook 获取更新的 TaskItem
- r - 如何制作单独和居中的 R 图