body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.only(top: 20, left: 15, right: 15),
child: Padding(
padding: const EdgeInsets.only(top: 10),
child: ClipRRect(
borderRadius: BorderRadius.circular(15),
child: Container(
height: 500,
color: const Color.fromARGB(255, 35, 35, 35),
child: Padding(
padding: const EdgeInsets.only(top: 20),
child: Column(children: const [
Text(
'Student Space',
style: TextStyle(
color: Colors.white,
fontSize: 30,
fontWeight: FontWeight.bold,
),
),
SizedBox(
height: 20,
),
Text('This is a very very very long text that should be centered just like the first text in this column. I don't want to cut it for each row.',
style: TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.w400,
),
),
]),
),
),
),
),
),
),
我希望文本看起来就像你在Word中居中文本一样。我不知道如何做到这一点,而不将文本分成单独的一行。
使用"n"
切换到下一行,使用textAlign
作为TextAlign.center
来居中
Text('Something went wrong nPlease try again',textAlign: TextAlign.center,);