skip to Main Content

I have Column which consists of 2 Text widget in it and I tried to apply TextOverflow.ellipsis to the widgets when the string is too long. However, the overflow doesnt seems working as I stil get the "RenderFlex Overflow" error. Can anyone tell me how to solve this? The below is my sample code:

Row(children: [
                Padding(
                    padding: const EdgeInsets.symmetric(horizontal: 10),
                    child: Expanded(
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                        children: [
                          Text(data.picodedesc,
                              overflow: TextOverflow.ellipsis,
                              softWrap: false,
                              maxLines: 1,
                              style: const TextStyle(fontSize: 12)),
                          Text(data.description,
                              overflow: TextOverflow.ellipsis,
                              maxLines: 1,
                              softWrap: false,
                              style: const TextStyle(
                                  fontSize: 12,
                                  overflow: TextOverflow.ellipsis))
                        ],
                      ),
                    )),
              ]

2

Answers


  1. try below code

    Row(children: [
              Expanded(
                child: Padding(
                    padding: const EdgeInsets.symmetric(horizontal: 10),
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                      children: [
                        Text(data.picodedesc,
                            overflow: TextOverflow.ellipsis,
                            softWrap: false,
                            maxLines: 1,
                            style: const TextStyle(fontSize: 12)),
                        Text(data.description,
                            overflow: TextOverflow.ellipsis,
                            maxLines: 1,
                            softWrap: false,
                            style: const TextStyle(
                                fontSize: 12,
                                overflow: TextOverflow.ellipsis))
                      ],
                    )),
              ),
            ]
    )
    
    Login or Signup to reply.
  2. Try to wrap with Expanded() with your Row() widget, Otherwise You can set the fix width for your Row() widget with Container() or SizedBox().

    It’s look like below code :

            Expanded(
              child: Row(
                children: [
                  Expanded(
                    child: Padding(
                      padding: const EdgeInsets.symmetric(horizontal: 10),
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                        children: [
                          Text(
                            data.picodedesc,
                            overflow: TextOverflow.ellipsis,
                            softWrap: false,
                            maxLines: 1,
                            style: const TextStyle(fontSize: 12),
                          ),
                          Text(
                            data.description,
                            overflow: TextOverflow.ellipsis,
                            maxLines: 1,
                            softWrap: false,
                            style: const TextStyle(fontSize: 12),
                          ),
                        ],
                      ),
                    ),
                  ),
                ],
              ),
            ),
    

    Hope this solution might be work for you.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search