https://api.flutter.dev/flutter/widgets/Opacity-class.html
Opacity class - widgets library - Dart API
A widget that makes its child partially transparent. This class paints its child into an intermediate buffer and then blends the child back into the scene partially transparent. For values of opacity other than 0.0 and 1.0, this class is relatively expensi
api.flutter.dev
Opacity 클래스는 child를 중간 버퍼로 그린 다음 child를 부분적으로 투명하게 씬(scene)에 다시 혼합합니다.
0.0 및 1.0이 아닌 불투명도 값의 경우 이 클래스는 자식을 중간 버퍼로 그려야 하므로 상대적으로 리소스 비용이 큽니다.
0.0 값에서 child는 투명도 적용이 되어 있지 않습니다.
1.0 값은 중간 버퍼 없이 child가 즉시 칠해집니다.
적용 예
Opacity(
opacity: _visible ? 1.0 : 0.0,
child: const Text("Now you see me, now you don't!"),
)
* Opacity 위젯을 애니메이션화하면 위젯(하위 트리)이 각 프레임을 재구성하게 되는데, 이는 그리 효율적이지 않습니다. 대신 AnimatedOpacity 또는 FadeTransition을 사용하는 것을 고려하십시오.
Image.network(
'https://raw.githubusercontent.com/flutter/assets-for-api-docs/master/packages/diagrams/assets/blend_mode_destination.jpeg',
color: const Color.fromRGBO(255, 255, 255, 0.5),
colorBlendMode: BlendMode.modulate
)
불투명도가 있는 이미지 또는 색상을 직접 그리는 것은 불투명도를 위젯 그룹에 적용할 수 있으므로 값 비싼 오프스크린 버퍼가 사용되기 때문에 불투명도를 사용하는 것보다 빠릅니다. 오프스크린 버퍼에 콘텐츠를 그리면 렌더링 대상 스위치가 트리거 될 수 있으며 이러한 전환은 구형 GPU에서 특히 느립니다.
댓글