From 292a6cafeba621489b3a549959664d56605e0f5c Mon Sep 17 00:00:00 2001 From: Xennis Date: Fri, 7 Feb 2025 12:18:08 +0100 Subject: [PATCH 1/2] Update Flutter version in CI --- .github/workflows/flutter.yml | 2 +- README.md | 2 +- green_walking/lib/pages/download_map.dart | 2 +- green_walking/lib/pages/feedback.dart | 2 +- green_walking/lib/pages/offline_maps.dart | 2 +- green_walking/lib/widgets/user_consent_dialog.dart | 1 + 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/flutter.yml b/.github/workflows/flutter.yml index 619a80e..4b5b462 100644 --- a/.github/workflows/flutter.yml +++ b/.github/workflows/flutter.yml @@ -9,7 +9,7 @@ jobs: - name: Setup Flutter uses: subosito/flutter-action@v2 with: - flutter-version: '3.22.x' + flutter-version: '3.27.x' channel: 'stable' - name: Install dependencies run: flutter pub get diff --git a/README.md b/README.md index 33ab6a8..c487299 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Copy the Firebase config from https://console.firebase.google.com/project/ { body: Center( child: Column( children: [ - ButtonBar( + OverflowBar( alignment: MainAxisAlignment.center, children: [ ElevatedButton( diff --git a/green_walking/lib/pages/feedback.dart b/green_walking/lib/pages/feedback.dart index aebed60..9e96a80 100644 --- a/green_walking/lib/pages/feedback.dart +++ b/green_walking/lib/pages/feedback.dart @@ -31,7 +31,7 @@ class FeedbackPage extends StatelessWidget { ], ), ), - ButtonBar( + OverflowBar( alignment: MainAxisAlignment.center, children: [ ElevatedButton( diff --git a/green_walking/lib/pages/offline_maps.dart b/green_walking/lib/pages/offline_maps.dart index 8892ea6..18a5f0a 100644 --- a/green_walking/lib/pages/offline_maps.dart +++ b/green_walking/lib/pages/offline_maps.dart @@ -56,7 +56,7 @@ class _OfflineMapsPageState extends State { padding: const EdgeInsets.symmetric(horizontal: 10), child: Column( children: [ - ButtonBar( + OverflowBar( alignment: MainAxisAlignment.center, children: [ ElevatedButton( diff --git a/green_walking/lib/widgets/user_consent_dialog.dart b/green_walking/lib/widgets/user_consent_dialog.dart index d165c0b..0b9e30f 100644 --- a/green_walking/lib/widgets/user_consent_dialog.dart +++ b/green_walking/lib/widgets/user_consent_dialog.dart @@ -13,6 +13,7 @@ void enableCrashReportingOrConsent(BuildContext context) { // Privacy: Only enable if it is set to enabled. FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true); } else if (enabled == null) { + if (!context.mounted) return; showDialog(context: context, builder: (BuildContext context) => const UserConsentDialog()); } }); From 9bfe9092793bd4e3f3cd6047dbba011cfd065b3e Mon Sep 17 00:00:00 2001 From: Xennis Date: Fri, 7 Feb 2025 12:42:21 +0100 Subject: [PATCH 2/2] Remove deprecated Color.value usage https://github.com/flutter/flutter/issues/160184 --- green_walking/lib/library/color_ex.dart | 21 +++++++++++++++++++++ green_walking/lib/widgets/map_view.dart | 7 ++++--- 2 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 green_walking/lib/library/color_ex.dart diff --git a/green_walking/lib/library/color_ex.dart b/green_walking/lib/library/color_ex.dart new file mode 100644 index 0000000..aef6d51 --- /dev/null +++ b/green_walking/lib/library/color_ex.dart @@ -0,0 +1,21 @@ +import 'dart:ui'; + +/// This class is to supplement deprecated_member_use for value value converted RGBA into a 32 bit integer, but the SDK +/// doesn't provide a successor. +extension ColorEx on Color { + static int floatToInt8(double x) { + return (x * 255.0).round() & 0xff; + } + + /// A 32 bit value representing this color. + /// + /// The bits are assigned as follows: + /// + /// * Bits 24-31 are the alpha value. + /// * Bits 16-23 are the red value. + /// * Bits 8-15 are the green value. + /// * Bits 0-7 are the blue value. + int get toInt32 { + return floatToInt8(a) << 24 | floatToInt8(r) << 16 | floatToInt8(g) << 8 | floatToInt8(b) << 0; + } +} diff --git a/green_walking/lib/widgets/map_view.dart b/green_walking/lib/widgets/map_view.dart index d7c38f3..1e10fd2 100644 --- a/green_walking/lib/widgets/map_view.dart +++ b/green_walking/lib/widgets/map_view.dart @@ -3,6 +3,7 @@ import 'dart:developer' show log; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:green_walking/library/color_ex.dart'; import 'package:mapbox_maps_flutter/mapbox_maps_flutter.dart'; import 'package:wakelock_plus/wakelock_plus.dart'; @@ -87,7 +88,7 @@ class _MapViewState extends State { marginBottom: 48.0, marginLeft: 13.0, isMetricUnits: true, - primaryColor: Colors.blueGrey.value)); + primaryColor: Colors.blueGrey.toInt32)); _mapboxMap.annotations.createCircleAnnotationManager().then((value) { _circleAnnotationManager = value; }); @@ -221,10 +222,10 @@ class _MapViewState extends State { _circleAnnotationManager?.create(CircleAnnotationOptions( geometry: Point(coordinates: position), circleRadius: 12, - circleColor: const Color.fromRGBO(255, 192, 203, 1).value, + circleColor: const Color.fromRGBO(255, 192, 203, 1).toInt32, circleOpacity: 0.6, circleStrokeWidth: 2, - circleStrokeColor: const Color.fromRGBO(255, 192, 203, 1).value)); + circleStrokeColor: const Color.fromRGBO(255, 192, 203, 1).toInt32)); } void _displaySnackBar(String text) {