flutter_svg_provider 0.1.9-nullsafety.0 flutter_svg_provider: ^0.1.9-nullsafety.0 copied to clipboard
Generate image provider from svg path, use flutter_svg as a dependency.
import 'package:flutter/material.dart';
import 'package:flutter_svg_provider/flutter_svg_provider.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Svg Provider Example'),
),
body: DecoratedBox(
decoration: BoxDecoration(
image: DecorationImage(
repeat: ImageRepeat.repeat,
image: Svg(
'assets/test.svg',
size: Size(10, 10),
),
colorFilter: ColorFilter.mode(
Colors.black12,
BlendMode.srcIn,
),
),
),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image(
width: 500,
height: 500,
image: Svg('assets/test.svg'),
color: Colors.red,
),
],
),
),
),
);
}
}