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

fix issue SideMenu doesn't show when navigation back and forth #27

Merged
merged 1 commit into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/src/side_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class _SideMenuState extends State<SideMenu> {
late bool showToggle;
late bool alwaysShowFooter;
late int collapseWidth;
late SideMenuDisplayMode _mode;

@override
void initState() {
Expand All @@ -93,6 +94,7 @@ class _SideMenuState extends State<SideMenu> {

/// Set [SideMenu] width according to displayMode and notify parent widget
double _widthSize(SideMenuDisplayMode mode, BuildContext context) {
_mode = mode;
if (mode == SideMenuDisplayMode.auto) {
if (MediaQuery.of(context).size.width > collapseWidth &&
Global.displayModeState.value != SideMenuDisplayMode.open) {
Expand Down Expand Up @@ -223,4 +225,10 @@ class _SideMenuState extends State<SideMenu> {
),
);
}

@override
void dispose() {
super.dispose();
Global.displayModeState.change(_mode);
}
}
4 changes: 3 additions & 1 deletion lib/src/side_menu_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ class _SideMenuItemState extends State<SideMenuItem> {
}

void update() {
setState(() {});
if (mounted) {
setState(() {});
}
}

@override
Expand Down