Skip to content

AnimatedSwitcher with conditional render problem #55717

Closed
@liudonghua123

Description

@liudonghua123

Steps to Reproduce

  1. write code using AnimatedSwitcher with conditional render like the following snippets
                        /// TabBarContent
                        AnimatedSwitcher(
                          duration: Duration(milliseconds: 400),
                          child: [
                            CourseDetailsIntroduce(
                                key: ValueKey<String>("details_introduce"),
                                course: course),
                            CourseDetailsComment(
                                key: ValueKey<String>("details_comment"))
                          ][_tabController.index],
                        ),
  1. The child content of the AnimatedSwitcher is different height, the first one is higher then the second one.
  2. When switch from tab1 to tab2, then you can see the content of tab2 is appear from bottom to top, not hold its original position.

Expected results:

The content of tab is no moving horizontally.

Actual results:
see the following gif.

animation

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: animationAnimation APIsa: qualityA truly polished experiencef: scrollingViewports, list views, slivers, etc.found in release: 1.18Occurs in 1.18frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions