Repository: flutter
Issue: Improve the behaviour of InteractiveViewer when zoomed if clipBehaviour is Clip.none
Labels: framework,c: proposal,P2,team-framework,triaged-framework

### Steps to reproduce

1. Run the code sample.
2. Zoom in the image to the max scale.
3. You can move around the image but when you try to zoom out you get stuck.

### Expected results

I expect the zoom out to work normally.

### Actual results

I get stuck at a zoomed-in position.

### Code sample

<details open><summary>Code sample</summary>

```dart
// Copyright 2019 the Dart project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file.

import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  final String title;

  const MyHomePage({
    super.key,
    required this.title,
  });

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: InteractiveViewer(
          clipBehavior: Clip.none,
          child: Image.network(
            'https://storage.googleapis.com/cms-storage-bucket/images/Cupid_Dash_BlueBG.width-635.png',
            // If the image cover the screen size, it zoom-out normally.
            // height: MediaQuery.of(context).size.height,
            // fit: BoxFit.fitHeight,
          ),
        ),
      ),
    );
  }
}
```

</details>


### Screenshots or Video

I've tested it on both Android and iOS, Here's a video of testing it on Android Pixel 7:

https://github.com/flutter/flutter/assets/70890146/1511fc1a-943a-4760-bab1-9430f86c6f61


### Logs

_No response_

### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[!] Flutter (Channel stable, 3.16.0, on macOS 14.4 23E214 darwin-arm64, locale en-EG)
    • Flutter version 3.16.0 on channel stable at /Users/bx777/.puro/envs/locals/flutter
    ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/3.3.0/libexec/bin/dart, which is not inside your current Flutter SDK checkout
      at /Users/bx777/.puro/envs/locals/flutter. Consider adding /Users/bx777/.puro/envs/locals/flutter/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision db7ef5bf9f (4 months ago), 2023-11-15 11:25:44 -0800
    • Engine revision 74d16627b9
    • Dart version 3.2.0
    • DevTools version 2.28.2
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and
      upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/bx777/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A240d
    • CocoaPods version 1.14.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.87.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.84.0

[✓] Connected device (3 available)
    • Ahmed’s iPhone (mobile) • 00008020-00155D412243002E • ios            • iOS 17.4 21E219
    • macOS (desktop)         • macos                     • darwin-arm64   • macOS 14.4 23E214 darwin-arm64
    • Chrome (web)            • chrome                    • web-javascript • Google Chrome 122.0.6261.129

[✓] Network resources
    • All expected network resources are available.
```

Also, tried on master:
```console
[!] Flutter (Channel [user-branch], 3.19.0-9.0.pre.204, on macOS 14.4 23E214 darwin-arm64, locale en-EG)
    ! Flutter version 3.19.0-9.0.pre.204 on channel [user-branch] at /Users/bx777/.puro/envs/master/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
    ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/3.3.0/libexec/bin/dart, which is not inside your current Flutter SDK checkout
      at /Users/bx777/.puro/envs/master/flutter. Consider adding /Users/bx777/.puro/envs/master/flutter/bin to the front of your path.
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
    • Framework revision efb1346767 (8 weeks ago), 2024-01-27 14:07:24 -0500
    • Engine revision f3d48be766
    • Dart version 3.4.0 (build 3.4.0-81.0.dev)
    • DevTools version 2.31.0
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and
      upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/bx777/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A240d
    • CocoaPods version 1.14.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.87.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.84.0

[✓] Connected device (3 available)            
    • Ahmed’s iPhone (mobile) • 00008020-00155D412243002E • ios            • iOS 17.4 21E219
    • macOS (desktop)         • macos                     • darwin-arm64   • macOS 14.4 23E214 darwin-arm64
    • Chrome (web)            • chrome                    • web-javascript • Google Chrome 122.0.6261.129

[✓] Network resources
    • All expected network resources are available.
```

</details>