Skip to content

ModalRoute / ModalBarrier customization #21039

Open
flutter/packages
#12509

Description

@ened

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.

Activity

  1. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Aug 26, 2018
  2. added this to the milestone on Aug 26, 2018
  3. added
    P2Important issues not at the top of the work list
    on May 29, 2020
  4. removed this from the milestone on Aug 17, 2020
  5. saibotma commented on Jun 16, 2023

    @saibotma

    It would be great if the dismiss action could be customized as well. Currently, it just pops on dismiss, which is not always appropriate.

  6. Mairramer commented on Feb 16, 2026

    @Mairramer
    Contributor

    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 RawDialogRoute and 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: new featureNothing broken; request for a new capabilityf: routesNavigator, Router, and related APIs.frameworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions