abuanwar072 / Flutter-Responsive-Admin-Panel-or-Dashboard

Responsive Admin Panel or Dashboard using Flutter
https://youtu.be/_uOgXpEHNbc
MIT License
6.61k stars 1.87k forks source link

MenuController Build Errors #55

Closed RandomlyOnside closed 1 year ago

RandomlyOnside commented 1 year ago

Describe the bug MenuController Build Errors

One example

The name 'MenuController' is defined in the libraries 'package:admin/controllers/MenuController.dart' and 'package:flutter/src/material/menu_anchor.dart (via package:flutter/material.dart)'.
Try using 'as prefix' for one of the import directives, or hiding the name from all but one of the imports.

See screenshot of other errors.

To Reproduce

Launching lib\main.dart on Chrome in debug mode...
lib/main.dart:28:34: Error: 'MenuController' is imported from both 'package:admin/controllers/MenuController.dart' and
'package:flutter/src/material/menu_anchor.dart'.
            create: (context) => MenuController(),
                                 ^^^^^^^^^^^^^^
lib/screens/main/main_screen.dart:12:43: Error: The getter 'scaffoldKey' isn't defined for the class 'MenuController'.
 - 'MenuController' is from 'package:flutter/src/material/menu_anchor.dart'
 ('../flutter/packages/flutter/lib/src/material/menu_anchor.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'scaffoldKey'.
      key: context.read<MenuController>().scaffoldKey,
                                          ^^^^^^^^^^^
lib/screens/dashboard/components/header.dart:3:1: Error: 'MenuController' is imported from both
'package:admin/controllers/MenuController.dart' and 'package:flutter/src/material/menu_anchor.dart'.
import 'package:flutter/material.dart';
^^^^^^^^^^^^^^

Expected behavior Clean Build/Run

Screenshots

image

Desktop (please complete the following information):

Additional context I believe I didn't have this issue with a prior version of Flutter. I am new to this so I am not entirely sure, but I think its flutter 3.7 that is causing this?

RandomlyOnside commented 1 year ago

Sorry - total noob here...

The bandaid I found was: In controllers\MenuController.dart, I renamed MenuController to SideMenuController and fixed all references. I can build now. There likely is a better/cleaner way to resolve this.

Sully55 commented 1 year ago

i got the same issues, yet it didn't solve the problems for me

abuanwar072 commented 1 year ago

Solved. Check the latest marge.