在颤振中 onHover:(某物)=> 函数(上下文)和 onHover:函数(上下文)有什么区别?

  • 本文关键字:上下文 函数 onHover 区别 某物 flutter
  • 更新时间 :
  • 英文 :


当我执行onHover: function(context)时,它会给我错误

但CCD_ 2工作良好。

有什么区别?onHover是否应该始终有一个变量(PointerHoverEvent(?

function(context);

可能会返回onHover参数不想要的东西,onHover参数想要一个函数,在这里onHover: (event) => function(context)中,你给它的是参数想要的函数,

给你一个想法


//this is a function
Function functionWhichReturnsInt = (){return 1;};
//this is function which needs function
void feedMeAFunction(Function food){
food();
}
//this is a function which needs int
void feedMeAnInt(int food){
print(food);
}
//we can call the functions like this
//passing a function
feedMeAFunction(functionWhichReturnsInt);
//passing an int
feedMeAnInt(functionWhichReturnsInt());

最新更新