Skip to content

Commit 1c7b701

Browse files
committed
🐛(elevation): Fix first segment color & last point x position on graph
1 parent cc650e7 commit 1c7b701

File tree

10 files changed

+236
-131
lines changed

10 files changed

+236
-131
lines changed

.fvmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"flutter": "3.7.12"
3+
}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,6 @@ build/
7373
!**/ios/**/default.pbxuser
7474
!**/ios/**/default.perspectivev3
7575
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
76+
77+
# FVM Version Cache
78+
.fvm/

example/ios/Flutter/AppFrameworkInfo.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>9.0</string>
24+
<string>12.0</string>
2525
</dict>
2626
</plist>

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 46;
6+
objectVersion = 54;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -127,7 +127,7 @@
127127
97C146E61CF9000F007C117D /* Project object */ = {
128128
isa = PBXProject;
129129
attributes = {
130-
LastUpgradeCheck = 1020;
130+
LastUpgradeCheck = 1510;
131131
ORGANIZATIONNAME = "";
132132
TargetAttributes = {
133133
97C146ED1CF9000F007C117D = {
@@ -171,10 +171,12 @@
171171
/* Begin PBXShellScriptBuildPhase section */
172172
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
173173
isa = PBXShellScriptBuildPhase;
174+
alwaysOutOfDate = 1;
174175
buildActionMask = 2147483647;
175176
files = (
176177
);
177178
inputPaths = (
179+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
178180
);
179181
name = "Thin Binary";
180182
outputPaths = (
@@ -185,6 +187,7 @@
185187
};
186188
9740EEB61CF901F6004384FC /* Run Script */ = {
187189
isa = PBXShellScriptBuildPhase;
190+
alwaysOutOfDate = 1;
188191
buildActionMask = 2147483647;
189192
files = (
190193
);
@@ -272,7 +275,7 @@
272275
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
273276
GCC_WARN_UNUSED_FUNCTION = YES;
274277
GCC_WARN_UNUSED_VARIABLE = YES;
275-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
278+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
276279
MTL_ENABLE_DEBUG_INFO = NO;
277280
SDKROOT = iphoneos;
278281
SUPPORTED_PLATFORMS = iphoneos;
@@ -354,7 +357,7 @@
354357
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
355358
GCC_WARN_UNUSED_FUNCTION = YES;
356359
GCC_WARN_UNUSED_VARIABLE = YES;
357-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
360+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
358361
MTL_ENABLE_DEBUG_INFO = YES;
359362
ONLY_ACTIVE_ARCH = YES;
360363
SDKROOT = iphoneos;
@@ -403,7 +406,7 @@
403406
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
404407
GCC_WARN_UNUSED_FUNCTION = YES;
405408
GCC_WARN_UNUSED_VARIABLE = YES;
406-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
409+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
407410
MTL_ENABLE_DEBUG_INFO = NO;
408411
SDKROOT = iphoneos;
409412
SUPPORTED_PLATFORMS = iphoneos;

example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1020"
3+
LastUpgradeVersion = "1510"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

example/ios/Runner/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import UIKit
22
import Flutter
33

4-
@UIApplicationMain
4+
@main
55
@objc class AppDelegate: FlutterAppDelegate {
66
override func application(
77
_ application: UIApplication,

example/ios/Runner/Info.plist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,9 @@
4141
</array>
4242
<key>UIViewControllerBasedStatusBarAppearance</key>
4343
<false/>
44+
<key>CADisableMinimumFrameDurationOnPhone</key>
45+
<true/>
46+
<key>UIApplicationSupportsIndirectInputEvents</key>
47+
<true/>
4448
</dict>
4549
</plist>

example/lib/data.dart

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,48 @@
11
import 'package:map_elevation/map_elevation.dart';
22

3+
List<List<dynamic>> raw2 = [
4+
[7.47691, 43.92439, 874],
5+
[7.47388, 43.92348, 899],
6+
[7.47332, 43.92279, 899],
7+
[7.47151, 43.92254, 898],
8+
[7.47054, 43.92265, 891],
9+
[7.47087, 43.92391, 913],
10+
[7.47009, 43.92471, 909],
11+
[7.46861, 43.92407, 905],
12+
[7.46761, 43.92469, 929],
13+
[7.4661, 43.9208, 959],
14+
[7.46524, 43.91936, 986],
15+
[7.46423, 43.91864, 1011],
16+
[7.46418, 43.91777, 1038],
17+
[7.46283, 43.91703, 1076],
18+
[7.46219, 43.91722, 1079],
19+
[7.46227, 43.91686, 1087],
20+
[7.46125, 43.91704, 1088],
21+
[7.4614, 43.91669, 1092],
22+
[7.46235, 43.91617, 1113],
23+
[7.46501, 43.9162, 1130],
24+
[7.46898, 43.91774, 1130],
25+
[7.4676, 43.91459, 1237],
26+
[7.46884, 43.91723, 1147],
27+
[7.46882, 43.91869, 1092],
28+
[7.4701, 43.91833, 1071],
29+
[7.47016, 43.91895, 1026],
30+
[7.47107, 43.91912, 977],
31+
[7.4704, 43.91947, 981],
32+
[7.47168, 43.91979, 915],
33+
[7.46971, 43.92121, 892],
34+
[7.47194, 43.92121, 846],
35+
[7.47311, 43.92177, 837],
36+
[7.47446, 43.92157, 829],
37+
[7.47541, 43.92213, 841],
38+
[7.4765, 43.92221, 842],
39+
[7.47572, 43.92251, 851],
40+
[7.47659, 43.92273, 857],
41+
[7.47627, 43.92366, 873],
42+
[7.47435, 43.92279, 874],
43+
[7.47695, 43.92433, 920]
44+
];
45+
346
List<List<dynamic>> raw = [
447
[
548
5.58213,
@@ -1201,8 +1244,8 @@ List<List<dynamic>> raw = [
12011244
[5.38825, 45.17357, 208]
12021245
];
12031246

1204-
List<ElevationPoint> getPoints() {
1205-
List<ElevationPoint> list = raw.map((e) {
1247+
List<ElevationPoint> getPoints(List<List<dynamic>> data) {
1248+
List<ElevationPoint> list = data.map((e) {
12061249
return ElevationPoint(e[1], e[0], double.parse(e[2].toString()),
12071250
parameters: (e.length == 4) ? e[3] : [{}]);
12081251
}).toList();

example/lib/main.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'dart:collection';
2+
23
import 'package:flutter/material.dart';
34
import 'package:flutter_map/flutter_map.dart';
45
import 'package:latlong2/latlong.dart';
@@ -161,16 +162,18 @@ class _MyHomePageState extends State<MyHomePage> {
161162

162163
@override
163164
Widget build(BuildContext context) {
165+
final points = getPoints(raw);
166+
164167
//get legend second text
165168
List<String> secondLegendList = [];
166169
if (colorParameter != ParameterItems.elevation) {
167170
secondLegendList = getParameterDistributionPercentageString(
168-
points: getPoints(),
171+
points: points,
169172
parameter: colorParameter.value!,
170173
parameterValues: colorParameter.subTypes);
171174
} else {
172175
secondLegendList = getElevationDistributionPercentageString(
173-
points: getPoints(), subtypes: [-5, -7, -10, -15, 15]);
176+
points: points, subtypes: [-5, -7, -10, -15, 15]);
174177
}
175178

176179
return Scaffold(
@@ -195,7 +198,7 @@ class _MyHomePageState extends State<MyHomePage> {
195198
polylines: [
196199
Polyline(
197200
// An optional tag to distinguish polylines in callback
198-
points: getPoints(),
201+
points: points,
199202
color: Colors.red,
200203
strokeWidth: 3.0,
201204
),
@@ -247,15 +250,15 @@ class _MyHomePageState extends State<MyHomePage> {
247250
onNotification:
248251
(ElevationHoverNotification notification) {
249252
setState(() {
250-
hoverPoint = notification.position!;
253+
hoverPoint = notification.position;
251254
});
252255

253256
return true;
254257
},
255258
child: Elevation(
256259
totalDistance: 51000,
257260
parameterUsedToColor: colorParameter.value,
258-
getPoints(),
261+
points,
259262
color: Color(0xFF172033),
260263
parameterValuesAndColorsMap:
261264
colorParameter.colorValueMap)),

0 commit comments

Comments
 (0)