From 448b830f83be5b88a84fddcf7f76c9463c92b3ae Mon Sep 17 00:00:00 2001 From: Somama Siddiqui <146497258+Somama12@users.noreply.github.com> Date: Tue, 20 Feb 2024 16:50:54 -0500 Subject: [PATCH] Update MenuAppController.dart --- lib/controllers/MenuAppController.dart | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/controllers/MenuAppController.dart b/lib/controllers/MenuAppController.dart index 7e966279..b9dafcfc 100644 --- a/lib/controllers/MenuAppController.dart +++ b/lib/controllers/MenuAppController.dart @@ -1,13 +1,16 @@ -import 'package:flutter/material.dart'; +iimport 'package:flutter/material.dart'; class MenuAppController extends ChangeNotifier { final GlobalKey _scaffoldKey = GlobalKey(); GlobalKey get scaffoldKey => _scaffoldKey; - void controlMenu() { - if (!_scaffoldKey.currentState!.isDrawerOpen) { - _scaffoldKey.currentState!.openDrawer(); + void toggleMenu() { + final isDrawerOpen = _scaffoldKey.currentState?.isDrawerOpen ?? false; + + if (!isDrawerOpen) { + _scaffoldKey.currentState?.openDrawer(); } } } +