skip to Main Content

I want to put text below the image in a gridview

What I want:

enter image description here

What I have:

enter image description here

I want the music title and the artist name below the music cover, not inside, how do I do this?

Page code

Container Item code

2

Answers


  1. Instead of using this in your container:

    decoration: BoxDecoration(
      image: DecorationImage(
        image: AssetImage(musicData['imagePath']),
        fit: BoxFit.fill,
      ),
      borderRadius: BorderRadius.circular(15),
    ),
    

    Why not simply use a Column widget? With this, you can insert multiple widgets inside the children: field (instead of sticking to 1 maximum at your container)

    So something that looks like that as example:

    Column(
      children: const <Widget>[
        AssetImage(musicData['imagePath']),
        Text('Your title here'),
        Text('A description, etc.')
      ],
    )
    
    Login or Signup to reply.
  2. You can try this

    Column(
    children: const [

    SizedBox(height:50,width:50,child:AssetImage(musicData['imagePath']),
    Flexible(child:
              Text('Your title here',
                    overflow: TextOverflow.ellipsis,maxLines: 1),),
    Flexible(child:
             Text('description,etc.',
                   overflow: TextOverflow.ellipsis,maxLines: 1),),
    

    ],
    )

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search