mirage
mirage

Reputation: 177

How can I make the text from the widget wrap?

I have the following code:

GridTile(
      footer: Material(
          color: Colors.transparent,
          shape: const RoundedRectangleBorder(
              borderRadius: BorderRadius.vertical(bottom: Radius.circular(4))),
          clipBehavior: Clip.antiAlias,
          child: GridTileBar(
            backgroundColor: Colors.black45,
            title: Flexible(
                child: Text(
              exam.examSpecifications.subject,
              overflow: TextOverflow.clip,
            )),
            subtitle: Text(exam.examSpecifications.examName),
          )),
      child: exam.examImage,
    );
  }

What I get is the following behaviour:

enter image description here

Ideally, I would like this to show as

   Some Other
   Subject
   Some Other ...

Is there a way to do this?

Upvotes: 0

Views: 48

Answers (1)

Ali Mohammadzadeh
Ali Mohammadzadeh

Reputation: 686

I hope to I understand what you want. You can set overflow and softWrap property of title Text like code below and remove Flexible widget:

title: Text(
                  exam.examSpecifications.subject,
                  overflow: TextOverflow.visible,
                  softWrap: true,
                ),

Upvotes: 1

Related Questions