Flutter adding icon right after a long text

Issue

I want to add a tapable icon right after a long text. I need to use Text widget since I’m using textDirection and maxLines params.

Any ideas?

The problem:
enter image description here

What I need to get:
enter image description here

Solution

as Karen said it we need to use RichText.

 Text.rich(
        TextSpan(
            text:
                "I want to add a tapable icon right after a long text. I need to use Text widget since I'm using textDirection and maxLines params.",
            children: [
              WidgetSpan(
                child: Icon(
                  Icons.error_outline,
                  color: Colors.red,
                ),
              ),
            ]),
      ),

Answered By – Yeasin Sheikh

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published