Repository: flutter
Issue: ListView use ScrollController jumpTo abnormal position after changing item height
Labels: framework,f: scrolling,has reproducible steps,P2,found in release: 3.3,found in release: 3.5,team-framework,triaged-framework

ListView use ScrollController jumpTo abnormal position

`scrollController.jumpTo(0)`

`scrollController. animateTo(0,duration: Duration(seconds: 1),curve: Curves. linear);` The position of 'jumpTo' or 'animateTo' is wrong after adjusting the height of the item

## Steps to Reproduce

<!-- Please include full steps to reproduce so that we can reproduce the problem. -->

1. Execute `flutter run` on the code sample <!-- (see "Code sample" section below) -->
2. Scroll down a certain distance
3. Adjust the size of the flutter app window to make it wider
4.  click floatingActionButton `jumpTo(0)`

**Expected results:** to zero

**Actual results:** To the middle, not to the bottom

<details>
<summary>Code sample</summary>

<!--
      Please create a minimal reproducible sample that shows the problem
      and attach it below between the lines with the backticks.

      To create it you can use `flutter create bug` command and update the `main.dart` file.

      Alternatively, you can use https://dartpad.dev/
      which is capable of creating and running small Flutter apps.

      Without this we will unlikely be able to progress on the issue, and because of that
      we regretfully will have to close it.
-->

```dart

import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final scrollController = ScrollController();

  void _incrementCounter() {
    scrollController.animateTo(0, duration: Duration(seconds: 1), curve: Curves.linear).then((value) => print(["🎯🎯", scrollController.offset]));
    print(["🎯", scrollController.offset]);
  }

  @override
  void initState() {
    super.initState();
    scrollController.addListener(() {
      print(["log", scrollController.offset]);
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Scrollbar(
        child: ListView.builder(
          controller: scrollController,
          itemBuilder: (context, index) {
            return AspectRatio(
              aspectRatio: 1,
              child: Container(
                color: Colors.primaries[index % Colors.primaries.length],
                child: Center(child: Text(index.toString())),
              ),
            );
          },
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}


```

</details>

<details>
  <summary>Logs</summary>

<!--
      Run your application with `flutter run --verbose` and attach all the
      log output below between the lines with the backticks. If there is an
      exception, please see if the error message includes enough information
      to explain how to solve the issue. If there is a crash, please include
      the entirety of the crash log including the backtrace.
-->

