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(); } } } +