I always had the same problem with my smart camera phone loupe (might have to do with limited depth of field). I had much better luck using my DSLR + Cheapo magnifier lenses for $20 set) and then blowing them up with Photoshop.
Been playing with a $50 imported Dental magnifier Wifi thing..not bad once I figured out the limited software. It works on Android phones, Iphones, and Windows PC (Rare these days) If my hands were steadier, it also shoots videos..(If I get some time, I will post some shots with it since it is made for dental applications and has a better depth of field that my camera loupe.
This was taken with a Nikon DSLR and those cheap filters..then enhanced with Photoshop..
As you can see..the bud, pistils, and sugars are in good focus..(depth of field was on auto macro mode + anti-shake mode on)
View attachment 800729