Does the Apple Smart Keyboard work for all iPads? I have an iPad 7th gen 10.2" and I've been looking for apple smart keyboards for a few days now. I came across one on ebay which was cheaper than usual but the thing is, it says that it's for the iPad 10.5".

How can I know if this works only in a 10.5" air or pro model, or it doesn't really matter?
In general, no. The contacts and physical size of keyboards make it very unlikely you can swap parts. Make sure the return policy is good or use the Apple Store app on your iPad and link your device so it shows which parts are compatible with your device.