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

Flutter 3.16.1环境下,无法完成渲染树的构建,表现为APP在debug模式下启动后一直停留在启动界面,控制台抛出异常 #96

Open
0x1af2aec8f957 opened this issue Nov 28, 2023 · 1 comment · May be fixed by #97

Comments

@0x1af2aec8f957
Copy link

Flutter 版本信息:

flutter --version

Flutter 3.16.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 7f20e5d18c (14 hours ago) • 2023-11-27 09:47:30 -0800
Engine • revision 22b600f240
Tools • Dart 3.2.1 • DevTools 2.28.3

主要的代码:

void main() async {
  // WidgetsFlutterBinding.ensureInitialized();
  MockBinding.ensureInitialized();

  // 运行会出现错误,一直停留在启动界面,无法进入APP
  return runMockApp(
    KeyboardRootWidget(
       child: App(),
    ));

  // 没有仍和问题
  // return runApp(App());


}

使用KeyboardRootWidget包裹的情况下:

flutter run ════════ Exception caught by Flutter framework ═════════════════════════════════ The following assertion was thrown: The render object for Stack cannot find ancestor render object to attach to. The ownership chain for the RenderObject in question was: Stack ← Directionality ← Builder ← MediaQuery ← KeyboardMediaQuery ← KeyboardRootWidget ← [root] Try wrapping your widget in a View widget or any other widget that is backed by a RenderTreeRootElement to serve as the root of the render tree. ════════════════════════════════════════════════════════════════════════════════

不使用KeyboardRootWidget包裹的情况下:

flutter run ════════ Exception caught by Flutter framework ═════════════════════════════════ The following assertion was thrown: The render object for Semantics cannot find ancestor render object to attach to. The ownership chain for the RenderObject in question was: Semantics ← _FocusInheritedScope ← Focus ← HeroControllerScope ← ScrollConfiguration ← MaterialApp ← WillPopScope ← NotificationListener ← _GlobalOverlaySupport-[LabeledGlobalKey>#a3d3e overlay_support] ← OverlaySupportTheme ← ⋯ Try wrapping your widget in a View widget or any other widget that is backed by a RenderTreeRootElement to serve as the root of the render tree. ════════════════════════════════════════════════════════════════════════════════
@jianchao97
Copy link

似乎是一樣的問題,也許你可以參考 https://github.com/Im-Kevin/cool_ui/issues/95

@0x1af2aec8f957 0x1af2aec8f957 linked a pull request Jan 5, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants