iconoir/bin/build/targets/flutter/template.js
2023-10-29 00:33:17 +02:00

26 lines
668 B
JavaScript

const template = (name, svg) => `
import 'package:flutter/widgets.dart' as widgets;
import 'package:flutter_svg/flutter_svg.dart';
class ${name} extends widgets.StatelessWidget {
final widgets.Color? color;
final double? width;
final double? height;
const ${name}({widgets.Key? key, this.color, this.width, this.height})
: super(key: key);
@override
widgets.Widget build(widgets.BuildContext context) => SvgPicture.string(
'''
${svg}''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);
}
`;
export default template;