Flutter : showModalBottomSheet above bottomNavigationBar natively

61 views Asked by At

i want to show showModalBottomSheet above bottomNavigationBar natively without Stack or any other custom widget

currently this is my code

body: Navigator(
onGenerateRoute: (settings) {
 return MaterialPageRoute(
  builder: (context) {
    return ListView(
     children: [
       TextButton( 
        onPressed: () {
         showModalBottomSheet( <-- Triggered from this inside `Navigator`
          useRootNavigator: false,
          context: context,
          builder: (_) => const SizedBox(
            height: 200,
            child: Text(
             'Modal bottom sheet',
             style: TextStyle(fontSize: 30),
          ),
         ),
        );
       },
       child: CustomText().darkGrey(
        txt: 'Add to wishlist',
        size: 17,
       ),
      ),
      const DetailProductStoreName(),
     ],
    );
   },
  );
 },
),
bottomNavigationBar: AddToCartBottomNav(), <--what i expect is triggered within 'bottomNavigationBar'



left pict when triggered within body -> Navigator -> MaterialPageRoute

right pict when triggered within bottomNavigationBar

Triggered from Body enter image description here

what i expect is showModalBottomSheet triggered from bottomNavigationBar and modalSheet can show above Add to Cart button just like on left pict

0

There are 0 answers