Coder Social home page Coder Social logo

Comments (4)

GreatGodson avatar GreatGodson commented on August 16, 2024 1

i also had the same issue. I was able to solve it by doing this.
There is a default Class MenuController that get's imported different from the one he created in this tutorial, so what i did was to rename the MenuController Class he created to CustomMenuController:



class CustomMenuController extends GetxController {
  static CustomMenuController instance = Get.find();
  var activeItem = overviewPageDisplayName.obs;

  var hoverItem = "".obs;

  changeActiveItemTo(String itemName) {
    activeItem.value = itemName;
  }

  onHover(String itemName) {
    if (!isActive(itemName)) hoverItem.value = itemName;
  }

  isHovering(String itemName) => hoverItem.value == itemName;

  isActive(String itemName) => activeItem.value == itemName;

  Widget returnIconFor(String itemName) {
    switch (itemName) {
      case overviewPageDisplayName:
        return _customIcon(Icons.trending_up, itemName);
      case driversPageDisplayName:
        return _customIcon(Icons.drive_eta, itemName);
      case clientsPageDisplayName:
        return _customIcon(Icons.people_alt_outlined, itemName);
      case authenticationPageDisplayName:
        return _customIcon(Icons.exit_to_app, itemName);
      default:
        return _customIcon(Icons.exit_to_app, itemName);
    }
  }

  Widget _customIcon(IconData icon, String itemName) {
    if (isActive(itemName)) return Icon(icon, size: 22, color: dark);

    return Icon(
      icon,
      color: isHovering(itemName) ? dark : lightGrey,
    );
  }
}


now in your main.dart, update to this:

void main() {
  Get.put(CustomMenuController());
  runApp(const MyApp());
}

Then ensure where you created an instance of MenuController is changed to CustomMenuController, this should help.

from flutter-web-dashboard-template.

jiraheta avatar jiraheta commented on August 16, 2024

@GreatGodson Thanks for your help. In my case, it solves the compiling errors but the debug mode runs and displays a white screen. At least that is a plus. I am getting close to getting this running.

Also, you forgot to mention looking in the controller.dart file.

import 'package:flutter_web_dashboard/controllers/menu_controller.dart';
import 'package:flutter_web_dashboard/controllers/navigation_controller.dart';

CustomMenuController menuController = CustomMenuController.instance;
NavigationController navigationController = NavigationController.instance;

Update: I was able to get it running. I ended up looking into a resolved issue and found the answer. I got it running.

from flutter-web-dashboard-template.

GreatGodson avatar GreatGodson commented on August 16, 2024

@jiraheta I'm glad you were able to get it running.

from flutter-web-dashboard-template.

Wise10673226 avatar Wise10673226 commented on August 16, 2024

i am having the same issue and after following your steps, it worked like magic. Why did we have to change it to "CustomMenuController"?

from flutter-web-dashboard-template.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.