How to add a border to a widget in Flutter?

后端 未结 7 639
别那么骄傲
别那么骄傲 2020-11-30 18:38

I\'m using Flutter and I\'d like to add a border to a widget (in this case, a Text widget).

I tried TextStyle and Text, but I didn\'t see how to add a border.

7条回答
  •  天涯浪人
    2020-11-30 19:41

    You can use Container to contain your widget:

    Container(
      decoration: BoxDecoration(
        border: Border.all(
        color: Color(0xff000000),
        width: 1,
      )),
      child: Text()
    ),
    

提交回复
热议问题