flutter_boost分支:v1.17.1-hotfixes
Android
- 修復(fù):跳轉(zhuǎn)到flutter的webview頁面后返回崩潰和webview中無法進(jìn)行編輯的情況
XTextInputPlugin.java文件 222行
if (inputTarget.type == InputTarget.Type.PLATFORM_VIEW) {
if (isInputConnectionLocked) {
return lastInputConnection;
}
lastInputConnection = platformViewsController.getPlatformViewById(inputTarget.id).onCreateInputConnection(outAttrs);
return lastInputConnection;
}
修改為以下代碼:
if (inputTarget.type == InputTarget.Type.PLATFORM_VIEW) {
if (isInputConnectionLocked) {
return lastInputConnection;
}
if (platformViewsController != null && platformViewsController.getPlatformViewById(inputTarget.id) != null) {
lastInputConnection = platformViewsController.getPlatformViewById(inputTarget.id).onCreateInputConnection(outAttrs);
} else {
return lastInputConnection;
}
return lastInputConnection;
}
- 修復(fù):從flutter的webview頁面跳轉(zhuǎn)到頁面返回后webview無法滑動(dòng)、交互的問題
FlutterActivityAndFragmentDelegate.java文件 237行
if(ACTIVITY_CONTROL_SURFACE_ATTACH_TO_ACTVITY_HASH_CODE!=0||
ACTIVITY_CONTROL_SURFACE_ATTACH_TO_ACTVITY_HASH_CODE==this.host.getActivity().hashCode()){
flutterEngine.getActivityControlSurface().detachFromActivityForConfigChanges();
}
注釋掉
// if(ACTIVITY_CONTROL_SURFACE_ATTACH_TO_ACTVITY_HASH_CODE!=0||
// ACTIVITY_CONTROL_SURFACE_ATTACH_TO_ACTVITY_HASH_CODE==this.host.getActivity().hashCode()){
// flutterEngine.getActivityControlSurface().detachFromActivityForConfigChanges();
// }
iOS
- 修復(fù):flutter作為tabbar的根視圖互相切換時(shí)會(huì)有明顯的閃屏
FLBFlutterViewContainer.m文件 285行
if([UIApplication sharedApplication].applicationState == UIApplicationStateActive){
//NOTES:務(wù)必在show之后再update,否則有閃爍; 或?qū)е聜?cè)滑返回時(shí)上一個(gè)頁面會(huì)和top頁面內(nèi)容一樣
[self surfaceUpdated:YES];
}
修改為:
if([UIApplication sharedApplication].applicationState == UIApplicationStateActive){
//NOTES:務(wù)必在show之后再update,否則有閃爍; 或?qū)е聜?cè)滑返回時(shí)上一個(gè)頁面會(huì)和top頁面內(nèi)容一樣
// [self surfaceUpdated:YES];
/// 延遲刷新 避免閃屏
__block FlutterViewController *weakSelf = self;
dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(.1 * NSEC_PER_SEC));
dispatch_after(delayTime, dispatch_get_main_queue(), ^{
[weakSelf surfaceUpdated:YES];
});
}
目前所有修改不確保穩(wěn)定、僅為解決剛性問題臨時(shí)方案