Two-dimensional organic–inorganic hybrid Ruddlesden–Popper perovskite materials: preparation, enhanced stability, and applications in photodetection