ModalRoute / ModalBarrier customization #21039
Copy link
Copy link
Open
flutter/packages
#12509Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityf: routesNavigator, Router, and related APIs.Navigator, Router, and related APIs.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Description
Currently, ModalRoutes created using showDialog or showGeneralDialog do not allow full customization of the underlying ModalBarrier.
It’s only possible to change the background color, however I’d like full control over the animated widget in order to build my own. For example, a customer requested to apply Gaussian blur to the barrier.
The current solution involves creating the barrier myself and not using the neat routing system.
So the same way that showGeneralRoute has a PageBuilder Parameter, it could gain a BarrierBuilder.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityf: routesNavigator, Router, and related APIs.Navigator, Router, and related APIs.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Activity
saibotma commentedon Jun 16, 2023
It would be great if the dismiss action could be customized as well. Currently, it just pops on dismiss, which is not always appropriate.
Mairramer commentedon Feb 16, 2026
ince this issue is still open, I’d like to share a clean way to fully customize the ModalBarrier (e.g., adding a Gaussian blur) without requiring changes to Flutter’s core.
The approach is to extend
RawDialogRouteand override buildModalBarrier, allowing the barrier to be wrapped with any widget (such as BackdropFilter) and enabling a custom dismissal callback.This provides full control over the barrier’s appearance and behavior while remaining compatible with the existing Navigator API.
View example on DartPad
Add barrierBuilder support to showDialog and showGeneralDialog (flutt…