Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sidebar doesn't show on initial route, but on homeroute. #35

Open
anovis opened this issue Nov 14, 2022 · 5 comments
Open

Sidebar doesn't show on initial route, but on homeroute. #35

anovis opened this issue Nov 14, 2022 · 5 comments

Comments

@anovis
Copy link

anovis commented Nov 14, 2022

I am using MaterialApp for my flutter web project and for some reason the sidebar is not being rendered at all when the widget is set as an initial route, but it works correctly when it is set as the home route.

MaterialApp(
                title: 'project',
           
                onGenerateRoute: generateRoutes,
              
                initialRoute: YRoutes.WebHome,
                home: WebHome());

YRoutes.WebHome points to Webhome()`

MaterialPageRoute(
          settings: settings, builder: (BuildContext context) => WebHome())

curious why this might be the case.

@Jamalianpour
Copy link
Owner

When use it as initial route any error or warning occurring?

@anovis
Copy link
Author

anovis commented Nov 15, 2022

no. i didnt see any errors in the web console or in the dart debug logs. That was the strange part.

@thivankasarathchandra
Copy link

thivankasarathchandra commented Jan 17, 2023

This happens also when hot restart the app. After restating the app will be just like navigator pushed to the first widget instead of showing menu with the widgets.

Edit: the issue disappears when the route from material app is removed and just use pushReplacement just like this

Navigator.pushReplacement(context, MaterialPageRoute(builder: ((context) => Screen2()))),

@SteveBraich
Copy link

Is there an example somewhere of combining a Navigator and this easy_sidemenu widget?

@mdfaizanwar
Copy link

mdfaizanwar commented Sep 18, 2023

       Replace the _widthSize function with this code snippet:

   double _widthSize(SideMenuDisplayMode mode, BuildContext context) {
    if (mode == SideMenuDisplayMode.open) {
      Global.displayModeState.change(SideMenuDisplayMode.open);
      Future.delayed(_toggleDuration(), () {
       Global.showTrailing = true;
         for (var update in Global.itemsUpdate) {
           update();
         }
         });
         _notifyParent();
          return 250;
        }
      if (mode == SideMenuDisplayMode.compact) {
      if (Global.displayModeState.value != SideMenuDisplayMode.compact) {
        Global.displayModeState.change(SideMenuDisplayMode.compact);
        _notifyParent();
         Global.showTrailing = false;
       }
       return 66;
    }
    return 250;
   }

We can change the value 250 and 66 as we need

And, from SideMenuStyle(), set displayMode: SideMenuDisplayMode.open

I got this solution on StackOverFlow and applied the same, that works for me.
Please fix it in the library. This library is really awesome.
Thank You

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants