flutter_slidable icon indicating copy to clipboard operation
flutter_slidable copied to clipboard

How can i use icon from image asset ?

Open roofiah opened this issue 2 years ago • 2 comments

How can i use icon from image asset?

SlidableAction( onPressed: null, backgroundColor: Color(0xFFEEB4B0), foregroundColor: Colors.white, icon: Image.asset('assets/icon/trash.png'), label: 'Delete', ),

roofiah avatar Sep 09 '22 08:09 roofiah

This issue is same with https://github.com/letsar/flutter_slidable/issues/383

vinguyentruong avatar Nov 14 '22 06:11 vinguyentruong

If the icon can be made an SVG you can add it to a font. After doing this you'll be able to add the custom icon, CustomIcons.trash, to the IconData icon field. Something like https://www.fluttericon.com comes in very handy here. For more info search 'flutter custom icons'.

Sidenote: the icon SVG container must be a square.

Petri-Oosthuizen avatar Dec 09 '22 09:12 Petri-Oosthuizen