fix(runtime): late top-level/instance vars used with ??= (mediaQuery/screenHeight/etc) -> nullable. Fixes LateInitializationError on /me /shop /product-detail
This commit is contained in:
@@ -20,9 +20,9 @@ import '../../utils/util_web.dart'
|
||||
if (dart.library.io) '../../utils/util_io.dart';
|
||||
import '../../utils/utils.dart';
|
||||
|
||||
late MediaQueryData mediaQuery;
|
||||
late double statusBarHeight;
|
||||
late double screenHeight;
|
||||
MediaQueryData? mediaQuery;
|
||||
double? statusBarHeight;
|
||||
double? screenHeight;
|
||||
|
||||
class MobileMe extends StatefulWidget {
|
||||
final Key? key;
|
||||
@@ -43,7 +43,7 @@ class MobileMeState extends State<MobileMe> {
|
||||
User? _user;
|
||||
|
||||
late ShopScrollCoordinator _shopCoordinator;
|
||||
late ShopScrollController _pageScrollController;
|
||||
ShopScrollController? _pageScrollController;
|
||||
final double _sliverAppBarInitHeight = 165.0;
|
||||
final double _appBarHeight = 85.0;
|
||||
|
||||
@@ -65,13 +65,13 @@ class MobileMeState extends State<MobileMe> {
|
||||
}
|
||||
|
||||
mediaQuery ??= MediaQuery.of(context);
|
||||
screenHeight ??= mediaQuery.size.height;
|
||||
statusBarHeight ??= mediaQuery.padding.top;
|
||||
screenHeight ??= mediaQuery!.size.height;
|
||||
statusBarHeight ??= mediaQuery!.padding.top;
|
||||
|
||||
_pageScrollController ??=
|
||||
_shopCoordinator.pageScrollController(_sliverAppBarInitHeight * -1.0);
|
||||
_shopCoordinator.pinnedHeaderSliverHeightBuilder ??= () {
|
||||
return statusBarHeight + kToolbarHeight + _appBarHeight;
|
||||
return statusBarHeight! + kToolbarHeight + _appBarHeight;
|
||||
};
|
||||
|
||||
_listScrollController1 = _shopCoordinator.newChildScrollController();
|
||||
|
||||
Reference in New Issue
Block a user