I am Getting the following error.
lib/screens/bottom_navigation/dashboard_screen.dart:91:21: Error: The argument type 'BoxConstraints' can't be assigned to the parameter type 'BuildContext'.
- 'BoxConstraints' is from 'package:flutter/src/rendering/box.dart' ('/C:/flutter/packages/flutter/lib/src/rendering/box.dart').
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/framework.dart').
ScreenUtil.init(BoxConstraints(maxWidth: screenWidth, maxHeight: screenHeight),
Here is a snippet of the code:
@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: Size(360, 690), orientation: Orientation.portrait);
I am new to flutter. Please tell me what to do.
CodePudding user response:
Widget build(BuildContext context) {
ScreenUtil.init(context, designSize: const Size(360, 690),orientation: Orientation.portrait);
return Scaffold();
}