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

iOS 使用PlatformView的A页面跳转到Flutter B页面,返回到A页面后PlatformView会变空白然后再显示 #1778

Open
zhanfengkuang opened this issue Dec 20, 2022 · 4 comments

Comments

@zhanfengkuang
Copy link

  InkWell(
    child: Container(
      height: 100,
      width: 375,
      child: NativeView('<simple-text-view>', true),
    ),
  ),
  InkWell(
    child: Container(
        padding: const EdgeInsets.all(8.0),
        margin: const EdgeInsets.all(8.0),
        color: Colors.yellow,
        child: const Text(
          'flutter rebuild demo',
          style: TextStyle(fontSize: 22.0, color: Colors.black),
        )),
    onTap: () {
      BoostNavigator.instance
          .push('flutterRebuildDemo', withContainer: withContainer);
    },
  )

官方Demo在flutter rebuild demo按钮上面加一个NativeView,点击flutter rebuild demo按钮后再返回到该页面,NativeView会变空白,然后再显示。

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.2, on macOS 12.6 21G115 darwin-x64, locale zh-Hans-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    ✗ 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.
      Run `flutter 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.0.1)
    ! CocoaPods 1.10.1 out of date (1.11.0 is recommended).
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.74.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

! Doctor found issues in 2 categories.
@zhanfengkuang
Copy link
Author

- (void)viewWillAppear:(BOOL)animated
{
    
    [FB_PLUGIN containerWillAppear:self];
    //For new page we should attach flutter view in view will appear
    //for better performance.
    [self attatchFlutterEngine];
    
    [super bridge_viewWillAppear:animated];
    if([UIApplication sharedApplication].applicationState == UIApplicationStateActive){
        //NOTES:务必在show之后再update,否则有闪烁; 或导致侧滑返回时上一个页面会和top页面内容一样
        [self surfaceUpdated:YES];
        
    }
    [self.view setNeedsLayout];//TODO:通过param来设定
    
}

在viewWillAppear方法中增加[self surfaceUpdated:YES];就好了

@zhanfengkuang
Copy link
Author

在viewWillAppear方法中增加[self surfaceUpdated:YES];这个方案在release环境中会出现卡死的情况
[super bridge_viewWillAppear:animated];没有做任何操作,改成[super viewWillAppear:animated]; 可以解决卡死的问题

@0xZOne
Copy link
Collaborator

0xZOne commented Mar 21, 2023

在viewWillAppear方法中增加[self surfaceUpdated:YES];这个方案在release环境中会出现卡死的情况 [super bridge_viewWillAppear:animated];没有做任何操作,改成[super viewWillAppear:animated]; 可以解决卡死的问题

非常感谢,欢迎提PR,参与共建~~

@fangdafei
Copy link

在viewWillAppear方法中增加[self surfaceUpdated:YES];这个方案在release环境中会出现卡死的情况 [super bridge_viewWillAppear:animated];没有做任何操作,改成[super viewWillAppear:animated]; 可以解决卡死的问题

PlatformView之间侧滑返回,加上了上面还是会白屏 @zhanfengkuang @0xZOne

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants