【问题标题】:Add Scrollbar with TextFormField Flutter使用 TextFormField Flutter 添加滚动条
【发布时间】:2021-07-09 03:09:49
【问题描述】:

我想用 TextFormField 添加滚动条,但是当我向下滚动时出现错误。我的代码

Scrollbar(
                child: TextFormField(
                  maxLines: 4,
                  minLines: 1,
                  decoration: InputDecoration(
                    contentPadding: EdgeInsets.all(0.0),
                    border: InputBorder.none,
                    isDense: true // text form first
                  ),
                ),
              )

enter image description here

【问题讨论】:

    标签: flutter dart


    【解决方案1】:

    这不会添加任何滚动条,但它会是可滚动的。

    Container(
              height: 60,
              width: MediaQuery.of(context).size.width,
              margin: EdgeInsets.only(left: 15,right: 15,top: 10),
              child: ListView(
                children: <Widget>[
                  TextField(
                    minLines: 1,
                    maxLines: 5,
                    decoration: InputDecoration(
                      focusedBorder:OutlineInputBorder(
                        borderSide: BorderSide(color: Colors.black54,)
                      ),
                      border: InputBorder.none,
                      isDense: true 
                    ),
                  )
                ],
              ),
            ),
    

    【讨论】:

    • 但我想在向下滚动时显示滚动
    • 我也找了,没找到。
    猜你喜欢
    • 2019-06-25
    • 1970-01-01
    • 1970-01-01
    • 2023-03-26
    • 2020-12-31
    • 2020-05-04
    • 2019-06-09
    • 2013-10-23
    • 1970-01-01
    相关资源
    最近更新 更多