我需要实现一种设计,使两行不同长度的两个文本具有相同的字母间距。
示例:
H E L L O
H EL L O W O R L D
你现在明白了。
到目前为止,我已经使用了Row
和Row
的MainAxisAlignment.spaceBetween
属性。但是,如何使用letterSpacing
和maxLines=1
实现它呢?
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: 'HELLO'
.characters
.map((e) => Text(e,
style: GoogleFonts.poppins(
fontSize: 30,
fontWeight: FontWeight.bold,
)))
.toList(),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: 'HELLO WORLD'
.characters
.map((e) => Text(e,
style: GoogleFonts.poppins(
fontSize: 30,
fontWeight: FontWeight.bold,
)))
.toList(),
),
试试这个
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
FittedBox(
fit: BoxFit.fitWidth,
child: Text('Hello',),
),
],
),