Skip to content

Make sure Scrollable.ensureVisible works with children before the center #7919

Closed

Description

@abarth

See "ListView ensureVisible negative child" in ensure_visible_test.dart.

Activity

  1. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Feb 7, 2017
  2. self-assigned this
    on Feb 7, 2017
  3. removed their assignment
    on Feb 22, 2017
  4. added this to the milestone on Feb 22, 2017
  5. modified the milestones: , on Feb 28, 2017
  6. changed the title [-]Make sure Scrollable2.ensureVisible works with children before the center[/-] [+]Make sure Scrollable.ensureVisible works with children before the center[/+] on Jul 24, 2018
  7. added
    P2Important issues not at the top of the work list
    on May 29, 2020
  8. removed this from the milestone on Jun 2, 2020
  9. removed this from the milestone on Jun 2, 2020
  10. removed this from the milestone on Aug 17, 2020
  11. pedromassangocode commented on Aug 27, 2020

    @pedromassangocode

    This still reproducible on latest master channel since the test case is still being skipped and the TODO is still there.

    // TODO(abarth): Unskip this test. See https://github.com/flutter/flutter/issues/7919
    testWidgets('ListView ensureVisible negative child', (WidgetTester tester) async {
    BuildContext findContext(int i) => tester.element(findKey(i));
    Future<void> prepare(double offset) async {
    tester.state<ScrollableState>(find.byType(Scrollable)).position.jumpTo(offset);
    await tester.pump();
    }
    double getOffset() {
    return tester.state<ScrollableState>(find.byType(Scrollable)).position.pixels;
    }
    Widget buildSliver(int i) {
    return SliverToBoxAdapter(
    key: ValueKey<int>(i),
    child: const SizedBox(width: 200.0, height: 200.0),
    );
    }
    await tester.pumpWidget(
    Directionality(
    textDirection: TextDirection.ltr,
    child: Center(
    child: SizedBox(
    width: 600.0,
    height: 400.0,
    child: Scrollable(
    viewportBuilder: (BuildContext context, ViewportOffset offset) {
    return Viewport(
    offset: offset,
    center: const ValueKey<int>(4),
    slivers: <Widget>[
    buildSliver(0),
    buildSliver(1),
    buildSliver(2),
    buildSliver(3),
    buildSliver(4),
    buildSliver(5),
    buildSliver(6),
    ],
    );
    },
    ),
    ),
    ),
    ),
    );
    await prepare(-125.0);
    Scrollable.ensureVisible(findContext(3));
    await tester.pump();
    expect(getOffset(), equals(-200.0));
    await prepare(-225.0);
    Scrollable.ensureVisible(findContext(2));
    await tester.pump();
    expect(getOffset(), equals(-400.0));
    }, skip: true); // https://github.com/flutter/flutter/issues/7919

  12. self-assigned this
    on Jan 8, 2021
  13. github-actions commented on Aug 7, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  14. locked as resolved and limited conversation to collaborators on Aug 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: tests"flutter test", flutter_test, or one of our testsf: scrollingViewports, list views, slivers, etc.found in release: 1.22Found to occur in 1.22frameworkflutter/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