【问题标题】:I'm getting late initialization error in flutter when trying to use flutter_screenutil package with introduction_screen package尝试将flutter_screenutil包与introduction_screen包一起使用时,我在flutter中遇到延迟初始化错误
【发布时间】:2021-12-26 16:37:09
【问题描述】:
【问题讨论】:
标签:
android
flutter
mobile
【解决方案1】:
您需要像示例页面here中提供的那样初始化 ScreenUtil 类
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
//You need to add this line to your code
//Set the fit size (fill in the screen size of the device in the design) If the design is based on the size of the 360*690(dp)
ScreenUtil.init(
BoxConstraints(
maxWidth: MediaQuery.of(context).size.width,
maxHeight: MediaQuery.of(context).size.height),
designSize: Size(360, 690),
minTextAdapt: true,
orientation: Orientation.portrait);
return Scaffold();
}
}