Skip to content

Commit ab04288

Browse files
committed
修复键盘弹起遮挡问题
1 parent 9844f84 commit ab04288

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

lib/app.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ class _FlutterReduxAppState extends State<FlutterReduxApp>
9191
},
9292
HomePage.sName: (context) {
9393
_context = context;
94-
return NavigatorUtils.pageContainer(new HomePage());
94+
return NavigatorUtils.pageContainer(new HomePage(), context);
9595
},
9696
LoginPage.sName: (context) {
9797
_context = context;
98-
return NavigatorUtils.pageContainer(new LoginPage());
98+
return NavigatorUtils.pageContainer(new LoginPage(), context);
9999
},
100100

101101
///使用 ModalRoute.of(context).settings.arguments; 获取参数

lib/common/utils/navigator_utils.dart

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,14 @@ class NavigatorUtils {
9393
return Navigator.push(
9494
context,
9595
new SizeRoute(
96-
widget: pageContainer(RepositoryDetailPage(userName, reposName))));
96+
widget: pageContainer(
97+
RepositoryDetailPage(userName, reposName), context)));
9798
}
9899

99100
///荣耀列表
100101
static Future goHonorListPage(BuildContext context, List list) {
101-
return Navigator.push(
102-
context, new SizeRoute(widget: pageContainer(HonorListPage(list))));
102+
return Navigator.push(context,
103+
new SizeRoute(widget: pageContainer(HonorListPage(list), context)));
103104
}
104105

105106
///仓库版本列表
@@ -161,7 +162,7 @@ class NavigatorUtils {
161162
pageBuilder: (BuildContext buildContext, Animation<double> animation,
162163
Animation<double> secondaryAnimation) {
163164
return Builder(builder: (BuildContext context) {
164-
return pageContainer(SearchPage(centerPosition));
165+
return pageContainer(SearchPage(centerPosition), context);
165166
});
166167
},
167168
barrierDismissible: false,
@@ -253,17 +254,18 @@ class NavigatorUtils {
253254

254255
///公共打开方式
255256
static NavigatorRouter(BuildContext context, Widget widget) {
256-
return Navigator.push(context,
257-
new CupertinoPageRoute(builder: (context) => pageContainer(widget)));
257+
return Navigator.push(
258+
context,
259+
new CupertinoPageRoute(
260+
builder: (context) => pageContainer(widget, context)));
258261
}
259262

260263
///Page页面的容器,做一次通用自定义
261-
static Widget pageContainer(widget) {
264+
static Widget pageContainer(widget, BuildContext context) {
262265
return MediaQuery(
263266

264267
///不受系统字体缩放影响
265-
data: MediaQueryData.fromWindow(WidgetsBinding.instance.window)
266-
.copyWith(textScaleFactor: 1),
268+
data: MediaQuery.of(context).copyWith(textScaleFactor: 1),
267269
child: widget);
268270
}
269271

lib/page/trend/trend_page.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class TrendPageState extends State<TrendPage>
8686
transitionType: ContainerTransitionType.fade,
8787
openBuilder: (BuildContext context, VoidCallback _) {
8888
return NavigatorUtils.pageContainer(RepositoryDetailPage(
89-
reposViewModel.ownerName, reposViewModel.repositoryName));
89+
reposViewModel.ownerName, reposViewModel.repositoryName), context);
9090
},
9191
tappable: true,
9292
closedBuilder: (BuildContext _, VoidCallback openContainer) {
@@ -295,7 +295,7 @@ class TrendPageState extends State<TrendPage>
295295
return OpenContainer(
296296
transitionType: ContainerTransitionType.fade,
297297
openBuilder: (BuildContext context, VoidCallback _) {
298-
return NavigatorUtils.pageContainer(new TrendUserPage());
298+
return NavigatorUtils.pageContainer(new TrendUserPage(), context);
299299
},
300300
closedElevation: 6.0,
301301
closedShape: RoundedRectangleBorder(

0 commit comments

Comments
 (0)