如何在颤动中为下拉按钮制作圆形边框? [英] How to make rounded border for dropdownbutton in flutter?

查看:21
本文介绍了如何在颤动中为下拉按钮制作圆形边框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何添加圆角矩形边框?下面的代码没有在屏幕上产生任何边框.

How to Add Rounded Rectangle Border? Below Code didn't result in any border on screen.

Container(margin: EdgeInsets.only(top: 10.0, right: 10.0, left: 10.0),
 width: double.infinity,
 // decoration: ShapeDecoration(
 //  shape: RoundedRectangleBorder(
 //   borderRadius:BorderRadius.all(Radius.circular(5.0)),
 //                             ),

 child: DropdownButtonHideUnderline(
  child: Container(
   margin: EdgeInsets.only(
    left: 10.0, right: 10.0),
     child: new DropdownButton<UserTest>(...),
                           ),
                          ),
                   ),

推荐答案

您需要指定 side: 属性.默认为 BorderSide.none.

You need to specify the side: property. By default it is BorderSide.none.

      decoration: ShapeDecoration(
        shape: RoundedRectangleBorder(
          side: BorderSide(width: 1.0, style: BorderStyle.solid),
          borderRadius: BorderRadius.all(Radius.circular(5.0)),
        ),
      ),

这篇关于如何在颤动中为下拉按钮制作圆形边框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