【问题标题】:Flutter remove space between widget in column颤振删除列中小部件之间的空间
【发布时间】:2019-05-05 10:52:09
【问题描述】:

嗨,我有 modalRoute,里面有列 但是在小部件之间它有垂直空间,如分隔线,我的modalRoute black.Withtransparent 以便透明的color 在小部件之间制作分隔线,如何删除该空间?

return SlideTransition(
position: panelDetailsPosition,
child: GestureDetector(
  onTap: () {
    FocusScope.of(context).requestFocus(FocusNode());
  },
  child: Column(
    crossAxisAlignment: CrossAxisAlignment.stretch,
    children: <Widget>[
      GestureDetector(
        onVerticalDragUpdate: _handleDragUpdate,
        onVerticalDragEnd: _handleDragEnd,
        behavior: HitTestBehavior.opaque,
        child: Container(
            margin: EdgeInsets.only(top: 50.0),
            height: 47.0,
            child: Container(
              decoration: BoxDecoration(
                  borderRadius: BorderRadius.only(
                      topLeft: Radius.circular(25.0),
                      topRight: Radius.circular(25.0)),
                  color: Colors.white),
              child: Padding(
                padding:
                    const EdgeInsets.fromLTRB(180.0, 20.0, 180.0, 20.0),
                child: Container(
                    decoration: BoxDecoration(
                        color: Colors.grey[300],
                        borderRadius: BorderRadius.all(
                            const Radius.circular(8.0)))),
              ),
            )),
      ),
      Expanded(
        child: PageView(
          controller: _pageViewController,
          // physics: NeverScrollableScrollPhysics(),
          children: <Widget>[
            pageViewItem(),
            pageViewDeskripsi(),
            pageViewItemPilihan()
          ],
        ),
      ),
      Row(
        children: <Widget>[
          Expanded(
            child: Container(
                color: CompanyColors.primary,
                child: Center(
                  child: InkWell(
                    child: Padding(
                      padding: const EdgeInsets.all(15.0),
                      child: Text(
                        "Add to Cart",
                        style: TextStyle(
                            color: Colors.white, fontSize: 20.0),
                      ),
                    ),
                    onTap: () {
                      gotToPilihan();
                    },
                  ),
                )),
          )
        ],
      )
    ],
  ),
),

这是我更改容器颜色以检查它的哪一部分

-浅蓝色容器

-没有颜色的容器(背景来自推送ModalRoute之前的其他页面)

-绿色容器

【问题讨论】:

  • 更改容器的颜色以检查添加这些行的部分
  • 颜色由此而来,当我将颜色更改为红色时,线条颜色更改为线条,materialRoute 类 MenuItem 的透明颜色扩展了 ModalRoute { @override Color get barrierColor => Colors. black.withOpacity(0.7);
  • 你也可以更新你的代码,但是在问题上做(用图像更新问题,用颜色更新代码),在下面删除你的答案
  • 那么如何让这个差距消失呢? @diegoveloper

标签: flutter flutter-layout


【解决方案1】:

这是 Flutter 的一个已知问题,Github 上的更多详细信息:#14288。有一些解决方法,但它们都不是一直有效。

【讨论】:

    猜你喜欢
    • 2020-05-04
    • 2020-05-18
    • 2019-06-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-05
    • 2019-08-11
    • 1970-01-01
    相关资源
    最近更新 更多