diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index c8d47d260..8c476f5e6 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -16,21 +16,14 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 - - name: Run Dart Package Analyser - uses: axel-op/dart-package-analyzer@v3 - id: analysis + - name: Setup Flutter + uses: subosito/flutter-action@v2 with: - githubToken: ${{ secrets.GITHUB_TOKEN }} - - name: Check Package Scores - env: - TOTAL: ${{ steps.analysis.outputs.total }} - TOTAL_MAX: ${{ steps.analysis.outputs.total_max }} - run: | - if (( $TOTAL < $TOTAL_MAX )) - then - echo Package score less than available score. Improve the score! - exit 1 - fi + cache: true + - name: Install pana + run: dart pub global activate pana + - name: Check package score + run: pana --exit-code-threshold 0 . analyse-code: name: "Analyse Code" diff --git a/example/lib/pages/circle.dart b/example/lib/pages/circle.dart index df5e10fa2..ee967cb78 100644 --- a/example/lib/pages/circle.dart +++ b/example/lib/pages/circle.dart @@ -24,7 +24,7 @@ class _CirclePageState extends State { final _circlesRaw = >[ CircleMarker( point: const LatLng(51.5, -0.09), - color: Colors.white.withOpacity(0.7), + color: Colors.white.withAlpha(178), borderColor: Colors.black, borderStrokeWidth: 2, useRadiusInMeter: false, @@ -33,7 +33,7 @@ class _CirclePageState extends State { ), CircleMarker( point: const LatLng(51.5, -0.09), - color: Colors.black.withOpacity(0.7), + color: Colors.black.withAlpha(178), borderColor: Colors.black, borderStrokeWidth: 2, useRadiusInMeter: false, @@ -46,7 +46,7 @@ class _CirclePageState extends State { CircleMarker( point: const LatLng(51.4937, -0.6638), // Dorney Lake is ~2km long - color: Colors.green.withOpacity(0.9), + color: Colors.green.withAlpha(229), borderColor: Colors.black, borderStrokeWidth: 2, useRadiusInMeter: true, diff --git a/example/lib/pages/polygon.dart b/example/lib/pages/polygon.dart index 98d50b3e4..02717514e 100644 --- a/example/lib/pages/polygon.dart +++ b/example/lib/pages/polygon.dart @@ -131,7 +131,7 @@ class _PolygonPageState extends State { .toList(), borderStrokeWidth: 4, borderColor: Colors.orange, - color: Colors.orange.withOpacity(0.5), + color: Colors.orange.withAlpha(128), label: 'This one is not\nperformantly rendered', rotateLabel: true, labelPlacement: PolygonLabelPlacement.centroid, @@ -180,7 +180,7 @@ class _PolygonPageState extends State { .toList(), borderStrokeWidth: 4, borderColor: Colors.orange, - color: Colors.orange.withOpacity(0.5), + color: Colors.orange.withAlpha(128), label: 'This one is not\nperformantly rendered', rotateLabel: true, labelPlacement: PolygonLabelPlacement.centroid, @@ -199,8 +199,8 @@ class _PolygonPageState extends State { LatLng(61.858129, 0.952652) ], holePointsList: [], - color: Colors.lightGreen.withOpacity(0.5), - borderColor: Colors.lightGreen.withOpacity(0.5), + color: Colors.lightGreen.withAlpha(128), + borderColor: Colors.lightGreen.withAlpha(128), borderStrokeWidth: 10, hitValue: ( title: 'Testing opacity treatment (small)', @@ -246,8 +246,8 @@ class _PolygonPageState extends State { LatLng(61.858881, 0.947234) ] ], - color: Colors.lightGreen.withOpacity(0.5), - borderColor: Colors.lightGreen.withOpacity(0.5), + color: Colors.lightGreen.withAlpha(128), + borderColor: Colors.lightGreen.withAlpha(128), borderStrokeWidth: 10, hitValue: ( title: 'Testing opacity treatment (large)', diff --git a/example/lib/pages/polygon_perf_stress.dart b/example/lib/pages/polygon_perf_stress.dart index d6997da9d..11e10290c 100644 --- a/example/lib/pages/polygon_perf_stress.dart +++ b/example/lib/pages/polygon_perf_stress.dart @@ -229,8 +229,8 @@ class _PolygonPerfStressPageState extends State { (geoJson) => compute( (msg) => GeoJsonParser( defaultPolygonBorderStroke: msg.borderThickness, - defaultPolygonBorderColor: Colors.black.withOpacity(0.5), - defaultPolygonFillColor: Colors.orange[700]!.withOpacity(0.75), + defaultPolygonBorderColor: Colors.black.withAlpha(128), + defaultPolygonFillColor: Colors.orange[700]!.withAlpha(191), )..parseGeoJsonAsString(msg.geoJson), (geoJson: geoJson, borderThickness: borderThickness), ), diff --git a/example/lib/pages/polyline.dart b/example/lib/pages/polyline.dart index 499481017..94b38ba26 100644 --- a/example/lib/pages/polyline.dart +++ b/example/lib/pages/polyline.dart @@ -90,9 +90,9 @@ class _PolylinePageState extends State { LatLng(53.8566, 2.3522), ], strokeWidth: 20, - color: Colors.blue.withOpacity(0.6), + color: Colors.blue.withAlpha(153), borderStrokeWidth: 20, - borderColor: Colors.red.withOpacity(0.4), + borderColor: Colors.red.withAlpha(102), hitValue: ( title: 'Bordered Line', subtitle: 'Solid translucent color fill, with different color outline', @@ -107,7 +107,7 @@ class _PolylinePageState extends State { strokeWidth: 10, color: Colors.yellow, borderStrokeWidth: 10, - borderColor: Colors.blue.withOpacity(0.5), + borderColor: Colors.blue.withAlpha(128), hitValue: ( title: 'BorderedLine 2', subtitle: 'Solid translucent color fill, with different color outline', @@ -125,7 +125,7 @@ class _PolylinePageState extends State { spacingFactor: 3, ), borderStrokeWidth: 8, - borderColor: Colors.blue.withOpacity(0.5), + borderColor: Colors.blue.withAlpha(128), hitValue: ( title: 'Orange line', subtitle: 'Dotted pattern', diff --git a/example/lib/widgets/first_start_dialog.dart b/example/lib/widgets/first_start_dialog.dart index 7031bb4f2..125ae315f 100644 --- a/example/lib/widgets/first_start_dialog.dart +++ b/example/lib/widgets/first_start_dialog.dart @@ -42,7 +42,7 @@ class FirstStartDialog extends StatelessWidget { color: Theme.of(context) .colorScheme .inverseSurface - .withOpacity(0.5), + .withAlpha(128), ), textAlign: TextAlign.right, ), diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 6fc340d43..6f71b076c 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -4,8 +4,8 @@ publish_to: "none" version: 7.0.1 environment: - sdk: ">=3.0.0 <4.0.0" - flutter: ">=3.10.0" + sdk: ">=3.6.0 <4.0.0" + flutter: ">=3.27.0" dependencies: flutter: diff --git a/lib/src/layer/circle_layer/painter.dart b/lib/src/layer/circle_layer/painter.dart index a87bc8fd5..10d593e59 100644 --- a/lib/src/layer/circle_layer/painter.dart +++ b/lib/src/layer/circle_layer/painter.dart @@ -64,7 +64,7 @@ base class CirclePainter if (circle.borderStrokeWidth > 0) { // Check if color have some transparency or not // As drawPoints is more efficient than drawCircle - if (circle.color.alpha == 0xFF) { + if (circle.color.a == 1) { double radiusBorder = circle.radius + circle.borderStrokeWidth; if (circle.useRadiusInMeter) { final rBorder = _distance.offset(circle.point, radiusBorder, 180); diff --git a/lib/src/layer/polygon_layer/painter.dart b/lib/src/layer/polygon_layer/painter.dart index 22cfc2f35..dcb3be900 100644 --- a/lib/src/layer/polygon_layer/painter.dart +++ b/lib/src/layer/polygon_layer/painter.dart @@ -238,7 +238,7 @@ base class _PolygonPainter // mixed properly. Otherwise, holes get cut, or colors aren't mixed, // depending on the holes handler. final hash = polygon.renderHashCode; - final opacity = polygon.color?.opacity ?? 0; + final opacity = polygon.color?.a ?? 0; if (lastHash != hash || (checkOpacity && opacity > 0 && opacity < 1)) { drawPaths(); } diff --git a/lib/src/layer/polyline_layer/painter.dart b/lib/src/layer/polyline_layer/painter.dart index 44bf498b0..c78023bb2 100644 --- a/lib/src/layer/polyline_layer/painter.dart +++ b/lib/src/layer/polyline_layer/painter.dart @@ -126,8 +126,8 @@ base class _PolylinePainter drawPaths(); } lastHash = hash; - needsLayerSaving = polyline.color.opacity < 1.0 || - (polyline.gradientColors?.any((c) => c.opacity < 1.0) ?? false); + needsLayerSaving = polyline.color.a < 1 || + (polyline.gradientColors?.any((c) => c.a < 1) ?? false); // strokeWidth, or strokeWidth + borderWidth if relevant. late double largestStrokeWidth; diff --git a/lib/src/layer/tile_layer/tile_bounds/tile_bounds.dart b/lib/src/layer/tile_layer/tile_bounds/tile_bounds.dart index 4f116536e..9c963068c 100644 --- a/lib/src/layer/tile_layer/tile_bounds/tile_bounds.dart +++ b/lib/src/layer/tile_layer/tile_bounds/tile_bounds.dart @@ -93,8 +93,8 @@ class DiscreteTileBounds extends TileBounds { pixelBounds = crs.getProjectedBounds(zoomDouble)!; } else { pixelBounds = Rect.fromPoints( - crs.latLngToOffset(_latLngBounds!.southWest, zoomDouble), - crs.latLngToOffset(_latLngBounds!.northEast, zoomDouble), + crs.latLngToOffset(_latLngBounds.southWest, zoomDouble), + crs.latLngToOffset(_latLngBounds.northEast, zoomDouble), ); } @@ -133,8 +133,8 @@ class WrappedTileBounds extends TileBounds { pixelBounds = crs.getProjectedBounds(zoomDouble)!; } else { pixelBounds = Rect.fromPoints( - crs.latLngToOffset(_latLngBounds!.southWest, zoomDouble), - crs.latLngToOffset(_latLngBounds!.northEast, zoomDouble), + crs.latLngToOffset(_latLngBounds.southWest, zoomDouble), + crs.latLngToOffset(_latLngBounds.northEast, zoomDouble), ); } diff --git a/lib/src/map/options/interaction.dart b/lib/src/map/options/interaction.dart index f80038091..3233fb660 100644 --- a/lib/src/map/options/interaction.dart +++ b/lib/src/map/options/interaction.dart @@ -22,9 +22,8 @@ final class InteractionOptions { /// [rotationThreshold] has been achieved or another multi finger gesture wins /// which allows [MultiFingerGesture.rotate]. /// - /// Note: if [MapOptions.interactiveFlags.flags] doesn't contain - /// [InteractiveFlag.rotate] or [enableMultiFingerGestureRace] - /// is false then rotate cannot win. + /// Note: if [flags] doesn't contain [InteractiveFlag.rotate] or + /// [enableMultiFingerGestureRace] is false then rotate cannot win. final double rotationThreshold; /// When [rotationThreshold] wins over [pinchZoomThreshold] and @@ -35,10 +34,10 @@ final class InteractionOptions { /// Pinch Zoom threshold default is 0.5 Map starts to zoom when /// [pinchZoomThreshold] has been achieved or another multi finger gesture - /// wins which allows [MultiFingerGesture.pinchZoom] Note: if - /// [MapOptions.interactiveFlags.flags] doesn't contain - /// [InteractiveFlag.pinchZoom] or [enableMultiFingerGestureRace] is false - /// then zoom cannot win. + /// wins which allows [MultiFingerGesture.pinchZoom] + /// + /// Note: if [flags] doesn't contain [InteractiveFlag.pinchZoom] or + /// [enableMultiFingerGestureRace] is false then zoom cannot win. final double pinchZoomThreshold; /// When [pinchZoomThreshold] wins over [rotationThreshold] and @@ -52,7 +51,7 @@ final class InteractionOptions { /// another multi finger gesture wins which allows /// [MultiFingerGesture.pinchMove]. /// - /// Note: if [MapOptions.interactiveFlags.flags] doesn't contain + /// Note: if [flags] doesn't contain /// [InteractiveFlag.pinchMove] or [enableMultiFingerGestureRace] is false /// then pinch move cannot win final double pinchMoveThreshold; diff --git a/pubspec.yaml b/pubspec.yaml index f79b21829..dc1bba10f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -22,8 +22,8 @@ platforms: windows: environment: - sdk: ">=3.0.0 <4.0.0" - flutter: ">=3.10.0" + sdk: ">=3.6.0 <4.0.0" + flutter: ">=3.27.0" dependencies: async: ^2.11.0 diff --git a/test/layer/circle_layer_test.dart b/test/layer/circle_layer_test.dart index 1b183781d..a8cdb5cf7 100644 --- a/test/layer/circle_layer_test.dart +++ b/test/layer/circle_layer_test.dart @@ -13,7 +13,7 @@ void main() { CircleMarker( key: key, point: const LatLng(51.5, -0.09), - color: Colors.blue.withOpacity(0.7), + color: Colors.blue.withAlpha(178), borderStrokeWidth: 2, useRadiusInMeter: true, radius: 2000,