栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

带有圆角的警报对话框

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

带有圆角的警报对话框

设置BoxDecoration的容器位于警报对话框下的小部件树中。这意味着您仅在对话框的填充内设置了一个框。您需要创建一个自定义alertDialog /
showDialog并在其中设置半径。在自定义窗口小部件中,您还可以添加按钮以及除该填充外您需要工作的所有内容。

当在项目(gist.github.com)中包含customShowDialog.dart文件时,您可以在此处编辑半径

borderRadius:BorderRadius.all(Radius.circular(20.0))
并按如下方式调用它:

return new CustomalertDialog(    content: new Container(        width: 260.0,        height: 230.0,        decoration: new BoxDecoration(        shape: BoxShape.rectangle,        color: const Color(0xFFFFFF),        borderRadius: new BorderRadius.all(new Radius.circular(32.0)),        ),        child: new Column(        crossAxisAlignment: CrossAxisAlignment.stretch,        children: <Widget>[ // dialog top new Expanded( child: new Row(     children: <Widget>[     new Container(         // padding: new EdgeInsets.all(10.0),         decoration: new BoxDecoration(         color: Colors.white,         ),         child: new Text(         'Rate',         style: TextStyle(  color: Colors.black,  fontSize: 18.0,  fontFamily: 'helvetica_neue_light',         ),         textAlign: TextAlign.center,         ),     ),     ], ), ), // dialog centre new Expanded( child: new Container(     child: new TextField(     decoration: new InputDecoration(     border: InputBorder.none,     filled: false,     contentPadding: new EdgeInsets.only(         left: 10.0,         top: 10.0,         bottom: 10.0,         right: 10.0),     hintText: ' add review',     hintStyle: new TextStyle(         color: Colors.grey.shade500,         fontSize: 12.0,         fontFamily: 'helvetica_neue_light',     ),     ), )), flex: 2, ), // dialog bottom new Expanded( child: new Container(     padding: new EdgeInsets.all(16.0),     decoration: new BoxDecoration(     color: const Color(0xFF33b17c),     ),     child: new Text(     'Rate product',     style: TextStyle(         color: Colors.white,         fontSize: 18.0,         fontFamily: 'helvetica_neue_light',     ),     textAlign: TextAlign.center,     ), ), ),        ],        ),    ),    );});

您将获得如下内容:

编辑:

尽管Flutter最近引入了shape属性,它可以通过设置ShapeBorder来帮助您处理圆角,例如

shape: RoundedRectangleBorder(    borderRadius: BorderRadius.all(Radius.circular(20.0))),

您仍然需要快速为某些自定义添加自定义窗口小部件,例如自定义填充,如上所述。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/430760.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号