0

I have the following issue enter image description here

I'm trying to get the text to wrap under the dog type, I tried to wrap the text, flexible but it's not working it's in a row not sure why it's not working here is my code

Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Row(
                children: [
                  const Padding(
                    padding: EdgeInsets.only(right: 8.0, bottom: 4.0),
                    child: FaIcon(
                      FontAwesomeIcons.cubes,
                      size: 24,
                      color: primaryColor,
                    ),
                  ),
                  const Text(
                    'Dog Type: ',
                    style: AppStyles.dogProfileBodyLabelStyle,
                    overflow: TextOverflow.ellipsis,
                  ),
                  Text(
                    dogInfo.dogType!.join(", "),
                    style: AppStyles.dogProfileBodyTextStyle,
                    maxLines: 5,
                    softWrap: true,
                    overflow: TextOverflow.ellipsis,
                  ),
                ],
              ),
              
            ],
          ),

To be clear I want it to wrap under the Dog Type, not like the following enter image description here

3 Answers 3

1

Try below code hope its help to you.Try to add your Inside Row widgets wrap it with Expanded or Flexible refer my answer here or here or here hope its helpful to you

Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Row(
          children: [
            Padding(
              padding: EdgeInsets.only(right: 8.0, bottom: 4.0),
              child: Icon(
                Icons.add,
                size: 24,
              ),
            ),
            Text(
            'Dog Type: ',
            overflow: TextOverflow.ellipsis,
          ),
            Expanded(
              child: Text(
                'dogInfo.dogType!.join(", ")dogInfo.dogType!.join(", ")',
                maxLines: 5,
                softWrap: true,
                overflow: TextOverflow.ellipsis,
              ),
            ),
          ],
        ),
      ],
    ),

Result screen->enter image description here

Sign up to request clarification or add additional context in comments.

6 Comments

So not what I want I want it to wrap under the Dog Type
@AlmogKoren what do you exact want
It needs to wrap under Dog Type,
you want to display description below of the dog type?
@RavindraS.Patil I already mentioned the same thing.
|
0

Wrap

Text(
  dogInfo.dogType!.join(", "),
  ...
)

in an Expanded or Flexible widget:

Expanded(
  child: Text(
    dogInfo.dogType!.join(", "),
    ...
  ),
)

1 Comment

that does not work, you get this imgur.com/a/WoYhCZK
0
Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            children: [
              const Padding(
                padding: EdgeInsets.only(right: 8.0, bottom: 4.0),
                child: FaIcon(
                  FontAwesomeIcons.cubes,
                  size: 24,
                  color: primaryColor,
                ),
              ),
              const Text(
                'Dog Type: ',
                style: AppStyles.dogProfileBodyLabelStyle,
                overflow: TextOverflow.ellipsis,
              ),
              Expanded(           //Wrap Text Widget with Expanded Widget
                child: Text(
                       dogInfo.dogType!.join(", "),
                       style: AppStyles.dogProfileBodyTextStyle,
                       maxLines: 5,
                       softWrap: true,
                       overflow: TextOverflow.ellipsis,
                    ),
              ),
            ],
          ),
          
        ],
      ),

or Use RichText Widget..

RichText(
                    text: TextSpan(
                        style: Theme.of(context).textTheme.bodyText1,
                        children: [
                          const TextSpan(text: 'Dog Type: '),
                          TextSpan(
                            text: dogInfo.dogType!.join(", "),
                            style:
                                const TextStyle(color: Color(0xFF003764)),
                          )
                        ]),
                  ),

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.