diff --git a/lib/widgets/color_analysis_button.dart b/lib/widgets/color_analysis_button.dart index c62b3ca..33ab45f 100644 --- a/lib/widgets/color_analysis_button.dart +++ b/lib/widgets/color_analysis_button.dart @@ -153,15 +153,13 @@ class _ColorAnalysisButtonState extends State { try { final analyzer = ImageColorAnalyzer(); final result = await analyzer.analyzeColoringImage(widget.imageBytes!); - if (mounted) { + if (context.mounted) { widget.onAnalysisComplete(result); - if (context.mounted) { - _showAnalysisDialog(context, result); - } + _showAnalysisDialog(context, result); } - } catch (e, stackTrace) { - AppLogger.e('Error analyzing colors', error: e, stackTrace: stackTrace); - if (mounted && context.mounted) { + } catch (error, stackTrace) { + AppLogger.e('Error analyzing colors', error: error, stackTrace: stackTrace); + if (context.mounted) { ScaffoldMessenger.of(context).showSnackBar( const SnackBar( content: Text('Failed to analyze colors. Please try again.'), diff --git a/pubspec.lock b/pubspec.lock index fd60565..00be374 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1371,5 +1371,5 @@ packages: source: hosted version: "2.0.3" sdks: - dart: ">=3.5.4 <4.0.0" + dart: ">=3.5.0 <4.0.0" flutter: ">=3.24.0" diff --git a/pubspec.yaml b/pubspec.yaml index 0d84cfd..d621de9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ^3.5.4 + sdk: ^3.3.4 # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions