问答

flutter TextField输入超过UI显示的宽度就被裁剪了一半,增加父

作者:admin 2021-07-04 我要评论

flutter TextField输入超过UI显示的宽度就被裁剪了一半,增加父容器高度可以恢复,但是UI变了 这第一个看起来也没有垂直居中 Container( color: Color.fromRGBO(...

在说正事之前,我要推荐一个福利:你还在原价购买阿里云、腾讯云、华为云服务器吗?那太亏啦!来这里,新购、升级、续费都打折,能够为您省60%的钱呢!2核4G企业级云服务器低至69元/年,点击进去看看吧>>>)

flutter TextField输入超过UI显示的宽度就被裁剪了一半,增加父容器高度可以恢复,但是UI变了
1581593839725_.pic.jpg
1591593839725_.pic.jpg
1601593839725_.pic.jpg
这第一个看起来也没有垂直居中

Container(
  color: Color.fromRGBO(240, 244, 247, 1),
  height: 65.px,
  width: 150.px,
  child: TextField(
    textAlignVertical: TextAlignVertical.center,
    cursorColor: Color.fromRGBO(52, 52, 52, 1.0),
    textAlign: TextAlign.center,
    keyboardType: TextInputType.number,
    controller: _inputHandle,
    decoration: InputDecoration(
      filled: true,
      border: InputBorder.none,
    ),
    style: TextStyle(
      color: Color.fromRGBO(0, 0, 0, 1),
      fontSize: 34.px,
      fontWeight: FontWeight.w600,
    ),
  ),
)

还是我写的有问题

###
new TextField(
                          textAlign: TextAlign.center,
                          keyboardType: TextInputType.number,
                          style: TextStyle(
                            fontSize: 36.px,
                            fontWeight: FontWeight.w700,
                            color: Color.fromRGBO(0, 0, 0, 1)
                          ),
                          decoration: InputDecoration(
                            contentPadding: const EdgeInsets.symmetric(horizontal: 5),
                            hintText: '1',
                            border: OutlineInputBorder(
                                borderRadius: BorderRadius.circular(15),
                                borderSide: BorderSide.none),
                            fillColor: Color(0xffaaaaaa),
                          ),
                        )

版权声明:本文转载自网络,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。本站转载出于传播更多优秀技术知识之目的,如有侵权请联系QQ/微信:153890879删除

相关文章
  • PHP的use 的 前提是包中的文件需要提前

    PHP的use 的 前提是包中的文件需要提前

  • 为什么分布式项目中需要分布式锁,而普

    为什么分布式项目中需要分布式锁,而普

  • mysql高效查询评论及回复内容,并且分

    mysql高效查询评论及回复内容,并且分

  • tp5 数据库查询  如何进行多对多查询

    tp5 数据库查询 如何进行多对多查询

腾讯云代理商
海外云服务器