Getting shifted to newline when using TextSpan with WidgetSpan in flutter

262 views Asked by At

I am using TextSpan but to use rounded corner in background of text I'm using WidgetSpan and decoration, but WidgetSpan with TextSpan are getting separated by newline. It is doing ohk on first line, but it gets separated after newline.

On the first line

After the first line

                            child: Text.rich(
                              TextSpan(
                                style: TextStyle(
                                    fontSize: 25,
                                    color: Colors.deepPurpleAccent,
                                    height: 1.5),
                                //text: 'typing text here ...',
                                children: [
                                  WidgetSpan(
                                      child: Container(
                                    child: Text(
                                      typed,
                                      style: TextStyle(
                                        fontSize: 25,
                                        height: 1.5,
                                        color: Colors.white,
                                      ),
                                    ),
                                    decoration: BoxDecoration(
                                        borderRadius: BorderRadius.all(
                                            Radius.circular(10)),
                                        color: Colors.lightBlue),
                                  )),
                                  TextSpan(text: toBeTyped),
                                ],
                              ),
                            ),

Can someone help me solve this issue? My main goal is to make rounded corner but this is the only way I can find and getting this newline issue.

0

There are 0 answers