如何在flutter中仅为TextField禁用splashColor?

问题描述 投票:0回答:1

我试图在TextField上禁用涟漪效应。

splashColor: Colors.transparent也消除了对其他小部件的连锁反应。

我想仅在TextField上消除涟漪效应。

dart flutter
1个回答
0
投票

试试这种方式,你只需要将Theme添加到你的TextField

Theme(
  data: Theme.of(context).copyWith(splashColor: Colors.transparent),
  child: TextField(),
),
© www.soinside.com 2019 - 2024. All rights reserved.