勿以善小而不为,勿以恶小而为之。——刘备

      

阴影(BoxShadow)+Y轴偏移量(Offset)

 
class _MyHomePageState extends State<MyHomePage> { @override Widget
build(BuildContext context) { return Scaffold( appBar: AppBar( title:
Text(widget.title), ), body: Container( padding: EdgeInsets.all(20.0), margin:
EdgeInsets.all(20.0), decoration: new BoxDecoration( color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(10.0)), border: new
Border.all(width: 1, color: Colors.green,), boxShadow: [ BoxShadow( color:
Colors.green, offset: Offset(0.0, 6.0), //阴影y轴偏移量 blurRadius: 0, //阴影模糊程度
spreadRadius: 0 //阴影扩散程度 ) ], ), child:
Text("BoxShadow(绘制阴影)+Container+BoxDecoration"), )); } }
 阴影(BoxShadow)+X轴偏移量(Offset)

     

 
class _MyHomePageState extends State<MyHomePage> { @override Widget
build(BuildContext context) { return Scaffold( appBar: AppBar( title:
Text(widget.title), ), body: Container( padding: EdgeInsets.all(20.0), margin:
EdgeInsets.all(20.0), decoration: new BoxDecoration( color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(10.0)), border: new
Border.all(width: 1, color: Colors.black,), boxShadow: [ BoxShadow( color:
Colors.black, offset: Offset(6.0, 0.0), //阴影x轴偏移量 blurRadius: 0, //阴影模糊程度
spreadRadius: 0 //阴影扩散程度 ) ], ), child:
Text("BoxShadow(绘制阴影)+Container+BoxDecoration"), )); } }
 阴影(BoxShadow)+XY轴偏移量(Offset)

      

class _MyHomePageState extends State<MyHomePage> { @override Widget
build(BuildContext context) { return Scaffold( appBar: AppBar( title:
Text(widget.title), ), body: Container( padding: EdgeInsets.all(20.0), margin:
EdgeInsets.all(20.0), decoration: new BoxDecoration( color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(10.0)), border: new
Border.all(width: 1, color: Colors.green,), boxShadow: [ BoxShadow( color:
Colors.green, offset: Offset(6.0, 6.0), //阴影x轴偏移量 blurRadius: 0, //阴影模糊程度
spreadRadius: 0 //阴影扩散程度 ) ], ), child:
Text("BoxShadow(绘制阴影)+Container+BoxDecoration"), )); } }
 阴影(BoxShadow)+XY轴偏移量(Offset) +模糊(blurRadius)

     

 
class _MyHomePageState extends State<MyHomePage> { @override Widget
build(BuildContext context) { return Scaffold( appBar: AppBar( title:
Text(widget.title), ), body: Container( padding: EdgeInsets.all(20.0), margin:
EdgeInsets.all(20.0), decoration: new BoxDecoration( color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(10.0)), border: new
Border.all(width: 1, color: Colors.black,), boxShadow: [ BoxShadow( color:
Colors.black, offset: Offset(-6.0, 6.0), //阴影x轴偏移量 blurRadius: 10, //阴影模糊程度
spreadRadius: 0 //阴影扩散程度 ) ], ), child:
Text("BoxShadow(绘制阴影)+Container+BoxDecoration"), )); } }
阴影(BoxShadow)+XY轴偏移量(Offset) +模糊(blurRadius)+扩散(spreadRadius) 

      
class _MyHomePageState extends State<MyHomePage> { @override Widget
build(BuildContext context) { return Scaffold( appBar: AppBar( title:
Text(widget.title), ), body: Container( padding: EdgeInsets.all(20.0), margin:
EdgeInsets.all(20.0), decoration: new BoxDecoration( color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(10.0)), border: new
Border.all(width: 1, color: Colors.green,), boxShadow: [ BoxShadow( color:
Colors.green, offset: Offset(-6.0, 6.0), //阴影x轴偏移量 blurRadius: 10, //阴影模糊程度
spreadRadius: 10 //阴影扩散程度 ) ], ), child:
Text("BoxShadow(绘制阴影)+Container+BoxDecoration"), )); } }
withOpacity淡化阴影

     
class _MyHomePageState extends State<MyHomePage> { @override Widget
build(BuildContext context) { return Scaffold( appBar: AppBar( title:
Text(widget.title), ), body: Container( padding: EdgeInsets.all(20.0), margin:
EdgeInsets.all(20.0), decoration: new BoxDecoration( color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(10.0)), border: new
Border.all(width: 0, color: Colors.red,), boxShadow: [ BoxShadow( color:
Colors.red.withOpacity(0.2), offset: Offset(-6.0, 6.0), //阴影x轴偏移量 blurRadius:
10, //阴影模糊程度 spreadRadius: 5 //阴影扩散程度 ) ], ), child:
Text("BoxShadow(绘制阴影)+Container+BoxDecoration"), )); } }
通过英文单词理解:

box-盒子

shadow-阴影

blur-模糊

spread-传播扩散

我们可以理解为: 这样一个装有widget的盒子的外面需要添加阴影效果,我们可以设置阴影扩散范围和阴影模糊程度.

 

技术
©2020 ioDraw All rights reserved
特征工程【深度学习】目标检测中 IOU 的概念及计算(精华)2020年6月26日 C#类库 Random随机数帮助类今天你抱怨了吗?比特币突破8000美元 背后暗藏杀机分享一场黑客帝国代码雨脚本,简单好玩!layui.table动态获取表头和列表数据示例特朗普的"VIP疗法":正接受一种尚未获批的药物治疗python保存excel文件列宽自适应解决方案Android EditText限制输入的最大字符数