I’m working on a Flutter project where I need to convert my Figma design into a mobile app. My design is created with 320px width as the base, but I’m struggling to make it look good on different screen sizes.
I’ve tried some automated tools like Adobe XD to Flutter and Supernova Studio, but they don’t give me complete results. I also tested Figma plugins like “Figma to flutter” and “Figma to code” but they have limitations too.
Right now I’m using a custom approach with extensions to scale the dimensions:
// DeviceConfig
deviceWidth = _mediaQuery.size.width;
deviceHeight = _mediaQuery.size.height;
extension ResponsiveDouble on double {
double height() {
double deviceHeight = DeviceConfig.deviceHeight;
var result = (this / 812.0) * deviceHeight;
return result;
}
double width() {
double deviceWidth = DeviceConfig.deviceWidth;
var result = (this / 375.0) * deviceWidth;
return result;
}
}
Usage example:
return SizedBox(width: 120.width());
But I’m not getting the results I want. Maybe I should factor in devicePixelRatio or use a different scaling method altogether.
What’s the best way to convert Figma measurements to work properly across different Flutter device sizes? Any suggestions would be really helpful.