Skip to content

Commit 334c30d

Browse files
committed
增加注释
1 parent e138a59 commit 334c30d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/app.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ class _FlutterReduxAppState extends State<FlutterReduxApp>
8585

8686
///命名式路由
8787
/// "/" 和 MaterialApp 的 home 参数一个效果
88+
///⚠️ 这里的 name调用,里面 pageContainer 方法有一个 MediaQuery.of(context).copyWith(textScaleFactor: 1),
89+
///⚠️ 而这里的 context 用的是 WidgetBuilder 的 context ~
90+
///⚠️ 所以 MediaQuery.of(context) 这个 InheritedWidget 就把这个 context “登记”到了 Element 的内部静态 _map 里。
91+
///⚠️ 所以键盘弹出来的时候,触发了顶层的 MediaQueryData 发生变化,自然就触发了“登记”过的 context 的变化
92+
///⚠️ 比如 LoginPage 、HomePage ····
93+
///⚠️ 所以比如你在 搜索页面 键盘弹出时,下面的 HomePage.sName 对应的 WidgetBuilder 会被触发
94+
///⚠️ 这个是我故意的,如果不需要,可以去掉 pageContainer 或者不要用这里的 context
8895
routes: {
8996
WelcomePage.sName: (context) {
9097
_context = context;

0 commit comments

Comments
 (0)