Вы можете просто передать значения в конструкторе вашего адаптера.В дротике вы также можете передать ссылку на функцию.Затем вызовите функцию щелчка мышью вашего элемента сетки.
Это вызовет оригинальную функцию в вашем основном классе.
class YourAdapter extends StatelessWidget {
final Function onItemTap;
YourAdapter(
{
this.onItemTap
});
//do something like this on the onPressed of your item
IconButton(
icon: Icon(icon),
color: Colors.deepPurpleAccent,
onPressed: () {
//this is the method that you passed as the reference in the
constructor. It will call the original function.
onItemTap(x,y);
},
)
}
Надеюсь, это поможет.