Flutter - Text inside an Expanded Widget within a Column overflowing

前端 未结 2 1944
轮回少年
轮回少年 2021-01-12 12:18

What I want to achieve is to have a text widget inside a Column of fixed height. When the text is long I want the overflow property which is set to TextOv

相关标签:
2条回答
  • 2021-01-12 12:51

    Try wrapping your column with 'Flexible' instead of expandable.

    I had the same issue with text overflowing in column and wrapping column itself with 'flexible' allowed to make text smaller.

             Flexible(
              child: Padding(
                padding: const EdgeInsets.only(left: 8.0),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    Padding(
                      padding: const EdgeInsets.only(bottom: 8.0),
                      child: Text(
                        'Name',
                        style: CustomTextStyle.blueTitle14(context),
                      ),
                    ),
                    Padding(
                      padding: const EdgeInsets.only(bottom: 4.0),
                      child: Text('Long text'),
                    ),
                  ],
                ),
              ),
            ),
    
    0 讨论(0)
  • 2021-01-12 12:52

    Based on my experiences, you should assign a fixed width to the Container containing the overflowing text, as per this post. Flutter- wrapping text .

    0 讨论(0)
提交回复
热议问题