【问题标题】:Flutter delete top border of showModalBottomSheetFlutter 删除 showModalBottomSheet 的上边框
【发布时间】:2020-04-22 14:50:07
【问题描述】:

enter image description here 链接图像中的边框以橙色圆圈标记。 有什么办法可以删除吗?

我的代码是:

   showModalBottomSheet(
        context: context,
        builder: (context) {
          return Container(
            decoration: BoxDecoration(
              borderRadius: BorderRadius.vertical(top: Radius.circular(30.0)),
              color: Colors.white,
             Radius.circular(30.0)),               
              ),   
            child: Container(
              height: 180,
              color: Color(0xFF737373),
              child: Container(
                child: Column(
                  children: <Widget>[
                    ListTile(
                     ),
                  ],
                ),
                decoration: BoxDecoration(
                  color: Theme.of(context).canvasColor,
                  borderRadius: BorderRadius.only(
                    topLeft: const Radius.circular(30),
                    topRight: const Radius.circular(30),
                  ),
                ),
              ),
            ),
          );
        });

【问题讨论】:

  • 你是指圆形边框还是灰色线条?

标签: flutter dart


【解决方案1】:

如果您指的是圆形边框,只需删除代码具有的所有borderRadius,但如果您指的是边框上方的灰线,请执行以下操作:

showModalBottomSheet(
  shape: RoundedRectangleBorder(         //setting a new shape
    borderRadius: BorderRadius.vertical(
      top: Radius.circular(30),
    ),
  ),
  context: context,
  builder: (context) {
    return Container(
      child: Column(
        children: <Widget>[
          ListTile(),
        ],
      ),
      height: 180,
    );
  },
);

【讨论】:

  • 谢谢你!这是完美的
  • 很高兴能帮上忙!
【解决方案2】:

试试这个:

 showModalBottomSheet(
    context: context,
    builder: (context) {
      return Container(
        height: 180,
        child: Column(
          children: <Widget>[
            ListTile(
              leading: Icon(Icons.menu),
              title: Text('Test1'),
            ),
            ListTile(
              leading: Icon(Icons.message),
              title: Text('Test2'),
            ),
            ListTile(
              leading: Icon(Icons.mic),
              title: Text('Test3'),
            ),
          ],
        ),
      );
    });

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-01-23
    • 1970-01-01
    • 2015-03-08
    • 1970-01-01
    • 2018-07-23
    • 2013-04-15
    • 2010-11-07
    • 2019-06-18
    相关资源
    最近更新 更多