本文共 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/