YToggleWidget function

Widget YToggleWidget({
  1. required bool isShowChildA,
  2. required Widget childA(),
  3. required Widget childB(),
  4. int duration = 300,
  5. AnimatedSwitcherTransitionBuilder? transitionBuilder,
})

Implementation

Widget YToggleWidget({
  required bool isShowChildA,
  required Widget Function() childA,
  required Widget Function() childB,
  int duration = 300,
  AnimatedSwitcherTransitionBuilder? transitionBuilder,
}) {
  return AnimatedSwitcher(
    transitionBuilder: transitionBuilder ?? AnimatedSwitcher.defaultTransitionBuilder,
    duration: Duration(milliseconds: duration),
    child: isShowChildA ? Container(child: childA()) : SizedBox(child: childB()),
  );
}