【问题标题】:How to provide gradient color for flutter splash screen如何为flutter splash screen提供渐变色
【发布时间】:2023-02-07 01:40:00
【问题描述】:

我正在使用以下插件

flutter_native_splash 2.2.17

它工作完美但问题是我只能在以下setup中使用一种颜色

flutter_native_splash:
  color: "#16874c" // here i am not able to use two HEX color as list in order to get gradiant color 

我有以下欲望梯度

  Container(
    decoration: BoxDecoration(
        gradient: LinearGradient(
            colors: [
              Colors.blue,
              Colors.black,
            ]
        )
    ),
  ), 

我如何使用相同的渐变并将其提供给flutter_native_splash设置

【问题讨论】:

    标签: flutter


    【解决方案1】:

    从文档:

      # color or background_image is the only required parameter.  Use color to set the background
      # of your splash screen to a solid color.  Use background_image to set the background of your
      # splash screen to a png image.  This is useful for gradients. The image will be stretch to the
      # size of the app. Only one parameter can be used, color and background_image cannot both be set.
      color: "#42a5f5"
      #background_image: "assets/background.png"
    

    使用任何工具创建渐变图像,将其放入您的资产文件夹并将其链接为 background_image

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-01-30
      • 2021-03-24
      • 1970-01-01
      • 2020-04-10
      • 1970-01-01
      • 1970-01-01
      • 2022-12-27
      • 1970-01-01
      相关资源
      最近更新 更多