title: showBottomSheet throwing an error complaining no scaffold
body: <p>Redirecting from LoginPage to OnBoarding. While onboarding click on a button need to show the bottom sheet. Using the Named routes for navigation.</p>
  <p>Later in the Loginpage will be navigating to the onboarding using  Navigator.pushNamed(context, '/onboarding'); to redirect.</p>
  <p>here is the main.dart</p>
  <pre><code>void main() {
    runApp(
      MultiProvider(
        providers: [ChangeNotifierProvider(create: (context) =&gt; ThemeModel())],
        child: DevicePreview(
          enabled: !kReleaseMode,
          builder: (context) =&gt; MyApp(),
        ),
      ),     
    );
    SystemChrome.setEnabledSystemUIOverlays([]);
  }
  
  class MyApp extends StatelessWidget {
    // This widget is the root of your application.
    @override
    Widget build(BuildContext context) {
      
      return MaterialApp(
        locale: DevicePreview.of(context).locale, // &lt;--- Add the locale
        builder: DevicePreview.appBuilder, // &lt;--- Add the builder
        theme: Provider.of&lt;ThemeModel&gt;(context).currentTheme,
        debugShowCheckedModeBanner: false,
        initialRoute: '/',
        routes: {
          // When navigating to the &quot;/&quot; route, build the FirstScreen widget.
          '/': (context) =&gt; LoginPage(),
          // When navigating to the &quot;/second&quot; route, build the SecondScreen widget.
          '/onboarding': (context) =&gt; OnboardingPage(),
          '/home': (context) =&gt; Home(),
        },
       
      );
    }
  }
  </code></pre>
  <p>here is the code snippet for the buttonClick and then open the bottomsheet</p>
  <p>_getButton(String hint, int index, BuildContext context) {
  return MaterialButton(
  height: 58,
  minWidth: 340,
  shape: RoundedRectangleBorder(borderRadius: new BorderRadius.circular(12)),
  onPressed: () {
  if(index == 1){</p>
  <pre><code>  **showBottomSheet(
                context: context,
                builder: (context) =&gt; BasicProfileBottomSheetWidget());
    }**
  },
  child: Text(
    hint,
    style: TextStyle(
      fontSize: 22,
      color: Colors.black,
    ),
  ),
  color: Colors.white,
  </code></pre>
  <p>);
  }</p>
  <p>Here is my widget tree
  <a href="https://i.stack.imgur.com/0qRDL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0qRDL.png" alt="WidgetTree" /></a></p>
  <p>Here is the error.</p>
  <pre><code>[38;5;248m════════ Exception caught by gesture ═══════════════════════════════════════════[39;49m
  [38;5;244mThe following assertion was thrown while handling a gesture:[39;49m
  No Scaffold widget found.
  
  [38;5;244mOnboardingPage widgets require a Scaffold widget ancestor.[39;49m
  [38;5;244mThe specific widget that could not find a Scaffold ancestor was: OnboardingPage[39;49m
      [38;5;244mstate: _OnboardingPageState#4c2bb[39;49m
  [38;5;244mThe ancestors of this widget were[39;49m
      [38;5;244mMaterialApp[39;49m
          [38;5;244mstate: _MaterialAppState#e362b[39;49m
      [38;5;244mMyApp[39;49m
          [38;5;244mdependencies: [_InheritedProviderScope&lt;ThemeModel&gt;][39;49m
      [38;5;244mDevicePreview[39;49m
          [38;5;244mstate: DevicePreviewState#2a192[39;49m
      [38;5;244mChangeNotifierProvider&lt;ThemeModel&gt;[39;49m
          [38;5;244mvalue: Instance of 'ThemeModel'[39;49m
          [38;5;244mlistening to value[39;49m
      [38;5;244mMultiProvider[39;49m
      [38;5;244m...[39;49m
  
  [38;5;248mTypically, the Scaffold widget is introduced by the MaterialApp or WidgetsApp widget at the top of your application widget tree.[39;49m
  
  [38;5;244mWhen the exception was thrown, this was the stack[39;49m
  [38;5;244m#0      debugCheckHasScaffold.&lt;anonymous closure&gt;[39;49m
  [38;5;244m#1      debugCheckHasScaffold[39;49m
  [38;5;244m#2      showBottomSheet[39;49m
  [38;5;248m#3      _getButton.&lt;anonymous closure&gt;[39;49m
  [38;5;244m#4      _InkResponseState._handleTap[39;49m
  [38;5;244m...[39;49m
  [38;5;244mHandler: &quot;onTap&quot;[39;49m
  [38;5;244mRecognizer: TapGestureRecognizer#bb0ca[39;49m
      [38;5;244mdebugOwner: GestureDetector[39;49m
      [38;5;244mstate: ready[39;49m
      [38;5;244mwon arena[39;49m
      [38;5;244mfinalPosition: Offset(422.5, 960.5)[39;49m
      [38;5;244mfinalLocalPosition: Offset(166.7, 29.3)[39;49m
      [38;5;244mbutton: 1[39;49m
      [38;5;244msent tap down[39;49m
  [38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
  </code></pre>