Search code examples
flutterflutter-navigation

Flutter route transition strange behavior


I'm using navigator push to my widget and when i click on my button i see my new screen with a transparent background and behind my previous screen. After less than 1 second background is not transparent anymore.

Navigator.push(
 context,
 MaterialPageRoute(builder: (context) => Planified(
   form: intervention, 
   element: e.value
 )
),
                                          )

Could you help me please

Thanks


Solution

  • To get a transparent background try page builder

    Navigator.of(context).push(
      PageRouteBuilder(
        opaque: false, //or true if you want it as opaque
        pageBuilder: (_, __, ___) => Planified(
          form: intervention, 
          element: e.value,
        ),
      ),
    );