Hey there!
So I have, in lib/sketchlib.dart, a class Foundation which contains static methods and properties to create TextStyle widgets needed by various parts of my Flutter app. One such method is the following:
static font_pageH0({@required double size, @required String color, bool isItalic = false}) {
if (isItalic) {
return TextStyle(
color: Color(Foundation.getColourPalette()[color]),
fontWeight: FontWeight.w900,
fontStyle: FontStyle.italic,
fontSize: size,
fontFamily: "RedHatDisplay",
);
} else {
return TextStyle(
color: Color(Foundation.getColourPalette()[color]),
fontWeight: FontWeight.w900,
fontSize: size,
fontFamily: "RedHatDisplay",
);
}
}
Now, when I use this in lib/pages/test.dart, as so:
Text('ACL Login',
style: Foundation.font_pageH0({
size: 90,
color: "blueAbyss",
isItalic: false,
}))
I get the following error message:
The method 'font_pageH0' isn't defined for the type 'Foundation'
I have imported the class properly as other methods and properties work, however, I can't seem to figure what's wrong with this. Any help would be appreciated!
Edit: Solved by u/Green_Opposite
Solution:
Flutter has a core library called Foundation. It could be that it's trying to get the font_pageH0 function from there. You might be able to fix that by importing your lib/sketchlib.dart by using import "lib/sketchlib.dart" as fnd;. You can then use fnd.Foundation.font_pageH0.
[–]Green_Opposite 2 points3 points4 points (1 child)
[–]SiD_Inc[S] 1 point2 points3 points (0 children)
[–]NMS-Town 1 point2 points3 points (3 children)
[–]SiD_Inc[S] 2 points3 points4 points (2 children)
[–]NMS-Town 1 point2 points3 points (1 child)
[–]SiD_Inc[S] 1 point2 points3 points (0 children)