Home > Enterprise >  How to put a route in an IconButton widget [FLUTTER]
How to put a route in an IconButton widget [FLUTTER]

Time:12-30

I want my Icons.arrow_back to be a custom one for me, one that I have in SVG, but I have the path, I don't know how to place it correctly.

leading: new IconButton(
              icon: new Icon(
                Icons.arrow_back, 
                color: Get.theme.colorScheme.primary,
                size: 40.0,
              ),
              onPressed: () => Navigator.of(context).pop(),
            ), 

CodePudding user response:

Developers from the Flutter community created a lib to handle svg files. We can use it as Or you can use Image.assets also for this and then wrape on Gesture Detector ontap(){ /** call the navigator.pop **/ } or you may use Flutter SVG plugin also

 leading :  new SvgPicture.asset(
     'assets/images/candle.svg',
      height: 20.0,
      width: 20.0,
      allowDrawingOutsideViewBox: true,
    ),

I found a small example of SVG https://www.developerlibs.com/2019/06/flutter-draw-svg-vector-drawables.html

  • Related