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

drnojrws  于 4个月前  发布在  Flutter
关注(0)|答案(4)|浏览(104)
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.
shyt4zoc

shyt4zoc1#

- (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];就好了

u5i3ibmn

u5i3ibmn2#

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

ibps3vxo

ibps3vxo3#

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

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

ne5o7dgx

ne5o7dgx4#

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

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

相关问题