Skip to content

Commit b2d2eaf

Browse files
committed
width screen build
1 parent 5f366a1 commit b2d2eaf

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

lib/page/hello/android_hello_page.dart

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ class _AndroidHelloPageState extends State<AndroidHelloPage> {
7575
child: Observer(builder: (context) {
7676
if (accountStore.now != null &&
7777
(Platform.isIOS || Platform.isAndroid)) {
78-
return _buildScaffold(context);
78+
return LayoutBuilder(builder: (context, constraint) {
79+
if (constraint.maxHeight > constraint.maxWidth)
80+
return _buildPadScafford(context, constraint);
81+
return _buildScaffold(context);
82+
});
7983
}
8084
return LoginPage();
8185
}),
@@ -116,6 +120,26 @@ class _AndroidHelloPageState extends State<AndroidHelloPage> {
116120
);
117121
}
118122

123+
Widget _buildPadScafford(BuildContext context, BoxConstraints constraint) {
124+
double radio = constraint.maxHeight / constraint.maxWidth;
125+
double width = radio * constraint.maxHeight;
126+
return Stack(children: [
127+
_buildScaffold(context),
128+
Container(
129+
width: width,
130+
child: Navigator(
131+
onGenerateRoute: (RouteSettings routeSettings) {
132+
return PageRouteBuilder(pageBuilder: (BuildContext context,
133+
Animation<double> animation,
134+
Animation<double> secondaryAnimation) {
135+
return Container();
136+
});
137+
},
138+
),
139+
)
140+
]);
141+
}
142+
119143
Widget _buildPageContent(BuildContext context) {
120144
return PageView.builder(
121145
itemBuilder: (context, index) {

0 commit comments

Comments
 (0)