Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions .github/workflows/branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions example/lib/pages/circle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class _CirclePageState extends State<CirclePage> {
final _circlesRaw = <CircleMarker<HitValue>>[
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,
Expand All @@ -33,7 +33,7 @@ class _CirclePageState extends State<CirclePage> {
),
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,
Expand All @@ -46,7 +46,7 @@ class _CirclePageState extends State<CirclePage> {
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,
Expand Down
12 changes: 6 additions & 6 deletions example/lib/pages/polygon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class _PolygonPageState extends State<PolygonPage> {
.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,
Expand Down Expand Up @@ -180,7 +180,7 @@ class _PolygonPageState extends State<PolygonPage> {
.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,
Expand All @@ -199,8 +199,8 @@ class _PolygonPageState extends State<PolygonPage> {
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)',
Expand Down Expand Up @@ -246,8 +246,8 @@ class _PolygonPageState extends State<PolygonPage> {
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)',
Expand Down
4 changes: 2 additions & 2 deletions example/lib/pages/polygon_perf_stress.dart
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ class _PolygonPerfStressPageState extends State<PolygonPerfStressPage> {
(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),
),
Expand Down
8 changes: 4 additions & 4 deletions example/lib/pages/polyline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ class _PolylinePageState extends State<PolylinePage> {
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',
Expand All @@ -107,7 +107,7 @@ class _PolylinePageState extends State<PolylinePage> {
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',
Expand All @@ -125,7 +125,7 @@ class _PolylinePageState extends State<PolylinePage> {
spacingFactor: 3,
),
borderStrokeWidth: 8,
borderColor: Colors.blue.withOpacity(0.5),
borderColor: Colors.blue.withAlpha(128),
hitValue: (
title: 'Orange line',
subtitle: 'Dotted pattern',
Expand Down
2 changes: 1 addition & 1 deletion example/lib/widgets/first_start_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class FirstStartDialog extends StatelessWidget {
color: Theme.of(context)
.colorScheme
.inverseSurface
.withOpacity(0.5),
.withAlpha(128),
),
textAlign: TextAlign.right,
),
Expand Down
4 changes: 2 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion lib/src/layer/circle_layer/painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ base class CirclePainter<R extends Object>
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);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/layer/polygon_layer/painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ base class _PolygonPainter<R extends Object>
// 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();
}
Expand Down
4 changes: 2 additions & 2 deletions lib/src/layer/polyline_layer/painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ base class _PolylinePainter<R extends Object>
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;
Expand Down
8 changes: 4 additions & 4 deletions lib/src/layer/tile_layer/tile_bounds/tile_bounds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
);
}

Expand Down Expand Up @@ -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),
);
}

Expand Down
15 changes: 7 additions & 8 deletions lib/src/map/options/interaction.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/layer/circle_layer_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading