ImageFilter.blur default tile mode automatic selection.
Summary
#The ui.ImageFilter.blur
's default tile mode is
now automatically selected by the backend.
Previously TileMode.clamp
was used unless a different tile mode was specified.
Now, the default is null
and specifies automatic selection unless
a specific tile mode is specified.
Background
#ImageFilter.blur
's tile mode specifies what happens to
edge pixels for the applied filter.
There are four options:
TileMode.clamp
(the previous default)Tilemode.repeated
TileMode.mirror
TileMode.decal
Previously, if the behavior wasn't specified,
ImageFilter
defaulted to clamp
mode.
This sometimes surprised developers as it didn't always match expectations.
As of this change, the filter automatically selects the following tile modes based on context:
decal
with save layers and when applied to individual shape draws (such as withdrawRect
anddrawPath
).mirror
with backdrop filters.clamp
fordrawImage
.
Migration guide
#Only blur image filters that don't specify an explicit tile mode are impacted by this change.
We believe that the new defaults are generally better and would recommend removing any specified blur tile modes.
Code before migration:
final filter = ui.ImageFilter.blur(sigmaX: 4, sigmaY: 4, tileMode: TileMode.decal);
Code after migration:
final filter = ui.ImageFilter.blur(sigmaX: 4, sigmaY: 4);
Timeline
#Landed in version: 3.28.0-0.1.pre
In stable release: Not yet
References
#API documentation:
Relevant issues:
Relevant PRs:
除非另有说明,本文档之所提及适用于 Flutter 的最新稳定版本,本页面最后更新时间: 2024-12-16。 查看文档源码 或者 为本页面内容提出建议。