I am currently doing something like this
new Tab(icon: new Icon(Icons.arrow_forward), text: "Browse"),
However I would like to use an image as an icon . I get images using
new Image.asset("assets/img/logo.png"),
My question is how can i use that image as an icon in my tab shown above ?
To set the image to be displayed as the icon, you need to pass an ImageProvider instance. For that purpose, you need to create an instance of any class that's a descendant of ImageProvider such as AssetImage , NetworkImage , MemoryImage , and ResizeImage . The below example uses AssetImage to load the image.
As per documentation Tab icon property ask a widget so you can pass like this also or any other widget also
new Tab(icon: new Image.asset("assets/img/logo.png"), text: "Browse"),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With