This guide explains how to use the ImageButton and the TextButton in a project.
The ImageButton and the TextButton are pressable buttons to be interacted by users.
The ImageButton Example:
The TextButton Example:
The main differences between ImageButton and TextButton is the data binding. TextButton can only bind text data. However, ImageButton can bind both text and image data. Additionally, the color property has some differences in the ImageButton and the TextButton. The TextButton has fillColor and pressedFillColor properties whereas ImageButton has only alpha property.
The ImageButton has three image statuses on data binding.
- Default State: This image is shown when the user has not interacted.
- HighLighted State: This image is shown when the user has pressed image button.
- Inactive State: This image is shown when the image button is not enabled.
Most common used event of Button type object is onPressed event. Here is an example ;