mirror of
https://github.com/iconoir-icons/iconoir
synced 2026-03-14 14:05:44 +01:00
26 lines
630 B
JavaScript
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;
|