Can I leave a company after they have filed for my H1-B and it has not been approved yet?

I am currently on F1 visa status, I have secured a job with a company who plans to file an h1-b for me this year, 1st April. I had this query whether can I shift from this company to some other company before or after they have filed for my h1-b and it has not been approved till then, which might take some time.

Your Question (including its title) is not clear. Please clarify what is your question?

Hi, I am currently on F1 visa status, I have secured a job with a company who plans to file an h1-b for me this year i.e 1st April 2019. if I get an offer from any other company, can leave the present company which has offered me a position now after they have filed for my h1-b say an arbitrary date 20th april.

say company A offered a job now and filing your H1 petition on April. Say in August Company B offered a job. At this point, since you dont have an approved H1 visa and Company A has already filed H1 petition, Company B cant file H1 petition since both petitions would be rejected (company A and Company B).
So, Its safe for you to get along with the company who filed your H1B, get it approved, start working for them for few days before changing to another company.

Thank you so much, that made things clear. So if I want to return back to an f1-opt status and work for company B and file for h1b next year, will that be allowed legally given that im already in the h1-b process with company A