This study presents a breakthrough in the field of onsite bacterial detection, offering an innovative, rapid, and ultrasensitive colorimetric biosensor for the detection of Escherichia coli (E. coli) O157:H7, using chemically modified melamine foam (MF). Different from conventional platforms, such as 96-well plates and fiber-based membranes, the modified MF features a macroporous reticulated three-dimensional (3D) framework structure, allowing fast and free movement of large biomolecules and bacteria cells through the MF structure in every direction and ensuring good accessibility of entire active binding sites of the framework structure with the target bacteria, which significantly increased sensitive and volume-responsive detection of whole-cell bacteria. The biosensing platform requires less than 1.5 h to complete the quantitative detection with a sensitivity of 10 cfu/mL, discernible by the naked eye, and an enhanced sensitivity of 5 cfu/mL with the help of a smartphone. Following a short enrichment period of 1 h, the sensitivity was further amplified to 2 cfu/mL. The biosensor material is volume responsive, making the biosensing platform sensitivity increase as the volume of the sample increases, and is highly suitable for testing large-volume fluid samples. This novel material paves the way for the development of volume-flexible biosensing platforms for the record-fast, onsite, selective, and ultrasensitive detection of various pathogenic bacteria in real-world applications.