颤动:文本:将新行与上一行对齐(缩进)

Flutter: Text: Align new line with previous line (indentation)

基本上我的文字是这样的:

本文使用以下代码制作:

child: Text(
            "1)    Persons with burns, skin infections\n2)    Primary or secondary immunodeficiencies (HIV)\n3)    Previous tuberculosis infection\n4)    Untreated active tuberculosis\n5)    History of close contact with tuberculosis patient\n6)    Immunosupressed individuals (i.e. HIV infected, leukemia, lymphoma, malignancy)\n7)    People receiving immunosuppressive medications (including high-dose steroids\n8)    Pregnancy",
          ),

我希望 6) 和 7) 中的第二行与文本的开头对齐,而不是与数字对齐。有什么办法可以做到这一点吗?

我不想添加额外的空格,因为它可能会随着不同的移动屏幕而改变。还有其他情况涉及超过 2 行。感谢您的回答!

我假设你已经创建了这样的东西:

return new ListView(
  shrinkWrap: true,
  children: <Widget>[
   const Text('1) I\'m dedicating every day to you'),
   const Text('2) Domestic life was never quite my style'),
   const Text('3) When you smile, you knock me out, I fall apart'),
   const Text('4) And I thought I was so smart')
  ]
);

您可以使用 Row Widget 来达到您想要的结果:

return new ListView(shrinkWrap: true, children: <Widget>[
  new Row(children: <Widget>[
    Text('1) '),
    Expanded(child: Text('I\'m dedicating every day to you'))
  ], crossAxisAlignment: CrossAxisAlignment.start),
  new Row(children: <Widget>[
    Text('2) '),
    Expanded(child: Text('Domestic life was never quite my style'))
  ], crossAxisAlignment: CrossAxisAlignment.start),
  new Row(children: <Widget>[
    Text('3) '),
    Expanded(child: Text('When you smile, you knock me out, I fall apart blablabla'))
  ], crossAxisAlignment: CrossAxisAlignment.start),
  new Row(children: <Widget>[
    Text('4) '),
    Expanded(child: Text('And I thought I was so smart')),
  ], crossAxisAlignment: CrossAxisAlignment.start)
]);

当然有点难看,但我希望它能给你指明正确的方向。