Flutter使用InkWell無水波紋效果


https://www.jianshu.com/p/0c6417a10ec0

 

正常情況下使用方式:

InkWell( onTap: () { }, child: Container( height: 50, child: Text( "是速度", maxLines: 1, style: TextStyle(color: color), overflow: TextOverflow.ellipsis, ), ), ) 

如果在InkWell的上下都出現的顏色的設置,如上中的Container中如果加入了color:Colors.white,這時候InkWell的水波紋效果會無效

解決方案是:在InkWell的外層再套上Matetial 以及 Ink組件

Material( child: Ink( child: InkWell( onTap: () { }, child: Container( height: 50.0, color: Colors.white, child: Text( "是速度", maxLines: 1, style: TextStyle(color: color), overflow: TextOverflow.ellipsis, ), ), ), ), )


作者:世見DeanWong
鏈接:https://www.jianshu.com/p/0c6417a10ec0
來源:簡書
著作權歸作者所有。商業轉載請聯系作者獲得授權,非商業轉載請注明出處。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM