Open lastback opened 1 year ago
when the change use animation also shake
Hi @lastback
I download and run your sample project but got this error when executing pod install
.
[!] Invalid `Podfile` file: cannot load such file -- /Users/likai/Documents/flutter/packages/flutter_tools/bin/podhelper.
Can you update to use relative paths instead?
Hi @lastback I download and run your sample project but got this error when executing
pod install
.[!] Invalid `Podfile` file: cannot load such file -- /Users/likai/Documents/flutter/packages/flutter_tools/bin/podhelper.
Can you update to use relative paths instead?
hello @huycozy , thank you for you reply, you can cd the "my_flutter" folder, and do "flutter clean" clean the cache of my project
@huycozy i did the "flutter clean" and reupload the project.zip
Thanks for your response, but it seems I can't see the issue when replaying this several times.
Can you please describe this in more detail and the expected result as well?
@huycozy Hi bro, pls use the ipad simulator(my app use in ipad) and all the widgets like my video shake. or look at your video start from the 0:04 sec and the "debug" tag shakes in the top right corner not smoothly. this is the simple demo, in my app all the ui widgets shake like my video.
https://user-images.githubusercontent.com/4507915/230841660-7cd1a042-21fc-4611-8123-de6030337258.mp4
several weeks ago, i first met this problem, and i changed the resize in all flutter scenes, so it would be smoothly. but this time, i can not change anymore(swift mix flutter).
not only in ipad simulator, but in real ipad device also shake
several weeks ago, i first met this problem, and i changed the resize in all flutter scenes, so it would be smoothly. but this time, i can not change anymore(swift mix flutter).
Did you upgrade the Flutter SDK recently? Do you remember the old version on which the issue doesn't happen? (so that I can retry on that version and verify this issue)
Also, is that a Flutter app? (the app is shown in the demo video above). It looks like a native app:)
@huycozy hi, my app is a native(swift) app mix flutter. so the frame changed is FlutterViewController in swift. the sdk is forked from 3.7.9 stabled. our company start to use swift mix flutter since 3.7.3 and all those versions have this problem.
@huycozy bad news, i tried flutter v3.3.0 & v2.5.0, the same shake in the native & flutter mix mode.
v3.9.0-21.0.pre the same shake
Thanks for checking on many Flutter versions. But be honest, I don't see it clearly with the demo in the sample code. I also try replicating the case with a GridView of items (as in your above video) but also don't see the issue.
Could you please update the sample code so that the issue is more visible? And it would be appreciated if you could also try creating a Native version with Swift to compare with Flutter.
Also, can you try this on Profile
or Release
mode as well? (May be related: https://github.com/flutter/flutter/issues/79593)
hi, @huycozy thank you for your patience! i found the difference between your video and mine, so, you can also check my new project and new video.
https://user-images.githubusercontent.com/4507915/231333073-ee4752ff-191b-4950-9848-daf99845c2cf.mp4
the project code of the video upon project.zip
Also, can you try this on
Profile
orRelease
mode as well? (May be related: #79593)
i read #79593 before, but not work for me and #79593 is flash, my app not flash, and the temp solution mentioned in #79593 may crashed? so i'm not sure is the same problem.
Thanks for your updated sample code. I'm not sure this is a bug, but maybe a proposal to make FlutterViewController
look smoother when resizing. Labeling the issue for more insights.
Adding the demo video which also comparing with iOS Photos native app. Photos app's animation looks smoother.
@huycozy yes, as an bussiness app(Add-to-app mode), this resizing effect must not be comfortable, now maybe what I can only do next is wait for the future optimization.
@hellohuanlin Could this have a similar solution to https://github.com/flutter/flutter/issues/16322?
This feels like related to the framework side - it looks like the images are resized with a delay of 1-2 frames
I feel like the header text is also stretched for a split second, not just the images. Very hard to tell.
I feel like the header text is also stretched for a split second, not just the images. Very hard to tell.
True, the header text is indeed stretched, so likely the whole screen issue, not just the images.
One thing we can try is, if the transitionDuration
is 0, we can delay the change by a few milliseconds. Since the flutter UI and window resizing are in different threads, I don't think there's a perfect solution - we have to tweak it by experiment and see the result.
One thing we can try is, if the transitionDuration is 0, we can delay the change by a few milliseconds. Since the flutter UI and window resizing are in different threads, I don't think there's a perfect solution - we have to tweak it by experiment and see the result.
I tried this workaround but it didn't look good. I don't think any of the similar solutions to the distortion rotation issue (e.g. snapshot trick, delayed swap, or size interpolation) works for this, since this time the window resizing happens instantly. A real solution may require some big change in both engine and the framework, to make each individual widget more smooth during resizing.
Hi folks, I have met a similar problem. After experiments, I have a counter-intuitive way to "hotfix" this. You guys can check if this is applicable to your scenario.
The concept is to make the app dropping frames so that the resizing shake will not be seen. 50ms is about 3 frames under 60FPS.
dropFrames(50); // <-- this will block the main thread for 50ms (use with cautious!)
void dropFrames(int ms) {
final stopwatch = Stopwatch()..start();
while (stopwatch.elapsedMilliseconds < ms) {
fib(1000); // 50ms will require running here about 30K-50K times
}
}
// Just a random algorithm for heavy calculation. Memory space is O(1).
int fib(int n) {
if (n == 0) return 0;
int a = 0, b = 1;
for (int i = 2; i <= n; i++) {
int temp = a + b;
a = b;
b = temp;
}
return b;
}
entirment
mac os 13.2 xcode version 14.2
problem
my project is ios swift project, when i add flutter to it, when then controller'frame changed, the flutter all widgets shakes like the video.
flutter doctor -v
[✓] Flutter (Channel 3.7.9-modified, 3.7.10-0.0.pre.1, on macOS 13.2 22D49 darwin-arm64, locale zh-Hans-CN) • Flutter version 3.7.10-0.0.pre.1 on channel 3.7.9-modified at /Users/likai/Documents/github/flutter • Upstream repository git@github.com:lastback/flutter.git • FLUTTER_GIT_URL = git@github.com:lastback/flutter.git • Framework revision 95ed6ac748 (4 days ago), 2023-04-03 10:08:06 +0800 • Engine revision ec975089ac • Dart version 2.19.6 • DevTools version 2.20.1 • Pub download mirror https://pub.flutter-io.cn • Flutter download mirror https://storage.flutter-io.cn
[!] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) • Android SDK at /Users/likai/Library/Android/sdk ✗ cmdline-tools component is missing Run
path/to/sdkmanager --install "cmdline-tools;latest"
See https://developer.android.com/studio/command-line for more details. ✗ Android license status unknown. Runflutter doctor --android-licenses
to accept the SDK licenses. See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.[✓] Xcode - develop for iOS and macOS (Xcode 14.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14C18 • CocoaPods version 1.11.3
[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.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 11.0.12+0-b1504.28-7817840)
[✓] VS Code (version 1.77.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.62.0
[✓] Proxy Configuration • HTTP_PROXY is set • NO_PROXY is localhost,::1,127.0.0.1,LOCALHOST • NO_PROXY contains localhost • NO_PROXY contains 127.0.0.1 • NO_PROXY contains ::1
[✓] Connected device (3 available) • iPad (10th generation) (mobile) • EE0F2695-DEF0-4204-91C1-F43F1E5C00C5 • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-2 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 13.2 22D49 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 111.0.5563.146 ! Error: Failed to prepare the device for development. Please unlock and reconnect the device. (code 806)
[✓] HTTP Host Availability • All required HTTP hosts are available
Steps to Reproduce
1.download the swift project & run it. 2.click the white button, look at the picture's change(left orange panel is native swift, and the right panel is flutter)
https://user-images.githubusercontent.com/4507915/230582423-b996bda1-d5e5-4767-bbff-7c819e346ecb.mp4
project.zip