iconoir/bin/build/targets/flutter/template.js
2025-07-26 22:56:51 +02:00

26 lines
630 B
JavaScript

function template(name, svg) {
return `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}({super.key, this.color, this.width, this.height});
@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;