栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何在Flutter中删除TextField底部的空格?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何在Flutter中删除TextField底部的空格?

您可以

InputDecoration
对的
decoration:
属性使用折叠状态
TextField

  Future<Null> _selectNoteType(BuildContext context) async {    InputDecoration decoration = const InputDecoration.collapsed()      ..applyDefaults(Theme.of(context).inputDecorationTheme);    switch (await showDialog<Null>(        context: context,        builder: (BuildContext context) {          return new SimpleDialog( title: const Text('Select Note Type'), children: <Widget>[   Padding(     padding: const EdgeInsets.only(left: 8.0, right: 8.0),     child: new TextField(       decoration: decoration,       keyboardType: TextInputType.text,       maxLines: 1,       style: new TextStyle(color: Colors.black, fontSize: 20.0),     ),   ),   new SimpleDialogOption(       onPressed: () {}, child: const Text('Text')),   new SimpleDialogOption(       onPressed: () {}, child: const Text('Checklist')), ],          );        })) {    }  }

但是您必须知道使用塌陷的后果

InputDecoration
。从文档中:

  /// Whether the decoration is the same size as the input field.  ///  /// A collapsed decoration cannot have [labelText], [errorText], an [icon].  ///  /// To create a collapsed input decoration, use [InputDecoration..collapsed].  final bool isCollapsed;

对于

InputDecoration.collapse()
构造函数:

  /// Defines an [InputDecorator] that is the same size as the input field.  ///  /// This type of input decoration does not include a border by default.  ///  /// Sets the [isCollapsed] property to true.  const InputDecoration.collapsed({


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/376413.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号