博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
flutter-实现圆角带边框的view(android无效)
阅读量:4056 次
发布时间:2019-05-25

本文共 1497 字,大约阅读时间需要 4 分钟。

 

注意:当前version1.9.1+hotfix2,mac,下面的效果只能在iOS上有效,安卓无效

 

x下面的两种方式在iOS有效:

1.使用boxDecoration

return new Container(        decoration: new BoxDecoration(            color: Colors.grey,            borderRadius: BorderRadius.all(Radius.circular(5.0)),            border: Border.all(width: 2, color: Colors.green)),        padding: EdgeInsets.all(1),        child: new Text(          '测试按钮',          style: TextStyle(color: Colors.black),        ),      );

2.使用shapeDecoeation

new Container(      decoration: new ShapeDecoration(          color: Colors.grey,          shape: RoundedRectangleBorder(            borderRadius: BorderRadius.all(Radius.circular(10.0)),            side: BorderSide(              width: 2,              color: Colors.green,            ),          )),      padding: EdgeInsets.all(5),      child: new Text(        '测试按钮1',        style: TextStyle(color: Colors.black),      ),    );

如果需要在android有效(只是实现左右是半圆的效果-足球场效果,自定义圆角未知):

android实现左右圆角:

shapeDecoeation的时候使用StadiumBorder。

new Container(              padding:                  const EdgeInsets.only(left: 10, top: 2, right: 10, bottom: 2),              decoration: new ShapeDecoration(                color: !isClicking1 ? Colors.white : Color(0xff898989),                shape: StadiumBorder(                    side: BorderSide(                        color: Color(0xff898989),                        style: BorderStyle.solid,                        width: 1)),              ),              child: new Text('跳过'),            ),

 

转载地址:http://fxeci.baihongyu.com/

你可能感兴趣的文章
SSH原理与运用
查看>>
SIGN UP BEC2
查看>>
S3C2440中对LED驱动电路的理解
查看>>
《天亮了》韩红
查看>>
Windows CE下USB摄像头驱动开发(以OV511为例,附带全部源代码以及讲解) [转]
查看>>
出现( linker command failed with exit code 1)错误总结
查看>>
iOS开发中一些常见的并行处理
查看>>
iOS获取手机的Mac地址
查看>>
ios7.1发布企业证书测试包的问题
查看>>
如何自定义iOS中的控件
查看>>
iOS 开发百问
查看>>
Mac环境下svn的使用
查看>>
github简单使用教程
查看>>
如何高效利用GitHub
查看>>
环境分支-git版本管理
查看>>
uni-app 全局变量
查看>>
js判断空对象的几种方法
查看>>
java 不用递归写tree
查看>>
springboot2 集成Hibernate JPA 用 声明式事物
查看>>
fhs-framework jetcache 缓存维护之自动清除缓存
查看>>