flutter - 当 TextField 为多行时,将 Row () 的元素对齐在底部?

发布于 2025-01-14 21:19:32 字数 2040 浏览 5 评论 0原文

当启用 TextField 多行时,如何使 RawMaterialButton 保持按下状态? 我附加了一些图像以更好地理解我需要什么

这是我的代码:

Row(
    children: [
      Flexible(
        child: TextField(
          keyboardType: TextInputType.multiline,
          minLines: 1,
          maxLines: 6,
          style: TextStyle(fontSize: 19.0),
          controller: _controller,
          decoration: InputDecoration(
            hintText: 'Type a message...',
            contentPadding:
                EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0),
            border: OutlineInputBorder(
              borderRadius: BorderRadius.all(Radius.circular(32.0)),
            ),
            enabledBorder: OutlineInputBorder(
              borderSide: BorderSide(color: Color(0xFF25BBC2), width: 1.0),
              borderRadius: BorderRadius.all(Radius.circular(32.0)),
            ),
            focusedBorder: OutlineInputBorder(
              borderSide: BorderSide(color: Color(0xFF25BBC2), width: 2.0),
              borderRadius: BorderRadius.all(Radius.circular(32.0)),
            ),
          ),
        ),
      ),
      SizedBox(
        width: 4.0,
      ),
      Container(
        child: RawMaterialButton(
          onPressed: () {},
          child: Padding(
            padding: const EdgeInsets.only(left: 3.0),
            child: Icon(
              Icons.send,
              size: 27,
              color: Colors.white,
            ),
          ),
          elevation: 0,
          shape: CircleBorder(),
          constraints: BoxConstraints.tightFor(
            width: 48.0,
            height: 48.0,
          ),
        ),
        decoration: BoxDecoration(
          color: Color(0xFF25BBC2),
          borderRadius: BorderRadius.circular(40.0),
        ),
      ),
    ],
  ),

这就是输出:

在此处输入图像描述

这是我想要的输出:

谢谢:)

how can I make the RawMaterialButton stay down when the TextField multiline is enabled?
I am attaching some images to better understand what I need

That's my code:

Row(
    children: [
      Flexible(
        child: TextField(
          keyboardType: TextInputType.multiline,
          minLines: 1,
          maxLines: 6,
          style: TextStyle(fontSize: 19.0),
          controller: _controller,
          decoration: InputDecoration(
            hintText: 'Type a message...',
            contentPadding:
                EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0),
            border: OutlineInputBorder(
              borderRadius: BorderRadius.all(Radius.circular(32.0)),
            ),
            enabledBorder: OutlineInputBorder(
              borderSide: BorderSide(color: Color(0xFF25BBC2), width: 1.0),
              borderRadius: BorderRadius.all(Radius.circular(32.0)),
            ),
            focusedBorder: OutlineInputBorder(
              borderSide: BorderSide(color: Color(0xFF25BBC2), width: 2.0),
              borderRadius: BorderRadius.all(Radius.circular(32.0)),
            ),
          ),
        ),
      ),
      SizedBox(
        width: 4.0,
      ),
      Container(
        child: RawMaterialButton(
          onPressed: () {},
          child: Padding(
            padding: const EdgeInsets.only(left: 3.0),
            child: Icon(
              Icons.send,
              size: 27,
              color: Colors.white,
            ),
          ),
          elevation: 0,
          shape: CircleBorder(),
          constraints: BoxConstraints.tightFor(
            width: 48.0,
            height: 48.0,
          ),
        ),
        decoration: BoxDecoration(
          color: Color(0xFF25BBC2),
          borderRadius: BorderRadius.circular(40.0),
        ),
      ),
    ],
  ),

That's the output:

enter image description here

and this is the output I would like to have:
enter image description here

Thank you :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一影成城 2025-01-21 21:19:32

我已经通过添加解决了这个问题:

crossAxisAlignment: CrossAxisAlignment.end,

I have resolve it by adding:

crossAxisAlignment: CrossAxisAlignment.end,
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文