Skip to content

Web: Flutter does not fill out entire screen in landscape on iOS Safari iPhone XS Max #71278

Open

Description

@phlegmaticprogrammer

I am running a Flutter web app in a browser on an iOS 13.7 Safari browser on an iPhone XS Max .

When I turn the phone into Landscape orientation, the top widget does not fill out the entire browser window, but leaves empty stripes on the left and right sides. Here is a photo, where the top widget is just an empty blue container:

image

I am using the following flutter version:
Flutter (Channel beta, 1.24.0-10.2.pre, on Mac OS X 10.15.7 19H2 darwin-x64,
locale en-GB)
• Flutter version 1.24.0-10.2.pre at /Users/stevenobua/flutter
• Framework revision 022b333 (8 days ago), 2020-11-18 11:35:09 -0800
• Engine revision 07c1eed46b
• Dart version 2.12.0 (build 2.12.0-29.10.beta)

And the code is just that:

// @dart=2.9
import 'package:flutter/material.dart';

class TestApp extends StatelessWidget {

  Widget build(BuildContext context) {
    return Container(color: Colors.blue);
  }

}

void main() {
  runApp(TestApp());
}

Activity

  1. darshankawar commented on Nov 27, 2020

    @darshankawar
    Member

    @phlegmaticprogrammer
    Can you elaborate on how are you running the web app on iphone browser ?

  2. added
    in triagePresently being triaged by the triage team
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Nov 27, 2020
  3. phlegmaticprogrammer commented on Nov 27, 2020

    @phlegmaticprogrammer
    Author

    I am serving the web app from a server embedded in my iPad App. But I tried it now also via running python3 -m http.server --cgi 8080 from the build/web directory (on macOS Catalina), and I get exactly the same phenomenon.

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Nov 27, 2020
  5. phlegmaticprogrammer commented on Nov 27, 2020

    @phlegmaticprogrammer
    Author

    I just tested it with Firefox on the phone, same behaviour. With Chrome on the phone, the behaviour is the worst: In landscape it stretches all the way from left to right, but this time the bottom part of the screen is empty. On refresh, the right part only is empty. On turning it to portrait, now long empty stripes left and right appear.

    Accessing the web app not from the iPhone XS max, but from an iPad, I don't have any problems like that using Safari. Accessing the web app from an iPhone 7 is also without problems using Safari. I guess it is somehow iPhone notch related?

  6. added
    platform-iosiOS applications specifically
    platform-webWeb applications specifically
    a: layoutSystemChrome and Framework's Layout Issues
    and removed
    in triagePresently being triaged by the triage team
    on Nov 27, 2020
  7. amanpreetsingh-BE commented on Nov 29, 2020

    @amanpreetsingh-BE

    @phlegmaticprogrammer
    Did you find a solution ? I have the exact same problem for flutter web.

  8. phlegmaticprogrammer commented on Nov 29, 2020

    @phlegmaticprogrammer
    Author

    @0xamps
    no, I think this is just a bug that needs to be fixed in Flutter. But let me know if you find a solution / workaround, I would be interested in that as well!

  9. darshankawar commented on Nov 30, 2020

    @darshankawar
    Member

    Adding steps to replicate for reference:

    1. flutter create safe_area_issue
    2. flutter build web
    3. Go to build/web path and run python3 -m http.server 8000
    4. Open iOS simulator / device that has a notch and open Safari browser.
    5. Note IPv4 address.
    6. In safari iOS browser, type http://8000
    7. Rotate device.
    flutter doctor -v
    
    [✓] Flutter (Channel beta, 1.24.0-10.2.pre, on Mac OS X 10.15.4 19E2269
        darwin-x64, locale en-IN)
        • Flutter version 1.24.0-10.2.pre at /Users/dhs/documents/Fluttersdk/flutter
        • Framework revision 022b333a08 (12 days ago), 2020-11-18 11:35:09 -0800
        • Engine revision 07c1eed46b
        • Dart version 2.12.0 (build 2.12.0-29.10.beta)
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
        • Android SDK at /Users/dhs/Library/Android/sdk
        • Platform android-30, build-tools 30.0.0
        • Java binary at: /Applications/Android
          Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build
          1.8.0_242-release-1644-b3-6222593)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 12.0.1, Build version 12A7300
        • CocoaPods version 1.9.3
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 4.0)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin version 46.0.2
        • Dart plugin version 193.7361
        • Java version OpenJDK Runtime Environment (build
          1.8.0_242-release-1644-b3-6222593)
    
    [✓] VS Code (version 1.50.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.15.1
    
    [✓] Connected device (4 available)
        • sdk gphone x86 arm (mobile)         • emulator-5554
          • android-x86    • Android 11 (API 30) (emulator)
        • iPhone SE (2nd generation) (mobile) • 6C85835D-FBFD-4AB3-8DE8-B4FAD35E5367
          • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)
        • Web Server (web)                    • web-server
          • web-javascript • Flutter Tools
        • Chrome (web)                        • chrome
          • web-javascript • Google Chrome 87.0.4280.67
    
    • No issues found!
    
    
    
  10. 29 remaining items

  11. removed
    triaged-iosTriaged by iOS platform team
    fyi-iosFor the attention of iOS platform team
    on Feb 10, 2024
  12. yjbanov commented on Feb 15, 2024

    @yjbanov
    Contributor

    We're drowning in flutter triage bot traffic. Resetting the triage bot timer.

  13. yjbanov commented on Feb 15, 2024

    @yjbanov
    Contributor

    nvm, this one's not from the bot, sorry.

  14. huycozy commented on Apr 12, 2024

    @huycozy
    Member

    The issue persists on the latest Flutter stable and master channels. Reproduced this on iPhone XS Max (has Notch) and iPhone 15 (has Dynamic Island) whilst it doesn't happen on iPhone 7 (no cutout area)

    Demo
    • iPhone XS Max
    landscape portrait
    flutter doctor -v (stable and master)
    [✓] Flutter (Channel stable, 3.19.5, on macOS 14.1 23B74 darwin-x64, locale en-VN)
        • Flutter version 3.19.5 on channel stable at /Users/huynq/Documents/GitHub/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 300451adae (8 days ago), 2024-03-27 21:54:07 -0500
        • Engine revision e76c956498
        • Dart version 3.3.3
        • DevTools version 2.31.1
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
        • Android SDK at /Users/huynq/Library/Android/sdk
        • Platform android-34, build-tools 34.0.0
        • ANDROID_HOME = /Users/huynq/Library/Android/sdk
        • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 15.2)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 15C500b
        • CocoaPods version 1.15.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2023.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
        • android-studio-dir = /Applications/Android Studio.app/
        • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
    
    [✓] VS Code (version 1.87.2)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.84.0
    
    [✓] Connected device (2 available)
        • macOS (desktop) • macos  • darwin-x64     • macOS 14.1 23B74 darwin-x64
        • Chrome (web)    • chrome • web-javascript • Google Chrome 123.0.6312.106
    
    [✓] Network resources
        • All expected network resources are available.
    
    • No issues found!
    [!] Flutter (Channel master, 3.22.0-9.0.pre.17, on macOS 14.1 23B74 darwin-x64, locale en-VN)
        • Flutter version 3.22.0-9.0.pre.17 on channel master at /Users/huynq/Documents/GitHub/flutter_master
        ! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
        ! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision a34086a573 (3 hours ago), 2024-04-11 18:07:20 -0700
        • Engine revision 6b37b17099
        • Dart version 3.5.0 (build 3.5.0-47.0.dev)
        • DevTools version 2.34.1
        • 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/huynq/Library/Android/sdk
        • Platform android-34, build-tools 34.0.0
        • ANDROID_HOME = /Users/huynq/Library/Android/sdk
        • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 15.3)
        • Xcode at /Applications/Xcode15.3.app/Contents/Developer
        • Build 15E204a
        • CocoaPods version 1.15.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2023.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
        • android-studio-dir = /Applications/Android Studio.app/
        • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
    
    [✓] VS Code (version 1.88.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.86.0
    
    [✓] Connected device (2 available)
        • macOS (desktop) • macos  • darwin-x64     • macOS 14.1 23B74 darwin-x64
        • Chrome (web)    • chrome • web-javascript • Google Chrome 123.0.6312.123
    
    [✓] Network resources
        • All expected network resources are available.
    
    ! Doctor found issues in 1 category.
  15. CleanCodix commented on Feb 3, 2026

    @CleanCodix

    2026 still there.

  16. benji-farquhar commented on Mar 26, 2026

    @benji-farquhar
    Contributor

    On iPhone Chrome in landscape mode, I have left and right white edges like the image in the original issue description. On iPhone Safari, i have gotten rid of the landscape white edges, but I have portrait top and bottom white edges 😂

  17. CleanCodix commented on Mar 26, 2026

    @CleanCodix

    I figured out to fix this by adding viewport-fit=cover to the content of the <meta name="viewport" .../> tag within the ./web/index.html file.

    However it seems Flutter override it at runtime on launch.

    To bypass it I've added:

    // Override meta viewport tag after it has been set by Flutter (Fix unwanted margins in iOS Safari)
    final viewport = web.window.document.querySelector('meta[name="viewport"]');
    viewport?.setAttribute('content', '${viewport.getAttribute('content')}, viewport-fit=cover');
    

    Before the runApp(...)call in my main.dart file.

  18. diegolopezrm commented on Sep 25, 2026

    @diegolopezrm
    Contributor

    This should be fixed on master by #191647, which landed on September 23.

    The white stripes come from the browser keeping the page out of the safe areas, and the reason adding viewport-fit=cover to index.html never helped is that the engine used to rewrite the viewport tag and drop it. It now keeps it, and the safe-area insets flow into MediaQuery.padding, so SafeArea can keep your content away from the cutout while the app itself covers the whole screen.

    I tried it in the iOS 26.1 simulator (iPhone 17 Pro, Safari, landscape) with a fresh project from master and viewport-fit=cover in the viewport tag: the app fills the screen, including the sides under the Dynamic Island, and MediaQuery.paddingOf reports left 62, right 62, bottom 20. That is the simulator, not a phone, so a confirmation from someone on a real device would be welcome.

    Two things to keep in mind: you still have to opt in by adding viewport-fit=cover to your viewport tag (the flutter create template now includes a commented-out example explaining it), and the fix is on master, so it will reach stable with the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: layoutSystemChrome and Framework's Layout Issuesbrowser: safari-iosonly manifests in Safari on iOSfound in release: 3.19Found to occur in 3.19found in release: 3.22Found to occur in 3.22has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyplatform-webWeb applications specificallyteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions