我们想在聊天屏幕上使用背景图片。为此,我们创建了一个可平铺的图片。移动支持许多宽高比和纵向和横向。在Flutter中支持该用例的好方法是什么?一种想法是在运行时加入tiles并裁剪一张图片作为背景。这有可能吗?有没有直接的颤动支持?
发布于 2017-12-22 00:14:42
您需要阅读有关响应式应用程序的flutter文档
另外,看看捕获设备方向的MediaQueryData类。您可以通过查看这些属性来切换背景
发布于 2017-12-22 10:17:07
这是什么工作的横向和纵向和不同的设备分辨率。可以直接在图片上设置不透明度,以便在运行时保存该层。请确保您提供了不同分辨率的背景。https://flutter.io/assets-and-images/
注意: renderMessageListContent为前台内容!
@override
Widget build(BuildContext context) => new Stack(children: <Widget>[
new Positioned.fill(
child: new Opacity(
opacity: 0.2,
child: new Image.asset(
'assets/chat_background.png',
repeat: ImageRepeat.repeat,
fit: BoxFit.none
),
)),
new Opacity(
opacity: 0.15,
child: new Container(color: Theme.of(context).primaryColor)),
renderMessageListContent
]);https://stackoverflow.com/questions/47918125
复制相似问题