【发布时间】:2023-04-01 08:18:02
【问题描述】:
我正在尝试给我的文字添加阴影,但发生了一些奇怪的事情,如下图所示;
常规文本短然后定位一个,我该如何纠正?
我的代码:
Container(
padding: EdgeInsets.only(left:10.0, bottom: 4),
width: 175,
alignment: Alignment.bottomLeft,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Stack(
children: <Widget>[
Positioned(
left: 1.0,
top: 2.0,
child: Text("${snapshot.data.results[index].title}",style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16, color: Colors.black),maxLines: 1, textAlign: TextAlign.left,),),
Text("${snapshot.data.results[index].title}", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16, color: Colors.white),maxLines: 1, textAlign: TextAlign.left,), ],),
Stack(
children: <Widget>[
Positioned(
left: 1.0,
top: 2.0,
child: Text("(${snapshot.data.results[index].releaseDate.toString().substring(0,4)})",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14, color: Colors.black),maxLines: 1, textAlign: TextAlign.left),),
Text("(${snapshot.data.results[index].releaseDate.toString().substring(0,4)})", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14, color: Colors.white),maxLines: 1, textAlign: TextAlign.left),
],
),
],
),
),
【问题讨论】:
标签: flutter text flutter-layout