Search code examples
flutterflutter-layout

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


I have a special requirement on my Container border. 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. Why is it missing for Border and how can I make this still work?


Solution

  • look this question

    and you can read this article

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