Flutter Visibility(Visible) hide / show
Flutter 에서 안드로이드의 isVisible, setVisibility()과 같은 역할을 하기 위해서는, Visible Widget으로 해당 Widget을 child로 두면 됩니다.
https://api.flutter.dev/flutter/widgets/Visibility-class.html
Visibility class - widgets library - Dart API
Whether to show or hide a child. By default, the visible property controls whether the child is included in the subtree or not; when it is not visible, the replacement child (typically a zero-sized box) is included instead. A variety of flags can be used t
api.flutter.dev
기본형은 다음과 같습니다.
Visibility(
child: Text("Invisible"),
maintainSize: true,
maintainAnimation: true,
maintainState: true,
visible: false,
),
결과적으로 visible에 true냐 false냐에 따라서 보이나 사라지냐가 결정됩니다.
안드로이드로 하면 Visible, Gone 이라 보시면 됩니다.
그렇다면 inVisible은 어떻게 하냐. Opacity를 사용하면 됩니다.
Opacity는 투명도 조절로 해당 위치에 공간은 그대로 차지하게 됩니다.
Opacity에 대한 글은 하기 글을 참고하길 바랍니다.
2022.01.04 - [분류 전체보기] - Flutter Opacity ( 불투명/투명 )
Flutter Opacity ( 불투명/투명 )
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 interme..
byounghonglim.tistory.com