Reputation: 337
I want to make a container transparent like this:
Here's the container code:
: Container(child: Column(
children: [
Container(child: Text('Address: '), alignment: Alignment.centerLeft,),
Divider(color: Colors.grey,),
Container(child: Text('$address'), alignment: Alignment.centerLeft,),
],
),
color: Color(0xFF005D6C),
);
If I give color: Color(0xFF005D6C).withOpacity(0.5) then, it is just making the color light like this
How can I make the container transparent?
Upvotes: 1
Views: 7386
Reputation: 5736
Try using Colors.transparent
+ withOpacity
for Container
.
Container(
color: Colors.transparent.withOpacity(0.5),
child: Column(
children: [
Container(
child: Text('Address: '),
alignment: Alignment.centerLeft,
),
Divider(
color: Colors.grey,
),
Container(
child: Text('$address'),
alignment: Alignment.centerLeft,
),
],
),
Upvotes: 3
Reputation: 3084
try wrapping it inside the Opacity Widget
Opacity(
opacity: 0.5,
child: Container(child: Column(
children: [
Container(child: Text('Address: '), alignment: Alignment.centerLeft,),
Divider(color: Colors.grey,),
Container(child: Text('$address'), alignment: Alignment.centerLeft,),
],
),
color: Color(0xFF005D),
),
)
Upvotes: 4