Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamalianpour committed Sep 16, 2022
2 parents 193ac68 + 47076ef commit 30c43f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
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 @@ -92,7 +92,9 @@ class _SideMenuItemState extends State<SideMenuItem> {
}

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

@override
Expand Down

0 comments on commit 30c43f7

Please sign in to comment.