簡體   English   中英

Flutter - 線性漸變不將顏色作為顏色數組

[英]Flutter - Linear Gradient not taking colors as a array of colors

我實際上正在准備一個登錄屏幕並決定使用線性漸變作為背景。 我實際上在穩定頻道中將我的 Flutter SDK 從 1.20 升級到 1.22。 請點擊以下鏈接查看問題

編碼

顯示的錯誤

顯示我該怎么做。

謝謝你。

在命令行中使用flutter cleanflutter pub cache repair ,然后重新啟動ide

你可以試試這個,可能有一些版本不匹配。


Container(
        decoration: BoxDecoration(
            gradient: LinearGradient(
              begin: Alignment.topRight,
              end: Alignment.bottomLeft,
              colors: [Colors.blue, Colors.red])),
        child: Center(
          child: Text(
            'Hello Gradient!',
            style: TextStyle(
              fontSize: 48.0,
              fontWeight: FontWeight.bold,
              color: Colors.white),
          ),
        ),
      )

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM