I want to get my user to create a list of items. Then each item in that list needs to have a percentage assigned to it.
The tricky part is that the percentages need to add up to 100%.
So let's say the app is about customising a pizza top. The user will add items like so: onion 5%, cheese 45%, tomato 10% & mushroom 40%.
At the beginning the list is empty. So the first item will be 100% of the mix. I can deduct whatever percentage the user chooses for the second item from 100. But for the third and fourth items it gets difficult as I'm not sure which item I should deduct the item percentage from. Also there's a chance that the user wants to edit the percentages after assigning.
What's the best approach to this?