Skip to content

Commit

Permalink
Merge pull request #27 from HasanElHefnawy/master
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamalianpour committed Sep 13, 2022
2 parents 593f499 + 7cf3d3c commit 47076ef
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 @@ -94,7 +94,9 @@ class _SideMenuItemState extends State<SideMenuItem> {
}

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

@override
Expand Down

0 comments on commit 47076ef

Please sign in to comment.