```
Restarted application in 391ms.
flutter: [log, 80.0]
flutter: [log, 160.0]
flutter: [log, 240.0]
flutter: [log, 320.0]
flutter: [log, 400.0]
flutter: [log, 480.0]
flutter: [log, 560.0]
flutter: [log, 640.0]
flutter: [log, 720.0]
flutter: [log, 800.0]
flutter: [log, 880.0]
flutter: [log, 1040.0]
flutter: [log, 1120.0]
flutter: [log, 1200.0]
flutter: Another exception was thrown: The Scrollbar's ScrollController has no ScrollPosition attached.
flutter: [log, 1280.0]
flutter: [log, 1360.0]
flutter: [log, 1440.0]
flutter: [log, 1520.0]
flutter: [log, 1600.0]
flutter: [log, 1680.0]
flutter: [log, 1760.0]
flutter: [log, 1840.0]
flutter: [log, 1920.0]
flutter: [log, 2000.0]
flutter: [log, 2080.0]
flutter: [log, 2160.0]
flutter: [log, 2240.0]
flutter: [log, 2320.0]
flutter: [log, 2400.0]
flutter: [log, 2480.0]
flutter: [log, 2560.0]
flutter: [log, 2640.0]
flutter: [log, 2720.0]
flutter: [log, 2800.0]
flutter: [log, 2880.0]
flutter: [log, 2960.0]
flutter: [log, 3040.0]
flutter: [log, 3120.0]
flutter: [log, 3280.0]
flutter: [log, 3360.0]
flutter: [log, 3440.0]
flutter: [log, 3520.0]
flutter: [log, 3600.0]
flutter: [log, 3680.0]
flutter: [log, 3760.0]
flutter: [log, 3840.0]
flutter: [log, 3920.0]
flutter: [log, 4000.0]
flutter: [log, 4080.0]
flutter: [log, 4160.0]
flutter: [log, 4240.0]
flutter: [log, 4400.0]
flutter: [log, 4480.0]
flutter: [log, 4640.0]
flutter: [log, 4720.0]
flutter: [log, 4800.0]
flutter: [log, 4880.0]
flutter: [log, 4960.0]
flutter: [log, 5040.0]
flutter: [log, 5200.0]
flutter: [log, 5280.0]
flutter: [log, 5360.0]
flutter: [log, 5520.0]
flutter: [log, 5600.0]
flutter: [log, 5680.0]
flutter: [log, 5760.0]
flutter: [log, 5840.0]
flutter: [log, 5920.0]
flutter: [log, 6000.0]
flutter: [log, 6080.0]
flutter: [log, 6160.0]
flutter: [log, 6240.0]
flutter: [log, 6320.0]
flutter: [log, 6400.0]
flutter: [log, 6480.0]
flutter: [log, 6560.0]
flutter: [log, 6640.0]
flutter: [log, 6720.0]
flutter: [log, 6800.0]
flutter: [log, 6880.0]
flutter: [log, 6960.0]
flutter: [log, 7040.0]
flutter: [log, 7120.0]
flutter: [log, 7200.0]
flutter: [log, 7280.0]
flutter: [log, 7360.0]
flutter: [log, 7440.0]
flutter: [log, 7520.0]
flutter: [log, 7600.0]
flutter: [log, 7680.0]
flutter: [log, 7760.0]
flutter: [log, 7840.0]
flutter: [log, 7920.0]
flutter: [log, 8000.0]
flutter: [log, 8080.0]
flutter: [log, 8160.0]
flutter: [log, 8240.0]
flutter: [log, 8320.0]
flutter: [log, 8400.0]
flutter: [log, 8480.0]
flutter: [log, 8560.0]
flutter: [log, 8640.0]
flutter: [log, 8720.0]
flutter: [log, 8800.0]
flutter: [log, 8880.0]
flutter: [log, 8960.0]
flutter: [log, 9040.0]
flutter: [log, 9120.0]
flutter: [log, 9200.0]
flutter: [log, 9280.0]
flutter: Another exception was thrown: The Scrollbar's ScrollController has no ScrollPosition attached.
flutter: [🎯, 9280.0]
flutter: [log, 9125.3488]
flutter: Another exception was thrown: The Scrollbar's ScrollController has no ScrollPosition attached.
flutter: [log, 8888.50464]
flutter: [log, 8725.4272]
flutter: [log, 8526.26912]
flutter: [log, 8404.65472]
flutter: [log, 8333.55136]
flutter: [log, 8178.8816]
flutter: [log, 8042.73472]
flutter: [log, 7919.71904]
flutter: [log, 7717.396479999999]
flutter: [log, 7633.1712]
flutter: [log, 7436.63936]
flutter: [log, 7292.10336]
flutter: [log, 7092.12864]
flutter: [log, 6965.5772799999995]
flutter: [log, 6814.22048]
flutter: [log, 6650.80896]
flutter: [log, 6550.45504]
flutter: [log, 6428.228160000001]
flutter: Another exception was thrown: The Scrollbar's ScrollController has no ScrollPosition attached.
flutter: [log, 6183.09696]
flutter: [log, 5977.377920000001]
flutter: [log, 5858.91872]
flutter: [log, 5704.258239999999]
flutter: [log, 5545.55168]
flutter: [log, 5422.174080000001]
flutter: [log, 5303.97472]
flutter: [log, 5135.60768]
flutter: [log, 5020.48928]
flutter: [log, 4817.55424]
flutter: [log, 4640.24128]
flutter: [log, 4534.467839999999]
flutter: [log, 4339.47648]
flutter: [log, 4176.26912]
flutter: [log, 4030.1276800000005]
flutter: [log, 3821.6895999999997]
flutter: [log, 3639.54176]
flutter: [log, 3503.35776]
flutter: [log, 3384.29536]
flutter: [log, 3229.6256000000003]
flutter: [log, 3025.79968]
flutter: [log, 2867.7055999999993]
flutter: [log, 2792.7603200000003]
flutter: [log, 2638.0812799999994]
flutter: [log, 2486.7244800000008]
flutter: [log, 2342.9958399999996]
flutter: [log, 2165.71072]
flutter: [log, 1956.5580799999998]
flutter: [log, 1856.389760000001]
flutter: [log, 1701.7292799999996]
flutter: [log, 1619.1187200000004]
flutter: [log, 1501.8380799999995]
flutter: [log, 1347.1868800000002]
flutter: [log, 1136.8835199999994]
flutter: [log, 1029.1612800000003]
flutter: [log, 874.5193600000002]
flutter: [log, 728.5542399999995]
flutter: [log, 573.9030399999992]
flutter: [log, 369.3254400000005]
flutter: [log, 295.27103999999963]
flutter: [log, 140.60128000000077]
flutter: [log, 0.0]
flutter: [🎯🎯, 0.0]
flutter: Another exception was thrown: The Scrollbar's ScrollController has no ScrollPosition attached.
flutter: [log, 80.0]
flutter: Another exception was thrown: The Scrollbar's ScrollController has no ScrollPosition attached.
flutter: [log, 160.0]
flutter: [log, 240.0]
flutter: [log, 320.0]
flutter: [log, 400.0]
flutter: [log, 480.0]
flutter: [log, 560.0]
flutter: [log, 640.0]
flutter: [log, 560.0]
flutter: [log, 480.0]
flutter: [log, 400.0]
flutter: [log, 320.0]
flutter: [log, 240.0]
flutter: Another exception was thrown: The Scrollbar's ScrollController has no ScrollPosition attached.
flutter: [log, 160.0]
flutter: [log, 80.0]
flutter: [log, 0.0]
flutter: [log, 80.0]
flutter: [log, 160.0]
flutter: [log, 240.0]
flutter: [log, 320.0]
flutter: [log, 400.0]
flutter: [log, 480.0]
flutter: [log, 560.0]
flutter: [log, 640.0]
flutter: [log, 720.0]
flutter: [log, 800.0]
flutter: [log, 880.0]
flutter: [log, 960.0]
flutter: [log, 1040.0]
flutter: [log, 1120.0]
flutter: [log, 1200.0]
flutter: [log, 1360.0]
flutter: [log, 1440.0]
flutter: [log, 1520.0]
flutter: [log, 1600.0]
flutter: [log, 1680.0]
flutter: [log, 1760.0]
flutter: [log, 1840.0]
flutter: [log, 1920.0]
flutter: [log, 2000.0]
flutter: [log, 2080.0]
flutter: [log, 2160.0]
flutter: [log, 2240.0]
flutter: [log, 2320.0]
flutter: [log, 2400.0]
flutter: [log, 2480.0]
flutter: [log, 2560.0]
flutter: [log, 2640.0]
flutter: [log, 2720.0]
flutter: [log, 2800.0]
flutter: [log, 2880.0]
flutter: [log, 2960.0]
flutter: [log, 3040.0]
flutter: [log, 3120.0]
flutter: [log, 3200.0]
flutter: [log, 3280.0]
flutter: [log, 3360.0]
flutter: [log, 3440.0]
flutter: [log, 3520.0]
flutter: [log, 3600.0]
flutter: [log, 3680.0]
flutter: [log, 3760.0]
flutter: [log, 3840.0]
flutter: [log, 3920.0]
flutter: [log, 4000.0]
flutter: [log, 4080.0]
flutter: [log, 4160.0]
flutter: [log, 4240.0]
flutter: [log, 4320.0]
flutter: [log, 4400.0]
flutter: [log, 4480.0]
flutter: [log, 4560.0]
flutter: [log, 4640.0]
flutter: [log, 4720.0]
flutter: [log, 4800.0]
flutter: [log, 4880.0]
flutter: [log, 4960.0]
flutter: [log, 5040.0]
flutter: [log, 5120.0]
flutter: [log, 5200.0]
flutter: [log, 5280.0]
flutter: [log, 5360.0]
flutter: [log, 5440.0]
flutter: [log, 5520.0]
flutter: [log, 5600.0]
flutter: [log, 5680.0]
flutter: [log, 5760.0]
flutter: [log, 5840.0]
flutter: [log, 5920.0]
flutter: [log, 6000.0]
flutter: [log, 6080.0]
flutter: [log, 6160.0]
flutter: [log, 6240.0]
flutter: [log, 6320.0]
flutter: [log, 6400.0]
flutter: [log, 6480.0]
flutter: [log, 6560.0]
flutter: [log, 6640.0]
flutter: [log, 6720.0]
flutter: [log, 6800.0]
flutter: [log, 6880.0]
flutter: [log, 6960.0]
flutter: [log, 7040.0]
flutter: [log, 7120.0]
flutter: [log, 7200.0]
flutter: [log, 7280.0]
flutter: [log, 7360.0]
flutter: [log, 7440.0]
flutter: [log, 7520.0]
flutter: [log, 7600.0]
flutter: [log, 7680.0]
flutter: [log, 7760.0]
flutter: [log, 7840.0]
flutter: [log, 7920.0]
flutter: [log, 8000.0]
flutter: Another exception was thrown: The Scrollbar's ScrollController has no ScrollPosition attached.
flutter: [log, 8080.0]
flutter: Another exception was thrown: The Scrollbar's ScrollController has no ScrollPosition attached.
flutter: [log, 8160.0]
flutter: Another exception was thrown: The Scrollbar's ScrollController has no ScrollPosition attached.
flutter: Another exception was thrown: The Scrollbar's ScrollController has no ScrollPosition attached.
flutter: [🎯, 8160.0]
flutter: [log, 8081.72112]
flutter: Another exception was thrown: The Scrollbar's ScrollController has no ScrollPosition attached.
flutter: [log, 7927.99488]
flutter: [log, 7813.05312]
flutter: [log, 7769.29104]
flutter: [log, 7633.29648]
flutter: [log, 7569.94224]
flutter: [log, 7392.2664]
flutter: [log, 7253.75856]
flutter: [log, 7075.8216]
flutter: [log, 6973.42176]
flutter: [log, 6837.4353599999995]
flutter: [log, 6604.03488]
flutter: [log, 6488.36688]
flutter: [log, 6413.04192]
flutter: [log, 6277.06368]
flutter: [log, 6107.76816]
flutter: [log, 5924.07024]
flutter: [log, 5771.47824]
flutter: Another exception was thrown: The Scrollbar's ScrollController has no ScrollPosition attached.
flutter: [log, 5595.499680000001]
flutter: [log, 5476.67376]
flutter: [log, 5301.82128]
flutter: [log, 5265.91728]
flutter: [log, 5219.88672]
flutter: [log, 5074.4184000000005]
flutter: [log, 4938.4483199999995]
flutter: [log, 4802.1192]
flutter: [log, 4661.55504]
flutter: [log, 4504.899359999999]
flutter: [log, 4369.36992]
flutter: [log, 4233.367200000001]
flutter: [log, 4120.53888]
flutter: [log, 4004.0222400000002]
flutter: [log, 3827.6846400000004]
flutter: [log, 3709.60944]
flutter: [log, 3536.5113600000004]
flutter: [log, 3400.53312]
flutter: [log, 3318.81888]
flutter: [log, 3182.8895999999995]
flutter: [log, 2931.8308799999995]
flutter: [log, 2801.0505599999997]
flutter: [log, 2672.45712]
flutter: [log, 2504.9486399999996]
flutter: [log, 2367.39552]
flutter: [log, 2252.2415999999994]
flutter: [log, 2135.52096]
flutter: [log, 2099.9759999999997]
flutter: [log, 1963.9977599999993]
flutter: [log, 1835.6817599999995]
flutter: [log, 1610.0577599999997]
flutter: [log, 1458.3878400000003]
flutter: [log, 1303.2417600000008]
flutter: [log, 1124.7417599999999]
flutter: [log, 965.3279999999995]
flutter: [log, 816.8159999999998]
flutter: [log, 663.6364799999992]
flutter: [log, 618.8217599999998]
flutter: [log, 482.54160000000047]
flutter: [log, 329.06016]
flutter: [log, 210.65855999999985]
flutter: [log, 76.33680000000004]
flutter: [log, 0.0]
flutter: [🎯🎯, 0.0]
flutter: Another exception was thrown: The Scrollbar's ScrollController has no ScrollPosition attached.
flutter: [log, 1051.2]
flutter: Another exception was thrown: The Scrollbar's ScrollController has no ScrollPosition attached.
flutter: [log, 1131.2]
flutter: Another exception was thrown: The Scrollbar's ScrollController has no ScrollPosition attached.
flutter: [log, 1051.2]
flutter: [log, 971.2]
flutter: [log, 891.2]
flutter: Another exception was thrown: The Scrollbar's ScrollController has no ScrollPosition attached.

```

<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->

```
```

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
```

</details>


https://user-images.githubusercontent.com/44134842/194688180-0da16102-2ac6-4cb0-a65c-d4b18146f2cf.mp4


<!--
      Consider also attaching screenshots and/or videos to better
      illustrate the issue.

      You can upload them directly on GitHub.
      Beware that video file size is limited to 10MB.
-->