簡體   English   中英

如何將 void 函數從同一個小部件傳遞給另一個小部件,然后將相同的 void 函數從另一個小部件返回到同一個小部件中顫振

[英]how to pass the void function from same widget to another widget and then return the same void function from another widget to same widget in flutter

我在當前小部件中編寫 void 函數,然后將該 void 函數傳遞給另一個使用 Inkwell 屬性的類,我在 ontap 中使用相同的 void 函數,以及如何將該 void 函數傳遞給當前小部件

這能回答你的問題嗎?

class One{
  onTap(){
    print('One');
  }
}

class Two{
  final dynamic onTap;
  Two(this.onTap);

  doSomthing(){
    print('Two');
    onTap();
  }

}

暫無
暫無

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

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