簡體   English   中英

如何刪除 Flutter 中 RaisedButton 的按下 animation?

[英]How can I remove press animation of RaisedButton in Flutter?

嗨,我想刪除在 Flutter 中按下“RaisedButton”時出現的 Animation。

我該怎么做?

在此處輸入圖像描述

RaisedButton(
                splashColor: Colors.transparent,
                highlightColor: Colors.transparent,
                padding: EdgeInsets.all(0),
                color: Colors.white,
                elevation: 0,
                onPressed: (){
                  Navigator.push(
                      context,  // 기본 파라미터, SecondRoute로 전달
                      MaterialPageRoute(builder: (context)=>TotalNotification()) // SecondRoute를 생성하여 적재
                  );
                },
                child: SvgPicture.asset(
                  'assets/images/BellButton.svg',
                  width: screenWidth * 0.0777777777777778,
                  height: screenWidth * 0.0777777777777778,
                ),
              ),

我可以給你一個想法。
只需用Container而不是RaisedButton包裝它,並尋求GesureDetector的幫助

GestureDetector(
          onTap: () {
            Navigator.push( context,  MaterialPageRoute(builder: (context)=>TotalNotification()));
          },
          child: Container(
            height: 50.0,
            width: 50.0,
            color: Colors.white,
            child: SvgPicture.asset(
                  'assets/images/BellButton.svg',
                  width: screenWidth * 0.0777777777777778,
                  height: screenWidth * 0.0777777777777778,
            ),
       ),
   ),

希望這適合你的情況!

暫無
暫無

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

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