How to deal with supervisor who required me to share all my work with him?
I think you must give your supervisor all your "code, figure files, data, etc" pertaining all paper you have published together, as your supervisor is a co-author of your publications. Co-authors should have access to all relevant material behind published research under their responsibility, particularly corresponding authors.
And preferentially when you do so, share all of that in at least one data repository such as FigShare or Dryad, linking the raw material to their pertaining papers. If you have published research, make it public, so that everyone can benefit from your work. Scientific research equates with reproducible research, which heavily depends on transparency.
I believe you have an issue with having included your supervisor and perhaps some others as honorary/gift authors to work which was solely done by yourself. You should have objected to doing that before. Running away with important background scientific data will not send the right message nor mend this flaw.
You may indeed have an obligation to share the work because of policies requiring data retention and sharing on the part of financial organizations sponsoring the research.
For instance, NSF requires grant applicants to specify how their work—including analysis tools and data—will be shared and disseminated. While it may be your work product, your advisor and the institution are the ones obligated to retain and share the work.
He is most likely interested in handing it to another student to build on. And frankly, unless you have a good reason to keep a monopoly on your research project (i.e. you are continuing with it or starting a company), this is something you probably should support. Just blocking him out of spite does you no good. In fact it hurts you if it costs your paper some citations.
But assuming you have your reasons, if you were not ever an actual employee then the school only owns what you give them plus what he contributed. He is better described as an advisor rather than a supervisor.
The "ideas", such as for patents or whatever, are probably owned by the university by virtue of your adviser's name being on the papers combined with his employment contract. You wouldn't have much of a claim regardless of what really happened, as people would tend to believe a professor over his student regarding who deserves credit for a jointly-published idea.
The text in the papers which have his name on them are legally his work product too. You should give the that to him. Even if he didn't actually contribute, you publicly said he did contribute at least somewhat to the text, when you gave him co-authorship.
If you did the figures yourself in some vector graphics editor or such, just make screenshots of the result and give him that (i.e. what he could get on his own from the published paper anyway). Tell him you made them this way if he asks for more. You presumably transferred the copyright for the final bitmap image to the journal and/or school when you did the publication, but the raw editor format that can be used to produce variations remains yours.
Ownership of programming code is different from ownership of the idea it implements. Code is covered by copyright law and you retain the copyright for any code you produced (again, presuming you weren't working under any contract that says otherwise). Remind him of this. Note that if the school owns the idea they can legally block you from selling the code--if they feel like spending thousands to patent the idea and get this done within the time-limit after publication (one year in the US; in Europe I believe an idea ceases to be patent-able when published). They probably won't care unless you start to make real money immediately. But you still own the code even if you can't sell it to anyone else. You can, for one thing, sell it to them.
If the data was collected using university equipment then you should probably just hand it over. If you processed it in some way, give the raw data.
Even if you used the university's computers to generate the papers, say you used your own computer if asked (presuming you can claim this, and it wasn't some supercomputer you relied on). It doesn't really matter, but sidesteps weak arguments.