【发布时间】:2018-09-05 00:43:26
【问题描述】:
我正在创建一个登录屏幕,我有这个背景图片,
问题是当用户单击TextFields 之一并且键盘弹出时,背景图像会更改其大小以适应新的屏幕大小(不包括键盘)。
我希望背景保持不变且大小相同,我会使用BoxFit.none,但我担心它会影响应用的响应能力。
代码如下:
new Container(
decoration: new BoxDecoration(
color: Colors.red,
image: new DecorationImage(
fit: BoxFit.cover,
image: new AssetImage(
'assets/images/splash_screen/background.png'))),
child: new Center(
child: new ListView(
physics: new PageScrollPhysics(),
children: <Widget>[ //Login screen content ],
),
),
);
我还尝试使用设备屏幕的minHeight 定义BoxConstraints,但没有帮助,我也使用了Stack,但没有运气。
这就是我所说的改变尺寸的意思: No Keyboard / With Keyboard
【问题讨论】:
-
也许这会有所帮助...stackoverflow.com/questions/46551268/…
标签: dart responsive flutter