diff --git a/lib/widgets/desktop/desktop_me.dart b/lib/widgets/desktop/desktop_me.dart index c94af66..c60a139 100644 --- a/lib/widgets/desktop/desktop_me.dart +++ b/lib/widgets/desktop/desktop_me.dart @@ -16,9 +16,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 DesktopMe extends StatefulWidget { final Key? key; @@ -67,8 +67,8 @@ class DesktopMeState extends State { } mediaQuery ??= MediaQuery.of(context); - screenHeight ??= mediaQuery.size.height; - statusBarHeight ??= mediaQuery.padding.top; + screenHeight ??= mediaQuery!.size.height; + statusBarHeight ??= mediaQuery!.padding.top; Widget userInfo = GestureDetector( child: Container( diff --git a/lib/widgets/mobile/mobile_me.dart b/lib/widgets/mobile/mobile_me.dart index 9757036..e5a8531 100644 --- a/lib/widgets/mobile/mobile_me.dart +++ b/lib/widgets/mobile/mobile_me.dart @@ -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 { 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 { } 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(); diff --git a/lib/widgets/mobile/mobile_product_detail_page.dart b/lib/widgets/mobile/mobile_product_detail_page.dart index 605900f..d5b5120 100644 --- a/lib/widgets/mobile/mobile_product_detail_page.dart +++ b/lib/widgets/mobile/mobile_product_detail_page.dart @@ -23,10 +23,10 @@ import '../../widgets/general/add_remove_button.dart'; import '../../widgets/general/carousel.dart'; import '../../widgets/general/show_price.dart'; -late MediaQueryData mediaQuery; -late double statusBarHeight; -late double screenHeight; -late double screenWidth; +MediaQueryData? mediaQuery; +double? statusBarHeight; +double? screenHeight; +double? screenWidth; class MobileProductDetailPage extends StatefulWidget { final Business business; @@ -45,12 +45,12 @@ class MobileProductDetailPage extends StatefulWidget { class MobileProductDetailPageState extends State with SingleTickerProviderStateMixin { late ShopScrollCoordinator _shopCoordinator; - late ShopScrollController _pageScrollController; + ShopScrollController? _pageScrollController; late TabController _tabController; - late double _sliverAppBarInitHeight; - late double _sliverAppBarMaxHeight; + double? _sliverAppBarInitHeight; + double? _sliverAppBarMaxHeight; final double _tabBarHeight = 50; ProductDetail? productDetail; @@ -75,18 +75,18 @@ class MobileProductDetailPageState extends State refresh = false; mediaQuery ??= MediaQuery.of(context); - screenHeight ??= mediaQuery.size.height; - screenWidth ??= mediaQuery.size.width; - statusBarHeight ??= mediaQuery.padding.top; + screenHeight ??= mediaQuery!.size.height; + screenWidth ??= mediaQuery!.size.width; + statusBarHeight ??= mediaQuery!.padding.top; _sliverAppBarInitHeight ??= screenWidth; _sliverAppBarMaxHeight ??= screenWidth; _pageScrollController ??= _shopCoordinator - .pageScrollController(_sliverAppBarMaxHeight - _sliverAppBarInitHeight); + .pageScrollController(_sliverAppBarMaxHeight! - _sliverAppBarInitHeight!); _shopCoordinator.pinnedHeaderSliverHeightBuilder ??= () { - return statusBarHeight + kToolbarHeight + _tabBarHeight; + return statusBarHeight! + kToolbarHeight + _tabBarHeight; }; return Scaffold( @@ -110,10 +110,10 @@ class MobileProductDetailPageState extends State }, ), backgroundColor: Theme.of(context).primaryColor, - expandedHeight: _sliverAppBarMaxHeight - 30.0, + expandedHeight: _sliverAppBarMaxHeight! - 30.0, flexibleSpace: FlexibleSpaceBar( background: Carousel( - height: _sliverAppBarInitHeight + 0.0, + height: _sliverAppBarInitHeight! + 0.0, pages: _getProductPictures(context), autoPlay: false, ), diff --git a/lib/widgets/mobile/shop.dart b/lib/widgets/mobile/shop.dart index 9c72e3a..5edf2af 100644 --- a/lib/widgets/mobile/shop.dart +++ b/lib/widgets/mobile/shop.dart @@ -37,10 +37,10 @@ import 'product_item.dart'; import 'product_search.dart'; import 'shopping_cart_bar.dart'; -late MediaQueryData mediaQuery; -late double statusBarHeight; -late double screenWidth; -late double screenHeight; +MediaQueryData? mediaQuery; +double? statusBarHeight; +double? screenWidth; +double? screenHeight; class Shop extends StatefulWidget { final int? businessId; @@ -80,11 +80,11 @@ class ShopState extends State bool refresh = false; late ShopScrollCoordinator _shopCoordinator; - late ShopScrollController _pageScrollController; + ShopScrollController? _pageScrollController; late TabController _tabController; final double _sliverAppBarInitHeight = 150.0; final double _tabBarHeight = 50.0; - late double _sliverAppBarMaxHeight; + double? _sliverAppBarMaxHeight; ShopScrollController? _listScrollController1; late ShopScrollController _listScrollController2; @@ -204,17 +204,17 @@ class ShopState extends State } mediaQuery ??= MediaQuery.of(context); - screenWidth ??= mediaQuery.size.width; - screenHeight ??= mediaQuery.size.height; - statusBarHeight ??= mediaQuery.padding.top; + screenWidth ??= mediaQuery!.size.width; + screenHeight ??= mediaQuery!.size.height; + statusBarHeight ??= mediaQuery!.padding.top; - _sliverAppBarMaxHeight ??= screenHeight - 150.0; + _sliverAppBarMaxHeight ??= screenHeight! - 150.0; _pageScrollController ??= _shopCoordinator - .pageScrollController(_sliverAppBarMaxHeight - _sliverAppBarInitHeight); + .pageScrollController(_sliverAppBarMaxHeight! - _sliverAppBarInitHeight); _shopCoordinator.pinnedHeaderSliverHeightBuilder ??= () { - return statusBarHeight + kToolbarHeight + _tabBarHeight; + return statusBarHeight! + kToolbarHeight + _tabBarHeight; }; refresh = false; @@ -513,8 +513,8 @@ class ShopState extends State Positioned( top: 0, right: 0, - left: screenWidth - 100, - bottom: screenHeight - 100, + left: screenWidth! - 100, + bottom: screenHeight! - 100, child: Image.asset( 'assets/images/under_renovation.png', width: 200.0, @@ -953,7 +953,7 @@ class ShopState extends State color: Colors.white, )), Container( - width: mediaQuery.size.width - 30.0, + width: mediaQuery!.size.width - 30.0, padding: EdgeInsets.only(right: 10.0, bottom: 10.0), child: new Text( _business!.bulletin!.isEmpty ? '' : _business!.bulletin!,