what's the difference between multiple widgets and one widget with z-order buttons for project optimization?

Hello everyone! the main question of optimization for mobile applications. what’s better? one widget with a lot of buttons and events, and hide them using z-order. or several widgets broken down by logic and add or remove them depending on events. which is better or worse for a mobile application?