Need a background image for the chat screen for different aspect ratios of the screen and portrait and landscape mode

We would like to use the background image for the chat screen. To do this, we created a tile. Mobile supports many aspect ratios, portraits and landscapes. What would be a good way in Flutter to uphold this use case? One idea is to join the tiles and crop the image at runtime for the background. Is it possible? Is there any direct flutter support for this?

+4
source share
2 answers

You need to read flutter docs about adaptive applications

Create responsive applications

Also, take a look at the MediaQueryData class, which captures the orientation of the device. You can switch backgrounds by viewing these properties.

MediaQueryData

+1

, potrait . ​​ , . , . 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
      ]);
+1

Source: https://habr.com/ru/post/1691154/


All Articles