Under which circumstances textAlign property works in Flutter?

前端 未结 8 1806
花落未央
花落未央 2020-12-07 18:19

In the code below, textAlign property doesn\'t work. If you remove DefaultTextStyle wrapper which is several levels above, textAlign s

8条回答
  •  感情败类
    2020-12-07 18:54

    For maximum flexibility, I usually prefer working with SizedBox like this:

    Row(
                                    children: [
                                      SizedBox(
                                          width: 235,
                                          child: Text('Hey, ')),
                                      SizedBox(
                                          width: 110,
                                          child: Text('how are'),
                                      SizedBox(
                                          width: 10,
                                          child: Text('you?'))
                                    ],
                                  )
    

    I've experienced problems with text alignment when using alignment in the past, whereas sizedbox always does the work.

提交回复
热议问题