Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

viewInsets.bottom is incorrect after showing some picker on iOS #134798

Closed
2 tasks done
kohp27 opened this issue Sep 15, 2023 · 4 comments
Closed
2 tasks done

viewInsets.bottom is incorrect after showing some picker on iOS #134798

kohp27 opened this issue Sep 15, 2023 · 4 comments
Labels
a: text input Entering text in a text field or keyboard related problems c: regression It was better in the past than it is now found in release: 3.13 Found to occur in 3.13 found in release: 3.14 Found to occur in 3.14 has reproducible steps The issue has been confirmed reproducible and is ready to work on platform-ios iOS applications specifically r: duplicate Issue is closed as a duplicate of an existing issue team-ios Owned by iOS platform team

Comments

@kohp27
Copy link

kohp27 commented Sep 15, 2023

Is there an existing issue for this?

Steps to reproduce

  1. Show the keyboard
  2. Show the picker (image or file)
  3. Back to the app

This problem has occurred on iOS from 3.10.0 to the current latest master branch.
It did not occur in 3.7.x or earlier.

Expected results

Always get the correct MediaQuery.of(context).viewInsets.bottom value.

Actual results

The value is incorrect (slightly smaller) and the keyboard hides part of the screen.
Return to the home screen or enter text and get the correct value.

Even if resizeToAvoidBottomInset is set to false, the keyboard height is not calculated correctly and the keyboard hides part of the screen.

Code sample

Code sample

In the following, image_picker is used.
Using file_picker is the same.

import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(home: MyHomePage());
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    final viewInsetsBottom = MediaQuery.of(context).viewInsets.bottom;

    return Scaffold(
      resizeToAvoidBottomInset: false,
      body: Column(
        mainAxisAlignment: MainAxisAlignment.end,
        children: [
          Text('viewInsets.bottom: $viewInsetsBottom'),
          const TextField(),
          TextButton(
            onPressed: () {
              ImagePicker().pickImage(source: ImageSource.gallery);
            },
            child: const Text('Pick Image'),
          ),
          SizedBox(height: viewInsetsBottom),
        ],
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
screen_capture_compressed.mp4

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output

User name is modified.

[✓] Flutter (Channel stable, 3.10.0, on macOS 13.5.2 22G91 darwin-arm64, locale
    ja-JP)
    • Flutter version 3.10.0 on channel stable at
      /Users/{user}/.asdf/installs/flutter/3.10.0-stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 84a1e904f4 (4 months ago), 2023-05-09 07:41:44 -0700
    • Engine revision d44b5a94c9
    • Dart version 3.0.0
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at /Users/{user}/Library/Android/sdk
    • Platform android-33, build-tools 33.0.2
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1)
    • 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
      11.0.15+0-b2043.56-8887301)

[✓] VS Code (version 1.82.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.72.0

[✓] Connected device (2 available)
    • iPhone 14 (mobile) • A5F7ED21-5114-4F98-B0AF-7576F3BCCEB8 • ios
      • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
    • Chrome (web)       • chrome                               • web-javascript
      • Google Chrome 116.0.5845.187

[✓] Network resources
    • All expected network resources are available.

• No issues found!
@dam-ease dam-ease added the in triage Presently being triaged by the triage team label Sep 15, 2023
@dam-ease
Copy link

Hi @kohp27. Thanks for filing this. I'm able to reproduce this on the latest master and stable channels. I observed this only on iOS, on Android, the keyboard is dismissed when image is chosen and on keyboard activation, it shows the right value (previous value).

stable, master flutter doctor -v

[✓] Flutter (Channel stable, 3.13.3, on macOS 13.0 22A380 darwin-arm64, locale
    en-NG)
    • Flutter version 3.13.3 on channel stable at
      /Users/damilolaalimi/sdks/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2524052335 (9 days ago), 2023-09-06 14:32:31 -0700
    • Engine revision b8d35810e9
    • Dart version 3.1.1
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/damilolaalimi/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/damilolaalimi/Library/Android/sdk
    • 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.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • 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.6b802.4-9586694)

[✓] VS Code (version 1.82.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.50.0

[✓] Connected device (3 available)
    • iPhone 13 Pro (mobile) • 14B6FEE4-2F1C-401F-8804-A5115D7A6DA2 • ios
      • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
    • macOS (desktop)        • macos                                •
      darwin-arm64   • macOS 13.0 22A380 darwin-arm64
    • Chrome (web)           • chrome                               •
      web-javascript • Google Chrome 116.0.5845.187

[✓] Network resources
    • All expected network resources are available.

• No issues found!
[✓] Flutter (Channel master, 3.14.0-14.0.pre.289, on macOS 13.0 22A380 darwin-arm64, locale en-NG)
    • Flutter version 3.14.0-14.0.pre.289 on channel master at /Users/damilolaalimi/fvm/versions/master
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4db47db177 (32 hours ago), 2023-09-13 20:39:58 -0700
    • Engine revision cd90cc8469
    • Dart version 3.2.0 (build 3.2.0-140.0.dev)
    • DevTools version 2.27.0

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/damilolaalimi/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/damilolaalimi/Library/Android/sdk
    • 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.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • 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.6b802.4-9586694)

[✓] VS Code (version 1.82.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.50.0

[✓] Connected device (3 available)
    • iPhone 13 Pro (mobile) • 14B6FEE4-2F1C-401F-8804-A5115D7A6DA2 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
    • macOS (desktop)        • macos                                • darwin-arm64   • macOS 13.0 22A380 darwin-arm64
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 116.0.5845.187

[✓] Network resources
    • All expected network resources are available.

• No issues found!

@dam-ease dam-ease added a: text input Entering text in a text field or keyboard related problems c: regression It was better in the past than it is now platform-ios iOS applications specifically has reproducible steps The issue has been confirmed reproducible and is ready to work on team-ios Owned by iOS platform team found in release: 3.13 Found to occur in 3.13 found in release: 3.14 Found to occur in 3.14 and removed in triage Presently being triaged by the triage team labels Sep 15, 2023
@kohp27
Copy link
Author

kohp27 commented Sep 15, 2023

Yes, if the keyboard were to keep activating on Android, the problem may also occur on Android. But I was not sure if this was possible, so I reported that it only happened on iOS.

@huycozy
Copy link
Member

huycozy commented Sep 18, 2023

Hi all, there is a similar case reported before this and also has someone having it: #133537. I will mark this as a duplicate issue in favor of that one.

@kohp27 Thanks for filing this issue, please follow up on the linked issue for further updates.

@huycozy huycozy closed this as not planned Won't fix, can't repro, duplicate, stale Sep 18, 2023
@huycozy huycozy added the r: duplicate Issue is closed as a duplicate of an existing issue label Sep 18, 2023
@github-actions
Copy link

github-actions bot commented Oct 2, 2023

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: text input Entering text in a text field or keyboard related problems c: regression It was better in the past than it is now found in release: 3.13 Found to occur in 3.13 found in release: 3.14 Found to occur in 3.14 has reproducible steps The issue has been confirmed reproducible and is ready to work on platform-ios iOS applications specifically r: duplicate Issue is closed as a duplicate of an existing issue team-ios Owned by iOS platform team
Projects
None yet
Development

No branches or pull requests

3 participants