这是容器代码:
let dayChangePublisher = NotificationCenter.default
.publisher(for: UIApplication.significantTimeChangeNotification)
$entities.combineLatest(
dayChangePublisher
.map { _ in }
.prepend(()) // make sure to prepend a () value
)
.map(\.0) // Only pass on the entity for further operations
.map { entities -> MyEntity? in
let today = todaysDate()
return entities?.first(where: { $0.id == today })
}
//...
如果我给 color: Color(0xFF005D6C).withOpacity(0.5) 那么,它只是使颜色像这样
如何使容器透明?
答案 0 :(得分:1)
尝试对 Colors.transparent
使用 withOpacity
+ 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,
),
],
),
答案 1 :(得分:0)
尝试将其包裹在 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),
),
)