Home > Mobile >  The argument type 'Image' can't be assigned to the parameter type 'ImageProvider
The argument type 'Image' can't be assigned to the parameter type 'ImageProvider

Time:12-22

body: SingleChildScrollView(
        child: InkWell(
          splashColor: Colors.black87,
          onTap: () {},
          child: Ink.image(
              image: Image.asset('images/logo.png'), // here
            height: 100,
            width: 400,
            fit: BoxFit.cover,
          ),
        ),
      ),

I want to apply asset image on my text button

CodePudding user response:

You can use AssetImage

image:AssetImage('images/logo.png'), 

CodePudding user response:

it wants image with ImageProvider type and you can change it with this

body: SingleChildScrollView(
        child: InkWell(
          splashColor: Colors.black87,
          onTap: () {},
          child: Ink.image(
              image: AssetImage("images/logo.png"),
            height: 100,
            width: 400,
            fit: BoxFit.cover,
          ),
        ),
      ),
  • Related