Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: use lower camel case for enum fields and consts #415

Merged
merged 8 commits into from
Jun 2, 2024
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## UNRELEASED

### Breaking changes

* All Dart enums have been migrated from mixed cases to lower camelcase according to the `camel_case_types` lint rule.

## 0.19.0

This is the first version where all packages are published on pub.dev. Please
Expand Down
1 change: 0 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ analyzer:

linter:
rules:
camel_case_types: false
constant_identifier_names: false
8 changes: 4 additions & 4 deletions example/lib/attribution.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ class _AttributionBodyState extends State<AttributionBody> {
children: [
buildDefaultPositionButton(),
buildPositionButton(null),
buildPositionButton(AttributionButtonPosition.TopRight),
buildPositionButton(AttributionButtonPosition.TopLeft),
buildPositionButton(AttributionButtonPosition.BottomRight),
buildPositionButton(AttributionButtonPosition.BottomLeft),
buildPositionButton(AttributionButtonPosition.topRight),
buildPositionButton(AttributionButtonPosition.topLeft),
buildPositionButton(AttributionButtonPosition.bottomRight),
buildPositionButton(AttributionButtonPosition.bottomLeft),
],
),
Expanded(
Expand Down
6 changes: 3 additions & 3 deletions example/lib/map_ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class MapUiBodyState extends State<MapUiBody> {
bool _myLocationEnabled = true;
bool _telemetryEnabled = true;
bool _countriesVisible = true;
MyLocationTrackingMode _myLocationTrackingMode = MyLocationTrackingMode.None;
MyLocationTrackingMode _myLocationTrackingMode = MyLocationTrackingMode.none;
List<Object>? _featureQueryFilter;
Fill? _selectedFill;

Expand Down Expand Up @@ -361,7 +361,7 @@ class MapUiBodyState extends State<MapUiBody> {
doubleClickZoomEnabled: _doubleClickToZoomEnabled,
myLocationEnabled: _myLocationEnabled,
myLocationTrackingMode: _myLocationTrackingMode,
myLocationRenderMode: MyLocationRenderMode.GPS,
myLocationRenderMode: MyLocationRenderMode.gps,
onMapClick: (point, latLng) async {
debugPrint(
"Map click: ${point.x},${point.y} ${latLng.latitude}/${latLng.longitude}");
Expand Down Expand Up @@ -402,7 +402,7 @@ class MapUiBodyState extends State<MapUiBody> {
},
onCameraTrackingDismissed: () {
setState(() {
_myLocationTrackingMode = MyLocationTrackingMode.None;
_myLocationTrackingMode = MyLocationTrackingMode.none;
});
},
onUserLocationUpdated: (location) {
Expand Down
4 changes: 2 additions & 2 deletions example/lib/sources.dart
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ class FullMapState extends State<FullMap> {
final _stylesAndLoaders = [
const StyleInfo(
name: "Vector",
baseStyle: MaplibreStyles.DEMO,
baseStyle: MaplibreStyles.demo,
addDetails: addVector,
position: CameraPosition(target: LatLng(33.3832, -118.4333), zoom: 6),
),
Expand All @@ -270,7 +270,7 @@ class FullMapState extends State<FullMap> {
),
const StyleInfo(
name: "Geojson cluster",
baseStyle: MaplibreStyles.DEMO,
baseStyle: MaplibreStyles.demo,
addDetails: addGeojsonCluster,
position: CameraPosition(target: LatLng(33.5, -118.1), zoom: 5),
),
Expand Down
10 changes: 5 additions & 5 deletions lib/src/maplibre_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ class MaplibreMap extends StatefulWidget {
this.dragEnabled = true,
this.trackCameraPosition = false,
this.myLocationEnabled = false,
this.myLocationTrackingMode = MyLocationTrackingMode.None,
this.myLocationRenderMode = MyLocationRenderMode.NORMAL,
this.myLocationTrackingMode = MyLocationTrackingMode.none,
this.myLocationRenderMode = MyLocationRenderMode.normal,
this.logoViewMargins,
this.compassViewPosition,
this.compassViewMargins,
this.attributionButtonPosition = AttributionButtonPosition.BottomRight,
this.attributionButtonPosition = AttributionButtonPosition.bottomRight,
this.attributionButtonMargins,
this.iosLongClickDuration,
this.onMapClick,
Expand All @@ -57,7 +57,7 @@ class MaplibreMap extends StatefulWidget {
AnnotationType.circle,
],
}) : assert(
myLocationRenderMode != MyLocationRenderMode.NORMAL
myLocationRenderMode != MyLocationRenderMode.normal
? myLocationEnabled
: true,
"$myLocationRenderMode requires [myLocationEnabled] set to true.",
Expand Down Expand Up @@ -176,7 +176,7 @@ class MaplibreMap extends StatefulWidget {

/// Specifies if and how the user's heading/bearing is rendered in the user location indicator.
/// See the documentation of [MyLocationRenderMode] for details.
/// If this is set to a value other than [MyLocationRenderMode.NORMAL], [myLocationEnabled] needs to be true.
/// If this is set to a value other than [MyLocationRenderMode.normal], [myLocationEnabled] needs to be true.
final MyLocationRenderMode myLocationRenderMode;

/// Set the layout margins for the Logo
Expand Down
32 changes: 16 additions & 16 deletions maplibre_gl_platform_interface/lib/src/ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,43 @@ part of '../maplibre_gl_platform_interface.dart';

class MaplibreStyles {
/// A very simple MapLibre demo style
static const String DEMO = "https://demotiles.maplibre.org/style.json";
static const String demo = "https://demotiles.maplibre.org/style.json";
}

/// The camera mode, which determines how the map camera will track the rendered location.
enum MyLocationTrackingMode {
None,
Tracking,
TrackingCompass,
TrackingGPS,
none,
tracking,
trackingCompass,
trackingGps,
}

/// Specifies if and how the user's heading/bearing is rendered in the user location indicator.
enum MyLocationRenderMode {
/// Do not show the user's heading/bearing.
NORMAL,
normal,

/// Show the user's heading/bearing as determined by the device's compass. On iOS, this causes the user's location to be shown on the map.
COMPASS,
compass,

/// Show the user's heading/bearing as determined by the device's GPS sensor. Not supported on iOS.
GPS,
gps,
}

/// Compass View Position
enum CompassViewPosition {
TopLeft,
TopRight,
BottomLeft,
BottomRight,
topLeft,
topRight,
bottomLeft,
bottomRight,
}

/// Attribution Button Position
enum AttributionButtonPosition {
TopLeft,
TopRight,
BottomLeft,
BottomRight,
topLeft,
topRight,
bottomLeft,
bottomRight,
}

/// Bounds for the map camera target.
Expand Down
2 changes: 1 addition & 1 deletion maplibre_gl_web/lib/src/convert.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Convert {
.values[options['attributionButtonPosition']];
sink.setAttributionButtonAlignment(position);
} else {
sink.setAttributionButtonAlignment(AttributionButtonPosition.BottomRight);
sink.setAttributionButtonAlignment(AttributionButtonPosition.bottomRight);
}
if (options.containsKey('attributionButtonMargins')) {
sink.setAttributionButtonMargins(options['attributionButtonMargins'][0],
Expand Down
20 changes: 10 additions & 10 deletions maplibre_gl_web/lib/src/maplibre_web_gl_platform.dart
Original file line number Diff line number Diff line change
Expand Up @@ -477,9 +477,9 @@ class MaplibreMapController extends MapLibreGlPlatform

void _onCameraTrackingChanged(bool isTracking) {
if (isTracking) {
onCameraTrackingChangedPlatform(MyLocationTrackingMode.Tracking);
onCameraTrackingChangedPlatform(MyLocationTrackingMode.tracking);
} else {
onCameraTrackingChangedPlatform(MyLocationTrackingMode.None);
onCameraTrackingChangedPlatform(MyLocationTrackingMode.none);
}
}

Expand Down Expand Up @@ -538,16 +538,16 @@ class MaplibreMapController extends MapLibreGlPlatform

String? positionString;
switch (position) {
case CompassViewPosition.TopRight:
case CompassViewPosition.topRight:
positionString = 'top-right';
break;
case CompassViewPosition.TopLeft:
case CompassViewPosition.topLeft:
positionString = 'top-left';
break;
case CompassViewPosition.BottomRight:
case CompassViewPosition.bottomRight:
positionString = 'bottom-right';
break;
case CompassViewPosition.BottomLeft:
case CompassViewPosition.bottomLeft:
positionString = 'bottom-left';
break;
default:
Expand Down Expand Up @@ -584,16 +584,16 @@ class MaplibreMapController extends MapLibreGlPlatform
) {
String? positionString;
switch (position) {
case AttributionButtonPosition.TopRight:
case AttributionButtonPosition.topRight:
positionString = 'top-right';
break;
case AttributionButtonPosition.TopLeft:
case AttributionButtonPosition.topLeft:
positionString = 'top-left';
break;
case AttributionButtonPosition.BottomRight:
case AttributionButtonPosition.bottomRight:
positionString = 'bottom-right';
break;
case AttributionButtonPosition.BottomLeft:
case AttributionButtonPosition.bottomLeft:
positionString = 'bottom-left';
break;
}
Expand Down