skip to Main Content

I want to add my logo but logo doesn’t seem.

 leading: Image.asset(
            "assets/icons/belha-logo.jpg",
            fit: BoxFit.cover,
            height: 40,
            width: 40,
          ),

That is image of my phone

I tried to give width,height and fit property of asset image but dont work

3

Answers


  1. Add your file path on pubspec.yaml
    example:

    flutter:
      assets:
        - assets/my_icon.png
        - assets/background.png
    

    if you just added a file, u need to kill your app and re launch it

    Login or Signup to reply.
  2. See the fact that you are using the image in the AppBar makes no effect if you increase the height or width of the image.
    What you need to do is:-

    1. Either make a custom appbar for your use.
    2. Or design the logo in such a way that when it is shrinked to that size it doesn’t affect the quality.

    Hope this helps!

    Login or Signup to reply.
  3. Just add toolbarHeight and leadingWidth in AppBar according to your requirements and that will do the trick 🙂

    AppBar(
              toolbarHeight: 200,
              leadingWidth: 160,
              leading: Image.network(
                'https://upload.wikimedia.org/wikipedia/commons/9/99/Sample_User_Icon.png',
                fit: BoxFit.cover,
                height: 140,
                width: 140,
              ),
            ),
            body: Container(),
          ),
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search