Deprecate `OverlayPortal.targetsRootOverlay`
Summary
#The OverlayPortal.targetsRootOverlay
property was deprecated and
replaced with overlayLocation
.
Context
#A parameter overlayLocation
was added to the OverlayPortal default constructor to
control where the overlay child renders. As the result, the constructor
OverlayPortal.targetsRootOverlay
was no longer useful.
Description of change
#The OverlayPortal.targetsRootOverlay
was deprecated.
Migration guide
#If you are using OverlayPortal.targetsRootOverlay
, you can use OverlayPortal
with
overlayLocation
instead.
Case 1: trivial case
#Code before migration:
Widget build(BuildContext context) {
return OverlayPortal.targetsRootOverlay(
controller: myController,
overlayChildBuilder: _myBuilder,
child: myChild,
);
}
Code after migration:
Widget build(BuildContext context) {
return OverlayPortal(
overlayLocation: OverlayChildLocation.rootOverlay,
controller: myController,
overlayChildBuilder: _myBuilder,
child: myChild,
);
}
Timeline
#Landed in version: 3.35.0-0.0.pre
In stable release: TBD
References
#API documentation:
Relevant issue:
Relevant PR:
除非另有说明,本文档之所提及适用于 Flutter 的最新稳定版本,本页面最后更新时间: 2025-09-04。 查看文档源码 或者 为本页面内容提出建议.