我正在使用 Stepper
小部件,并且正在使用 Text
小部件作为标题参数。
我用于文本的字符串很长,我希望它能将文本换行成多行。我该怎么做?
这是我用来构建它的代码:
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Stepper(
currentStep: currentStepIndex,
onStepContinue: () => setState(() => currentStepIndex++),
onStepTapped: (int index) => setState(() => currentStepIndex = index),
steps: questions
.map((String q) => Step(
title: Text(q),
content: QuestionWidget(),
))
.toList(),
),
);
最佳答案
使用flexible如果你只想制作多行:
Flexible (child: Text('Some text here'))
关于dart - 如何使文本小部件将长文本包装成多行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50450891/