Formation and evolution of gas-rich dwarf galaxies