Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I float Text Widget around an Image Widget in Flutter

Tags:

flutter

dart

enter image description here

How can I achieve the effect in flutter? Is there an example?

like image 395
long Avatar asked Apr 01 '19 10:04

long


2 Answers

You could use drop_cap_text library to get this behavior. Usage is something like this:

DropCapText(
    loremIpsumText,
    dropCap: DropCap(
    width: 100,
    height: 100,
    child: Image.network(
        'https://www.codemate.com/wp-content/uploads/2017/09/flutter-logo.png')
    ),
),

this

Or you could try it yourself by mixing and matching SizedBox with RichText as they did in the library.

like image 107
Shababb Karim Avatar answered Nov 10 '22 18:11

Shababb Karim


Very simple and you do not need to use the library.

 // Replace IconSVG with image of you.
 RichText(
          text: TextSpan(
          children: [
                      WidgetSpan(
                        child: IconSVG(
                             IconSVGPath.ic_suggest, 30, 30, null),
                          ),
                      TextSpan(text: " Tùy chọn các nội dung dưới đây để thay đổi giao diện CV phù hợp với bản thân bạn.",
                                  style: TextStyle(color: HexColor(
                                      StringColors.color_orange_primary),
                                      fontSize: 16,
                                      fontWeight: FontWeight.w400,
                                      fontFamily: NUNITO_SANS),
                                ),
            ],
            style: TextStyle(color: Colors.red,)
      ),

The result will look like this: flutter)

like image 25
Doan Bui Avatar answered Nov 10 '22 18:11

Doan Bui