Flutter route transition strange behavior

Issue

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,
    ),
  ),
);

Answered By – Kaushik Chandru

Answer Checked By – Timothy Miller (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *