The argument type 'Function?' can't be assigned to the parameter type 'void Function()?

Because the widget's onTap is defined as a void Function()? onTap, the value needs to be returned to be used (as a callback). So use:

onTap: ()=> onPress,

You can also define the onPress as a VoidCallback?, then you just need to:

onTap: onPress,