flutter - 如何在flutter中实现这种类型的模糊效果
问题描述
我正在尝试在 youtube、网站、flutter 官方网站中找到这种效果的解决方案 1 天,但我没有找到这样的解决方案。有人知道如何在 Container Widget 的角落边缘实现这种模糊效果吗?
解决方案
ShaderMask(
shaderCallback: (Rect bounds) {
return LinearGradient(
colors: [Colors.white.withOpacity(0.05),Colors.white],
stops: [0.1, 1],
tileMode: TileMode.mirror,
begin: Alignment.topCenter,
end: Alignment.bottomCenter
).createShader(bounds);
},
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 50,height: 50,
color: Colors.red,
),
Container(
width: 50,height: 50,
color: Colors.blue,
),
Container(
width: 50,height: 50,
color: Colors.black,
),
Container(
width: 50,height: 50,
color: Colors.red,
),
Container(
width: 50,height: 50,
color: Colors.blue,
),
Container(
width: 50,height: 50,
color: Colors.black,
),
],
)
)
推荐阅读
- r - 如何根据两个不同的条件为真用 ggplot 标记一个点?
- python - crontab Python 脚本中的“ImportError:没有名为请求的模块”
- python - pip install --upgrade pip 不是升级 pip
- javascript - 为什么点击提交按钮后无法清除数据?
- flutter - 如何创建相关图?
- c# - 拦截 SqlServerMigrationsSqlGenerator 以防止某些表的迁移?
- c# - 如何确定 String.Split() 中使用的字符
- c# - cshtml中的多对多关系没有获取数据
- python - 元组的问题
- arrays - 引用单元格数据作为工作表名称源的一部分的 Google 工作表查询