Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to wrap text and image on flutter?

I want make this

Wrap(
   textDirection: TextDirection.rtl,
       children: [
          Text(
            _items[1]['text'],
            softWrap: true,
            textAlign: TextAlign.justify,
            textDirection: TextDirection.rtl,
            style: GoogleFonts.notoNaskhArabic(
                fontWeight: FontWeight.w900,
                fontSize: 25,
                backgroundColor: Colors.red),
          ),
          Text(
            _items[1]['text'],
            softWrap: true,
            textAlign: TextAlign.justify,
            textDirection: TextDirection.rtl,
            style: GoogleFonts.notoNaskhArabic(
                fontWeight: FontWeight.w900,
                fontSize: 25,
                backgroundColor: Colors.red
            ),
          ),
      ],
)

I wanted to wrap Text and image like photo, but the code turns out to be like this
This wrong

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Use RichText with WidgetSpan for non text.

 RichText(
  text: TextSpan(
    children: [
      TextSpan(text: "A"),
      WidgetSpan(
        alignment: PlaceholderAlignment.middle,
        child: Icon(Icons.av_timer),
      ),
      TextSpan(text: "B"),
    ],
  ),
  ),

More about RichText

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading