简体   繁体   English

Flutter:如何自定义容器(或其他小部件)的边框?

[英]Flutter: How can I customize the Border of a Container (or other Widgets)?

I have a special requirement on my Container border.我对Container边框有特殊要求。 It should only have a border on the left , right and bottom but not on the top.它应该只在左侧右侧底部有边框,但在顶部没有边框。

Container(
            decoration: BoxDecoration(
              color: Color.fromRGBO(146, 94, 58, 1.0),
              border: Border.all(
                color: Color.fromRGBO(85, 63, 48, 1.0),
                width: 2,
              ),
              borderRadius: BorderRadius.only(
                bottomLeft: Radius.circular(2),
                bottomRight: Radius.circular(2),
              ),
            ),
          )

I can only find .all and .symmetric but nothing like .only which I have seen for the BorderRadius Widget.我只能找到.all.symmetric但没有像我在.only Widget 中看到的BorderRadius Why is it missing for Border and how can I make this still work?为什么Border缺少它,我怎样才能使它仍然有效?

look this question 看这个问题

and you can read this article 你可以阅读这篇文章

Container(
 decoration: BoxDecoration(
            border: Border(
              bottom: BorderSide(width: 1.5, color: Colors.grey[300]),
            ),
          ),
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM