Created
July 29, 2019 18:03
-
-
Save xxGus/11b8954a5736a4e772d14d2a52d3f527 to your computer and use it in GitHub Desktop.
Flutter: adding SVG
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final String assetName = 'assets/image.svg'; | |
final Widget svg = new SvgPicture.asset( | |
assetName, | |
semanticsLabel: 'Acme Logo' | |
); | |
final String assetName = 'assets/up_arrow.svg'; | |
final Widget svgIcon = new SvgPicture.asset( | |
assetName, | |
color: Colors.red, | |
semanticsLabel: 'A red up arrow' | |
); | |
// Will print error messages to the console. | |
final String assetName = 'assets/image_that_does_not_exist.svg'; | |
final Widget svg = new SvgPicture.asset( | |
assetName, | |
); | |
final Widget networkSvg = new SvgPicture.network( | |
'https://site-that-takes-a-while.com/image.svg', | |
semanticsLabel: 'A shark?!', | |
placeholderBuilder: (BuildContext context) => new Container( | |
padding: const EdgeInsets.all(30.0), | |
child: const CircularProgressIndicator()), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment