Reputation: 1514
I am trying to make shadow to my text but some weird thing happended like below image;
Regular text short then positioned one, how can I correct that?
My code:
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),
],
),
],
),
),
Upvotes: 0
Views: 41
Reputation: 181
You dont need to use Positioned, instead you can use de TextStyle like this:
Text("YourText",style: TextStyle(color: Colors.white,shadows: [
Shadow(color:Colors.black,blurRadius: 0,offset: Offset(0,2)),
])),
Upvotes: 2