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

A part of horizontal list view is not on a base line

A part of a horizontal scroll list is not on a base line, here is Icefields, Alberta is aligned to the top of sized box. How to fix it? The whole list view should be on the same horizontal level.

enter image description here

SizedBox(
width: double.maxFinite,
height: 50,
    child: ListView(
      scrollDirection: Axis.horizontal,
      children: [
        const Icon(...),
        const SizedBox(...),
        AppText(
          text: detail.place.location,
          color: AppColors.textColor1,
        ),
        const SizedBox(...),
        Row(
          children: [
            Wrap(
              children: List.generate(5, (index) {
                return Icon(...);
              }),
            ),
            const SizedBox(...),
            AppText(
              text:
                  detail.place.stars.toString() + '.0',
              color: AppColors.textColor2,
            ),
          ],
        ),
      ],
    ),
),

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 :

Another solution is to put the location AppText within the Row:

Row(
    children: [
      AppText(
        text: detail.place.location,
        color: AppColors.textColor1,
      ),
      Wrap(
        children: List.generate(5, (index) {
          return Icon(...);
        }),
      ),
      const SizedBox(...),
      AppText(
        text:
            detail.place.stars.toString() + '.0',
        color: AppColors.textColor2,
      ),
    ],
)

This way all widgets in the Row are aligned the same.

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