You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[web] flutter website doesn't resize properly when zoomed in/out and resizing window on desktop #77084
@nilsreichardt I am using flutter version 1.27 and the minimal reproducible code sample is:
Code
import'package:flutter/material.dart';
voidmain() {
runApp(
MaterialApp(
debugShowCheckedModeBanner:false,
home:Scaffold(
body:Center(
child:MyWidget(),
),
),
),
);
}
classMyWidgetextendsStatelessWidget {
@overrideWidgetbuild(BuildContext context) {
returnMaterial(
color:constColor(0xFF1a1a1a),
child:Scaffold(
backgroundColor:Colors.blue,
body:Stack(
children: [
Positioned(
left:MediaQuery.of(context).size.height *0.2,
right:MediaQuery.of(context).size.height *0.1,
top:MediaQuery.of(context).size.height *0.15,
child:Row(
mainAxisSize:MainAxisSize.min,
children: [
SizedBox(
width:MediaQuery.of(context).size.width *0.5,
child:Text("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum", style:TextStyle(color:Colors.white)),
),
SizedBox(width:MediaQuery.of(context).size.width *0.02),
SizedBox(
width:MediaQuery.of(context).size.width *0.2,
child:Center(
child:Text("Hello\nGood Morning", style:TextStyle(color:Colors.white)),
),
),
],
),
),
],
),
),
);
}
}
Hi @tanharpatel
Thanks for filing the issue, I'm unable to reproduce it on macOS or Windows
code sample
import'package:flutter/material.dart';
voidmain() {
runApp(
MaterialApp(
debugShowCheckedModeBanner:false,
home:Scaffold(
body:Center(
child:MyWidget(),
),
),
),
);
}
classMyWidgetextendsStatelessWidget {
@overrideWidgetbuild(BuildContext context) {
returnMaterial(
color:constColor(0xFF1a1a1a),
child:Scaffold(
backgroundColor:Colors.blue,
body:Stack(
children: [
Positioned(
left:MediaQuery.of(context).size.height *0.2,
right:MediaQuery.of(context).size.height *0.1,
top:MediaQuery.of(context).size.height *0.15,
child:Row(
mainAxisSize:MainAxisSize.min,
children: [
SizedBox(
width:MediaQuery.of(context).size.width *0.5,
child:Text(
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum",
style:TextStyle(color:Colors.white)),
),
SizedBox(width:MediaQuery.of(context).size.width *0.02),
SizedBox(
width:MediaQuery.of(context).size.width *0.2,
child:Center(
child:Text("Hello\nGood Morning",
style:TextStyle(color:Colors.white)),
),
),
],
),
),
],
),
),
);
}
}
flutter doctor -v
[✓] Flutter (Channel master, 1.27.0-9.0.pre.175, on macOS 11.2.2 20D80 darwin-x64, locale en-GB)
• Flutter version 1.27.0-9.0.pre.175 at /Users/tahatesser/Code/flutter_master
• Framework revision 97295dc9a8 (3 hours ago), 2021-03-03 00:19:03 -0500
• Engine revision cd0e54348b
• Dart version 2.13.0 (build 2.13.0-93.0.dev)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Volumes/Extreme/SDK
• Platform android-30, build-tools 30.0.3
• ANDROID_HOME = /Volumes/Extreme/SDK
• 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-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.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 1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.53.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.20.0
[✓] Connected device (4 available)
• Taha’s iPad (mobile) • 00008020-000255113EE8402E • ios • iOS 14.4
• iPhone 12 (mobile) • 948EC106-78EE-4A69-8D31-83C00E6419DE • ios •
com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 11.2.2 20D80
darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome
88.0.4324.192
• No issues found!
Can you please provide your flutter doctor -v and which browser you're using? Is it on debug mode or release mode?
Thank you
Hi @tanharpatel
You seem to be on 2 weeks older master, for master channel it's quite old
I cannot reproduce this issue on the latest master channel.
Can you please upgrade to the latest master and try again flutter channel master flutter upgrade --force flutter doctor -v
Thank you
Hi @tanharpatel
There is a precise zoom out to reproduce, if zoomed out quickly it corrects itself, then zoom a bit more, and then issues show up
Here I managed to zoom out exactly to reproduce. Only reproduces in Canvaskit render
Preview
Canvaskit
HTML
code sample
import'package:flutter/material.dart';
voidmain() {
runApp(
MaterialApp(
debugShowCheckedModeBanner:false,
home:Scaffold(
body:Center(
child:MyWidget(),
),
),
),
);
}
classMyWidgetextendsStatelessWidget {
@overrideWidgetbuild(BuildContext context) {
returnMaterial(
color:constColor(0xFF1a1a1a),
child:Scaffold(
backgroundColor:Colors.blue,
body:Stack(
children: [
Positioned(
left:MediaQuery.of(context).size.height *0.2,
right:MediaQuery.of(context).size.height *0.1,
top:MediaQuery.of(context).size.height *0.15,
child:Row(
mainAxisSize:MainAxisSize.min,
children: [
SizedBox(
width:MediaQuery.of(context).size.width *0.5,
child:Text(
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum",
style:TextStyle(color:Colors.white)),
),
SizedBox(width:MediaQuery.of(context).size.width *0.02),
SizedBox(
width:MediaQuery.of(context).size.width *0.2,
child:Center(
child:Text("Hello\nGood Morning",
style:TextStyle(color:Colors.white)),
),
),
],
),
),
],
),
),
);
}
}
flutter doctor -v
[✓] Flutter (Channel stable, 2.0.0, on Microsoft Windows [Version 10.0.19042.804], locale en-US)
• Flutter version 2.0.0 at C:\Users\Taha\Code\flutter_stable
• Framework revision 60bd88df91 (15 hours ago), 2021-03-03 09:13:17 -0800
• Engine revision 40441def69
• Dart version 2.12.0
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\Taha\Code\SDK
• Platform android-30, build-tools 30.0.3
• ANDROID_HOME = C:\Users\Taha\Code\SDK
• Java binary at: C:\Users\Taha\Code\android-studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at C:\Users\Taha\AppData\Local\Google\Chrome\Application\chrome.exe
[✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.8.5)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.8.31005.135
• Windows 10 SDK version 10.0.18362.0
[✓] Android Studio (version 4.1.0)
• Android Studio at C:\Users\Taha\Code\android-studio
• 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 1.8.0_242-release-1644-b01)
[✓] VS Code (version 1.53.2)
• VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.20.0
[✓] Connected device (4 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19042.804]
• Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.190
• Edge (web) • edge • web-javascript • Microsoft Edge 88.0.705.81
• No issues found!
[✓] Flutter (Channel master, 2.1.0-11.0.pre.97, on Microsoft Windows [Version 10.0.19042.804], locale en-US)
• Flutter version 2.1.0-11.0.pre.97 at C:\Users\Taha\Code\flutter_master
• Framework revision c14c8d8177 (2 hours ago), 2021-03-03 21:40:34 -0800
• Engine revision 72bbc5d92c
• Dart version 2.13.0 (build 2.13.0-93.0.dev)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\Taha\Code\SDK
• Platform android-30, build-tools 30.0.3
• ANDROID_HOME = C:\Users\Taha\Code\SDK
• Java binary at: C:\Users\Taha\Code\android-studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at C:\Users\Taha\AppData\Local\Google\Chrome\Application\chrome.exe
[✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.8.5)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.8.31005.135
• Windows 10 SDK version 10.0.18362.0
[✓] Android Studio (version 4.1.0)
• Android Studio at C:\Users\Taha\Code\android-studio
• 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 1.8.0_242-release-1644-b01)
[✓] VS Code (version 1.53.2)
• VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.20.0
[✓] Connected device (4 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19042.804]
• Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.190
• Edge (web) • edge • web-javascript • Microsoft Edge 88.0.705.81
• No issues found!
A similar issue was fixed in #75286 and also reported #75790
Thank you
Reacted by Peter Lauri, ilopX, FerBueroTrebino, D4VID, Marco Davalos and OutdatedGuy
I just tested this on master and it seems the merged fix is only a partial one. In case the surface size is still valid (i.e. no window size change, only device pixel ratio change), there's an early exit happening here in lib\src\engine\canvaskit\surface.dart, Surface.createOrUpdateSurface:
// Check if the window is the same size as before, and if so, don't allocate// a new canvas as the previous canvas is big enough to fit everything.final ui.Size? previousSurfaceSize = _currentSurfaceSize;
if (!_forceNewContext &&
previousSurfaceSize !=null&&
size.width == previousSurfaceSize.width &&
size.height == previousSurfaceSize.height) {
// The existing surface is still reusable.if (window.devicePixelRatio != _currentDevicePixelRatio) {
_updateLogicalHtmlCanvasSize(); // <-- should also call `_translateCanvas()` here!
}
return _surface!;
}
Interestingly, as @linxuebin1990 noticed, size.width and size.height often suffer from precision issues, making them subtly different, causing this path to not be taken as often as expected. When it is taken, the devicePixelRatio change is detected, the logical size of the canvas is updated to match, but the canvas' translation, intended to compensate for the canvas being oversized, isn't updated. This translation is expressed in logical pixels and thus should also be updated.
If this doesn't happen, it causes the Flutter UI to appear shifted vertically in the browser's viewport. This can be reproduced in any Flutter web app by using Ctrl+mousewheel to change the zoom level. Sooner or later it pops up. Luckily, changing the zoom level again or resizing the window does trigger the call to _translateCanvas() and fixes things.
So, there should be a call to _translateCanvas() next to _updateLogicalHtmlCanvasSize().
I would contribute a patch but it seems to take a while to get my CLA in order.
Reacted by Maatteogekko, linxuebin, squaregen and Niklas Mertsch
i still have this problem when zoom out + zoom in.
Flutter 3.0.1
Reacted by squaregen, ManuelWeidijkQict, Adetayo Olaitan, r-durao-pvotal, Miloš Karakaš, Samuel Hammill, Kristof Vandenbroucke, Niklas Mertsch, _juliotati, Vraj Shah and 3 more
Hi team,
I have created a pull request flutter-team-archive/engine#33695 to call _translateCanvas() after _updateLogicalHtmlCanvasSize(). Please check, thanks
first solutions: run on terminal : flutter run -d chrome --web-renderer html
seconds solutions: if u use android studio , click main.dart(top left run button) Edit configurations. You will see Additional run args: --web-renderer html
apply > ok > run
Reacted by jmatutegarcia, Feynallein and Ahmed Shawky
first solutions: run on terminal : flutter run -d chrome --web-renderer html seconds solutions: if u use android studio , click main.dart(top left run button) Edit configurations. You will see Additional run args: --web-renderer html apply > ok > run
That didn't work one hundred percent, because when I zoom in with the touchpad the problem still happens unfortunately.
Bro, can u try on new flutter project. Channel stable
That's what I did. I'm using the latest stable version of Flutter. So when I zoom with ctrl + mouse scroll or using the browser's zoom option the page works as expected, but when I use the touchpad/trackpad gesture to zoom the problem still happens.
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.
Activity
nilsreichardt commentedon Mar 2, 2021
Which flutter version do you use and can you provide a reproducible code sample?
tanharpatel commentedon Mar 3, 2021
@nilsreichardt I am using
flutter version 1.27and the minimal reproducible code sample is:Code
TahaTesser commentedon Mar 3, 2021
Hi @tanharpatel
Thanks for filing the issue, I'm unable to reproduce it on macOS or Windows
code sample
flutter doctor -v
[✓] Flutter (Channel master, 1.27.0-9.0.pre.175, on macOS 11.2.2 20D80 darwin-x64, locale en-GB) • Flutter version 1.27.0-9.0.pre.175 at /Users/tahatesser/Code/flutter_master • Framework revision 97295dc9a8 (3 hours ago), 2021-03-03 00:19:03 -0500 • Engine revision cd0e54348b • Dart version 2.13.0 (build 2.13.0-93.0.dev) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at /Volumes/Extreme/SDK • Platform android-30, build-tools 30.0.3 • ANDROID_HOME = /Volumes/Extreme/SDK • 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-6915495) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer • Xcode 12.4, Build version 12D4e • CocoaPods version 1.10.1 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.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 1.8.0_242-release-1644-b3-6915495) [✓] VS Code (version 1.53.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.20.0 [✓] Connected device (4 available) • Taha’s iPad (mobile) • 00008020-000255113EE8402E • ios • iOS 14.4 • iPhone 12 (mobile) • 948EC106-78EE-4A69-8D31-83C00E6419DE • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator) • macOS (desktop) • macos • darwin-x64 • macOS 11.2.2 20D80 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.192 • No issues found!Can you please provide your
flutter doctor -vand which browser you're using? Is it on debug mode or release mode?Thank you
tanharpatel commentedon Mar 3, 2021
Hello @TahaTesser
Thank you for your valuable response.
I am using Chrome on Windows. And the problem persists in release mode.
flutter doctor -v
[√] Flutter (Channel master, 1.27.0-2.0.pre.103, on Microsoft Windows [Version 10.0.18363.1379], locale en-US) • Flutter version 1.27.0-2.0.pre.103 at C:\flutter • Framework revision f49956598b (2 weeks ago), 2021-02-16 00:56:06 -0500 • Engine revision 1d537824d6 • Dart version 2.13.0 (build 2.13.0-30.0.dev) [√] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • Android SDK at C:\Users\Tanha Patel\AppData\Local\Android\Sdk • Platform android-30, build-tools 29.0.2 • ANDROID_HOME = C:\Users\Tanha Patel\AppData\Local\Android\Sdk • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04) • All Android licenses accepted. [√] Chrome - develop for the web • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe [√] Android Studio (version 3.6) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin version 45.1.1 • Dart plugin version 192.7761 • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04) [√] VS Code (version 1.53.2) • VS Code at C:\Users\Tanha Patel\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.20.0 [√] Connected device (2 available) • Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.190 • Edge (web) • edge • web-javascript • Microsoft Edge 88.0.705.56 • No issues found!TahaTesser commentedon Mar 3, 2021
Hi @tanharpatel
You seem to be on 2 weeks older
master, formasterchannel it's quite oldI cannot reproduce this issue on the latest
masterchannel.Can you please upgrade to the latest
masterand try againflutter channel masterflutter upgrade --forceflutter doctor -vThank you
tanharpatel commentedon Mar 3, 2021
Hey @TahaTesser
I am on latest master channel. But still I am facing issue when I zoom.
flutter doctor -v
Thanks!
TahaTesser commentedon Mar 4, 2021
Hi @tanharpatel
There is a precise zoom out to reproduce, if zoomed out quickly it corrects itself, then zoom a bit more, and then issues show up
Here I managed to zoom out exactly to reproduce. Only reproduces in Canvaskit render
Preview
code sample
flutter doctor -v
[✓] Flutter (Channel stable, 2.0.0, on Microsoft Windows [Version 10.0.19042.804], locale en-US) • Flutter version 2.0.0 at C:\Users\Taha\Code\flutter_stable • Framework revision 60bd88df91 (15 hours ago), 2021-03-03 09:13:17 -0800 • Engine revision 40441def69 • Dart version 2.12.0 [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at C:\Users\Taha\Code\SDK • Platform android-30, build-tools 30.0.3 • ANDROID_HOME = C:\Users\Taha\Code\SDK • Java binary at: C:\Users\Taha\Code\android-studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) • All Android licenses accepted. [✓] Chrome - develop for the web • Chrome at C:\Users\Taha\AppData\Local\Google\Chrome\Application\chrome.exe [✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.8.5) • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community • Visual Studio Community 2019 version 16.8.31005.135 • Windows 10 SDK version 10.0.18362.0 [✓] Android Studio (version 4.1.0) • Android Studio at C:\Users\Taha\Code\android-studio • 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 1.8.0_242-release-1644-b01) [✓] VS Code (version 1.53.2) • VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.20.0 [✓] Connected device (4 available) • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19042.804] • Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.190 • Edge (web) • edge • web-javascript • Microsoft Edge 88.0.705.81 • No issues found![✓] Flutter (Channel master, 2.1.0-11.0.pre.97, on Microsoft Windows [Version 10.0.19042.804], locale en-US) • Flutter version 2.1.0-11.0.pre.97 at C:\Users\Taha\Code\flutter_master • Framework revision c14c8d8177 (2 hours ago), 2021-03-03 21:40:34 -0800 • Engine revision 72bbc5d92c • Dart version 2.13.0 (build 2.13.0-93.0.dev) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at C:\Users\Taha\Code\SDK • Platform android-30, build-tools 30.0.3 • ANDROID_HOME = C:\Users\Taha\Code\SDK • Java binary at: C:\Users\Taha\Code\android-studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) • All Android licenses accepted. [✓] Chrome - develop for the web • Chrome at C:\Users\Taha\AppData\Local\Google\Chrome\Application\chrome.exe [✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.8.5) • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community • Visual Studio Community 2019 version 16.8.31005.135 • Windows 10 SDK version 10.0.18362.0 [✓] Android Studio (version 4.1.0) • Android Studio at C:\Users\Taha\Code\android-studio • 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 1.8.0_242-release-1644-b01) [✓] VS Code (version 1.53.2) • VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.20.0 [✓] Connected device (4 available) • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19042.804] • Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.190 • Edge (web) • edge • web-javascript • Microsoft Edge 88.0.705.81 • No issues found!A similar issue was fixed in #75286 and also reported #75790
Thank you
46 remaining items
HeinrichJanzing commentedon May 23, 2022
I just tested this on master and it seems the merged fix is only a partial one. In case the surface size is still valid (i.e. no window size change, only device pixel ratio change), there's an early exit happening here in lib\src\engine\canvaskit\surface.dart,
Surface.createOrUpdateSurface:Interestingly, as @linxuebin1990 noticed,
size.widthandsize.heightoften suffer from precision issues, making them subtly different, causing this path to not be taken as often as expected. When it is taken, thedevicePixelRatiochange is detected, the logical size of the canvas is updated to match, but the canvas' translation, intended to compensate for the canvas being oversized, isn't updated. This translation is expressed in logical pixels and thus should also be updated.If this doesn't happen, it causes the Flutter UI to appear shifted vertically in the browser's viewport. This can be reproduced in any Flutter web app by using Ctrl+mousewheel to change the zoom level. Sooner or later it pops up. Luckily, changing the zoom level again or resizing the window does trigger the call to
_translateCanvas()and fixes things.So, there should be a call to
_translateCanvas()next to_updateLogicalHtmlCanvasSize().I would contribute a patch but it seems to take a while to get my CLA in order.
linhdoan24 commentedon May 24, 2022
i still have this problem when zoom out + zoom in.
Flutter 3.0.1
fatduckling commentedon May 25, 2022
Hi @HeinrichJanzing
I've created #104573 for the fix and added a pull request (as this issue is closed).
Thanks
fatduckling commentedon May 30, 2022
Hi team,
I have created a pull request flutter-team-archive/engine#33695 to call
_translateCanvas()after_updateLogicalHtmlCanvasSize(). Please check, thanksPongsiriTK commentedon Jun 17, 2022
Any updates? I'm also facing this issue on production. Compare to the normal html this issue won't happen.
lucas-goldner commentedon Jul 10, 2022
Please check @fatduckling PR. Still facing this issue
lextotan commentedon Jul 13, 2022
first solutions: run on terminal : flutter run -d chrome --web-renderer html
seconds solutions: if u use android studio , click main.dart(top left run button) Edit configurations. You will see Additional run args: --web-renderer html
apply > ok > run
andrelrf1 commentedon Jul 23, 2022
That didn't work one hundred percent, because when I zoom in with the touchpad the problem still happens unfortunately.
lextotan commentedon Jul 23, 2022
Bro, can u try on new flutter project. Channel stable
andrelrf1 commentedon Jul 23, 2022
That's what I did. I'm using the latest stable version of Flutter. So when I zoom with ctrl + mouse scroll or using the browser's zoom option the page works as expected, but when I use the touchpad/trackpad gesture to zoom the problem still happens.
4780caa Fix flutter#77084: flutter website doesn't resize properly wh…
github-actions commentedon Aug 19, 2022
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 -vand a minimal reproduction of the issue.