参数类型 'BoxConstraints' 无法分配给参数类型 'BuildContext'
The argument type 'BoxConstraints' can't be assigned to the parameter type 'BuildContext'
我你好,我的代码需要帮助,为什么会出现这个错误,我从另一个项目复制了代码但那里没有错误。
@override
Widget build(BuildContext context) {
dynamic screenWidth = MediaQuery.of(context).size.width;
dynamic screenHeight = MediaQuery.of(context).size.height;
ScreenUtil.init(
BoxConstraints(maxWidth: screenWidth, maxHeight: screenHeight),
designSize: const Size(360, 690),
orientation: Orientation.portrait);
return Scaffold(
ScreenUtil.init
的第一个参数是 BuildContext
.
类型
ScreenUtil.init(
context,
deviceSize: Size(screenWidth, screenHeight),
designSize: const Size(360, 690),
orientation: Orientation.portrait,
);
我你好,我的代码需要帮助,为什么会出现这个错误,我从另一个项目复制了代码但那里没有错误。
@override
Widget build(BuildContext context) {
dynamic screenWidth = MediaQuery.of(context).size.width;
dynamic screenHeight = MediaQuery.of(context).size.height;
ScreenUtil.init(
BoxConstraints(maxWidth: screenWidth, maxHeight: screenHeight),
designSize: const Size(360, 690),
orientation: Orientation.portrait);
return Scaffold(
ScreenUtil.init
的第一个参数是 BuildContext
.
ScreenUtil.init(
context,
deviceSize: Size(screenWidth, screenHeight),
designSize: const Size(360, 690),
orientation: Orientation.portrait,
);