I have maggots in my bucket compost. What shall I do?
Well, your use of the term "bucket compost" implies to me that this is a smaller volume. On the good side, the fact that a fly is laying her eggs in your compost tells me you're providing moisture, feed sources, warmth. BUT you are getting fly larvae which will ultimately increase the number of flies in the world.
What you should do depends on your goals. If your goal is to eliminate these larvae, your very best bet would be to find a larger volume of compost that will heat up, turn it, and add your bucket to that larger volume. The heat of the larger compost will kill off the larvae and their protein will become plant available nitrogen. Alternatively, you could dig a hole and bury the contents of the bucket, covering with a foot or more of soil. Depending on the fly species, it's doubtful that the larvae or the mature flies would be able to make their way to the surface.
To reduce the numbers of flies drawn to your food waste, reduce the moisture content. Add shredded office paper (lots of this!) or brown deciduous leaves, or straw. But ultimately, a small volume of food waste is just going to be difficult to manage as compost. Think about a worm bin - this is a good way to manage food waste without too many fly problems. Check the local library for Appelhof's Worms Eat My Garbage or visit Worm Woman Inc.