I created a couple or reusable flutter widgets that uses flutter basic widgets such as Container,Row,Column and Stacks...
I'm wondering if exist such a VSC plugin or a cli to do same as babel to transform (decapsulation) back theses customs reusable classes to flutter basic widget with taking in consideration data passed.
Long story short, how to transform srcfile.dart to distfile.dart while taking all custom widget and transform them back to to flutter widget while taking construct passed fields.
//.....
class IconsLink extends StatelessWidget {
final String svgName;
final String text;
final String? routeTo;
final Color color;
final bool? followBG;
Color bgColor = Colors.white;
Color.fromARGB(255,247,247,254)]
IconsLink(
{super.key,
//...
required this.svgName,
required this.text,
this.routeTo = "",
this.color = Colors.black26,
this.followBG = false}); // required this.text
@override
Widget build(BuildContext context) {
if (followBG ?? true) {
bgColor = color.withAlpha(24);
}
return Column(children: [
//...
Container(
width: 15.w,
height: 15.w,
child: Center(
child: SizedBox(
width: 7.5.w,
height: 7.5.w,
child: SvgPicture.string(svgName,
colorFilter: ColorFilter.mode(color, BlendMode.srcIn))
)),
decoration:
BoxDecoration(color: bgColor, boxShadow: bx, borderRadius: br),
),
SizedBox(height: 0.8.h),
Text(
text,
style: TextStyle(
color: color, fontWeight: FontWeight.w800, fontSize: 3.5.w),
)
]);
}
}
Like whenever i use IconsLink(...) inside widgets it ll be replaced with Column.., meaning that IconsLink it ll not be existed in dist file after transformation process.
Column(children: [
//...
Container(
width: 15.w,
height: 15.w,
child: Center(
child: SizedBox()....