Oxygen is crucial for many chemical and biological processes, and its facile detection is of great significance in our daily lives. In this study, we report a leucomethylene blue (LMB)-encapsulated hydrogel visual indicator for the detection of both gaseous and dissolved Oxygen (DO). The photosensitization of methylene blue (MB) not only lead to its reduction to colorless LMB but also resulted in hydrogel polymerization, thus allowing the one-step preparation of the LMB-hydrogel. Meanwhile, the photosensitized reduction of MB was quite fast (5000-fold faster than the classical glucose reduction). In this manner, the blue color of MB could be completely decayed within only 1 min. Also, the efficient polymerization triggered by MB photosensitization ensured the rapid preparation of LMB hydrogels within 10 min. By placing the oxygen indicator in air or water, oxygen can specifically oxidize the colorless LMB-hydrogel to the blue MB-hydrogel. When coupled with a smartphone, the oxygen indicator exhibited a linear response to DO in the range 0.23-10 mg/L with a detection limit of 0.077 mg/L. The LMB-hydrogel indicator was successfully explored for visual evaluation of vacuum degree during food packaging. The LMB-hydrogel, with the advantages of low cost, ease of preparation, as well as facile use, is a promising visual indicator for both gaseous and dissolved oxygen, especially for in-house usage.