簡體   English   中英

Flutter RaisedButton Hightlightelevation 延遲

[英]Flutter RaisedButton Hightlightelevation delay

我在 Flutter 中創建了以下 RaisedButton:

在此處輸入圖片說明

問題是,當您按住按鈕約 1 秒鍾時,按鈕的 highlightElevation 會觸發,當我在其左側顯示圖像時,但是當我刪除圖像時,它會按預期工作。 有沒有辦法在保持圖像的同時解決這個問題?

這是我的代碼:

Widget systems(String systemName, String systemTitle, Image img) {
return Center(child:
Container( width:width-20,height:110,child:
Column( children: <Widget>[
SizedBox(height: 10),
RaisedButton( elevation: 10,splashColor: Colors.transparent,highlightElevation: 0, shape: 
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
), 
    color: Colors.white,
    onPressed: () {},
    child: Padding(
        padding: EdgeInsets.only(left:0,top:15,bottom:15),
        
        child: Row(children: [
          img,Container(width:width-120,child:
          Align(
            alignment: Alignment.center,
            child: Column(
              children: [
                Text(systemName, style: TextStyle(fontSize: 18)),
                
              ],
            ),
          ),)
        ])))
])));
}

PS:我在另一個小部件的 for 循環中調用了這個小部件 9 次,當我將循環次數減少到 5 次或更低時,按鈕也能按預期工作。

根據 Flutter SDK highlightElevation 是當按鈕被啟用和按下時按鈕的材質。

請參考https://api.flutter.dev/flutter/material/RawMaterialButton/highlightElevation.html

highlightElevation 屬性:啟用並按下按鈕時按鈕材質的高程。

暫無
暫無

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

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