Creating your own Alloy widget
In the previous recipe, you added an existing widget to your application, but sometimes you might notice that part of the application you are creating could be made reusable. For example, you might have a calendar component, or a picker, or an interface that would be useful to make into a widget, so you can reuse it in other applications.
It's important, however, to understand that a widget should be self-contained. It shouldn't rely on any other part of your application to function. It shouldn't need other widgets to function correctly. You should be able to drop it into another project and it should just work. This is the fundamental test of whether a widget is fully reusable or not. If it relies on having styles, assets, or any other modules or libraries of your application to work, then it shouldn't be a widget.
That being said, it doesn't mean that a widget has to look the same in all your applications. In this recipe, we will create...