Home > Mobile >  flutter image so little
flutter image so little

Time:12-12

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

CodePudding user response:

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

CodePudding user response:

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!

CodePudding user response:

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(),
      ),
  • Related