From a502a44766ebf74ca5d331b4a26c900aeeda2eb4 Mon Sep 17 00:00:00 2001 From: Pranshul Date: Sun, 20 Jul 2025 19:42:18 +0530 Subject: [PATCH] fixed crashes on android 13 --- lib/screens/about_page.dart | 4 ++-- lib/screens/home.dart | 43 ++++++++++++++++++++++++------------- pubspec.yaml | 2 +- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/lib/screens/about_page.dart b/lib/screens/about_page.dart index d2e82e702..cc5fa4c3c 100644 --- a/lib/screens/about_page.dart +++ b/lib/screens/about_page.dart @@ -100,7 +100,7 @@ class AboutPage extends StatelessWidget { showLicensePage( context: context, applicationName: 'WeatherMaster', - applicationVersion: 'v2.2.0 (F)', + applicationVersion: 'v2.2.1 (F)', applicationIcon: Container( clipBehavior: Clip.hardEdge, margin: EdgeInsets.only(bottom: 16, top: 16), @@ -333,7 +333,7 @@ class CheckUpdateButton extends StatefulWidget { } class _CheckUpdateButtonState extends State { - final String currentVersion = 'v2.2.0'; + final String currentVersion = 'v2.2.1'; final String githubRepo = 'PranshulGG/WeatherMaster'; bool isChecking = false; diff --git a/lib/screens/home.dart b/lib/screens/home.dart index 77ac3d07a..16efc28fd 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -868,9 +868,6 @@ void maybeUpdateWeatherAnimation(Map current) { if (lastWeatherCode != weatherCode || lastIsDay != isDay) { - lastWeatherCode = weatherCode; - lastIsDay = isDay; - WidgetsBinding.instance.addPostFrameCallback((_) { if (mounted) { // setState(() { @@ -883,10 +880,14 @@ if (lastWeatherCode != weatherCode || lastIsDay != isDay) { showInsightsRandomly = Random().nextInt(100) < 40; PreferencesHelper.setColor("weatherThemeColor", weatherConditionColors[newIndex]); maybeUpdateWeatherAnimation(current); - _loadWeatherIconFroggy(weatherCodeFroggy, isDayFroggy, newIndex); + _loadWeatherIconFroggy(weatherCodeFroggy, isDayFroggy, newIndex); } }); + + + lastWeatherCode = weatherCode; + lastIsDay = isDay; } else{ _isLoadingFroggy == true; @@ -1092,14 +1093,24 @@ Widget buildLayoutBlock(LayoutBlockType type) { return _isAppFullyLoaded ? Column( children: [ + Stack( clipBehavior: Clip.none, children: [ - - if (weatherAnimationWidget != null) - useFullMaterialScheme ? const SizedBox.shrink() : usAnimations ? weatherAnimationWidget! : const SizedBox.shrink() - else - const SizedBox.shrink(), + if (weatherAnimationWidget != null) + useFullMaterialScheme + ? const SizedBox.shrink() + : usAnimations + ? ValueListenableBuilder( + valueListenable: _showHeaderNotifier, + builder: (context, show, child) { + return !show ? weatherAnimationWidget! : const SizedBox.shrink(); + }, + ) + : const SizedBox.shrink() +else + const SizedBox.shrink(), + GestureDetector( onTap: () async { @@ -1266,13 +1277,17 @@ Widget buildLayoutBlock(LayoutBlockType type) { Column( children: () { final visibleBlocks = layoutConfig.where((block) => block.isVisible).toList(); - final List children = []; + for (int i = 0; i < visibleBlocks.length; i++) { final currentBlock = visibleBlocks[i]; - children.add(buildLayoutBlock(currentBlock.type)); - final isRainThenInsights = currentBlock.type == LayoutBlockType.rain && + children.add(RepaintBoundary( + child: buildLayoutBlock(currentBlock.type), + )); + + final isRainThenInsights = + currentBlock.type == LayoutBlockType.rain && i + 1 < visibleBlocks.length && visibleBlocks[i + 1].type == LayoutBlockType.insights; @@ -1280,13 +1295,11 @@ Widget buildLayoutBlock(LayoutBlockType type) { children.add(const SizedBox(height: 8.5)); } } + return children; }(), ), - - - Container( width: double.infinity, padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom + 5, top: 16), diff --git a/pubspec.yaml b/pubspec.yaml index 1b1ea1013..6e96fbdc1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 2.2.0+9 +version: 2.2.1+10 environment: sdk: '>=3.0.6 <4.0.0'