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

Flutter – Row text overflow issue

using this code i am getting text overflow error.
How to resolve this?

Scaffold(
      backgroundColor: MyColor.bgLightColor,
      body: Column(
        children: [
          Padding(
            padding: const EdgeInsets.all(20.0),
            child:Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Expanded(
                child: Row(
                  children: [
                    Container(
                      height: 20,
                      width: 24,
                      decoration: const BoxDecoration(
                          image: DecorationImage(
                        image: AssetImage('assets/current_outlet_icon.png'),
                        fit: BoxFit.fill,
                      )),
                    ),
                    Text(
                      "Current Outlet",
                      style: textStyleWith12500(MyColor.darkGreyColor),
                    )
                  ],
                ),
              ),
              Expanded(
                child: Row(  
                  children: [
                    Image.asset(
                      "assets/location_pin.png",
                      height: 18,
                      width: 18,
                      color: MyColor.primaryRedColor,
                    ),
                    Text(
                      "WTC Tower, Los Angeless sbdjkds jsbksdb kcbk",  // here
                      style: textStyleWith12600(MyColor.blackColor),
                    ),
                  ],
                ),
              )
            ],
          )
        ],
      )),
    )

this is my text style and others textstyle is like this

TextStyle textStyleWith12500(Color color) {
  return TextStyle(
      fontWeight: FontWeight.w500,
      fontSize: MyFontSizes.t12Size,
      fontStyle: FontStyle.normal,
      color: color);

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 :

This can be solve in two ways. One is using overflow attribute and another is wrapping with widget.
Overflow attribute with ellipse type will solve it with dots are end which means there are more text.

Wrapping with Flexible :

                Flexible(
                  child: Text(
                      'WTC Tower, Los Angeless sbdjkds jsbksdb kcbk',
                  style: textStyleWith12600(MyColor.blackColor)
                    ),
                )

This will send long text to next line and will not get overflow issue. Hope it helps.

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