skip to Main Content
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

3

Answers


  1. You can use AssetImage

    image:AssetImage('images/logo.png'), 
    
    Login or Signup to reply.
  2. 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,
              ),
            ),
          ),
    
    Login or Signup to reply.
  3. Try the following code:

    body: SingleChildScrollView(
      child: InkWell(
        splashColor: Colors.black87,
        onTap: () {},
        child: Ink.image(
          image: AssetImage('images/logo.png'),
          height: 100,
          width: 400,
          fit: BoxFit.cover,
        ),
      ),
    ),
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search