Skip to content

Commit 4117533

Browse files
committed
Upgrade of mobility_features packages
1 parent d9c66e2 commit 4117533

File tree

14 files changed

+470
-510
lines changed

14 files changed

+470
-510
lines changed

packages/mobility_features/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 6.1.0
2+
3+
* upgrade of stats package
4+
15
## 6.0.0
26

37
* using carp_serialization for JSON serialization resulting in a new JSON schema for serialization

packages/mobility_features/example/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ android {
2424
applicationId = "com.example.example"
2525
// You can update the following values to match your application needs.
2626
// For more information, see: https://flutter.dev/to/review-gradle-config.
27-
minSdk = 23
27+
minSdkVersion = flutter.minSdkVersion
2828
targetSdk = flutter.targetSdkVersion
2929
versionCode = flutter.versionCode
3030
versionName = flutter.versionName

packages/mobility_features/example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
6+
# distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
7+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip

packages/mobility_features/example/android/settings.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ pluginManagement {
1818

1919
plugins {
2020
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21-
id "com.android.application" version "7.3.0" apply false
22-
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
21+
id "com.android.application" version '8.10.1' apply false
22+
id "org.jetbrains.kotlin.android" version "2.1.0" apply false
2323
}
2424

2525
include ":app"

packages/mobility_features/example/lib/main.dart

Lines changed: 61 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
library mobility_app;
1+
library;
22

33
import 'dart:async';
44
import 'package:flutter/material.dart';
@@ -14,13 +14,10 @@ void main() => runApp(const MyApp());
1414

1515
Widget entry(String key, String value, Icon icon) {
1616
return Container(
17-
padding: const EdgeInsets.all(2),
18-
margin: const EdgeInsets.all(3),
19-
child: ListTile(
20-
leading: icon,
21-
title: Text(key),
22-
trailing: Text(value),
23-
));
17+
padding: const EdgeInsets.all(2),
18+
margin: const EdgeInsets.all(3),
19+
child: ListTile(leading: icon, title: Text(key), trailing: Text(value)),
20+
);
2421
}
2522

2623
String formatDate(DateTime date) => '${date.year}/${date.month}/${date.day}';
@@ -55,9 +52,7 @@ class MyApp extends StatelessWidget {
5552
Widget build(BuildContext context) {
5653
return MaterialApp(
5754
title: 'Mobility Features Example',
58-
theme: ThemeData(
59-
primarySwatch: Colors.blue,
60-
),
55+
theme: ThemeData(primarySwatch: Colors.blue),
6156
home: const HomePage(title: 'Mobility Features Example'),
6257
);
6358
}
@@ -123,16 +118,19 @@ class HomePageState extends State<HomePage> {
123118

124119
// map from [LocationDto] to [LocationSample]
125120
Stream<LocationSample> locationSampleStream = locationStream.map(
126-
(location) => LocationSample(
127-
GeoLocation(location.latitude, location.longitude),
128-
DateTime.now()));
121+
(location) => LocationSample(
122+
GeoLocation(location.latitude, location.longitude),
123+
DateTime.now(),
124+
),
125+
);
129126

130127
// provide the [MobilityFeatures] instance with the LocationSample stream
131128
await MobilityFeatures().startListening(locationSampleStream);
132129

133130
// start listening to incoming MobilityContext objects
134-
mobilitySubscription =
135-
MobilityFeatures().contextStream.listen(onMobilityContext);
131+
mobilitySubscription = MobilityFeatures().contextStream.listen(
132+
onMobilityContext,
133+
);
136134
}
137135

138136
Future<bool> isLocationAlwaysGranted() async {
@@ -204,55 +202,63 @@ class HomePageState extends State<HomePage> {
204202
children: <Widget>[
205203
entry("Stops", "${_mobilityContext.stops?.length}", stopIcon),
206204
entry("Moves", "${_mobilityContext.moves?.length}", moveIcon),
207-
entry("Significant Places",
208-
"${_mobilityContext.numberOfSignificantPlaces}", placeIcon),
209205
entry(
210-
"Home Stay",
211-
_mobilityContext.homeStay == null || _mobilityContext.homeStay! < 0
212-
? "?"
213-
: "${(_mobilityContext.homeStay! * 100).toStringAsFixed(1)}%",
214-
homeStayIcon),
206+
"Significant Places",
207+
"${_mobilityContext.numberOfSignificantPlaces}",
208+
placeIcon,
209+
),
210+
entry(
211+
"Home Stay",
212+
_mobilityContext.homeStay == null || _mobilityContext.homeStay! < 0
213+
? "?"
214+
: "${(_mobilityContext.homeStay! * 100).toStringAsFixed(1)}%",
215+
homeStayIcon,
216+
),
215217
entry(
216-
"Distance Traveled",
217-
"${(_mobilityContext.distanceTraveled! / 1000).toStringAsFixed(2)} km",
218-
distanceTraveledIcon),
218+
"Distance Traveled",
219+
"${(_mobilityContext.distanceTraveled! / 1000).toStringAsFixed(2)} km",
220+
distanceTraveledIcon,
221+
),
219222
entry(
220-
"Normalized Entropy",
221-
"${_mobilityContext.normalizedEntropy?.toStringAsFixed(2)}",
222-
entropyIcon),
223+
"Normalized Entropy",
224+
"${_mobilityContext.normalizedEntropy?.toStringAsFixed(2)}",
225+
entropyIcon,
226+
),
223227
entry(
224-
"Location Variance",
225-
"${(111.133 * _mobilityContext.locationVariance!).toStringAsFixed(5)} km",
226-
varianceIcon),
228+
"Location Variance",
229+
"${(111.133 * _mobilityContext.locationVariance!).toStringAsFixed(5)} km",
230+
varianceIcon,
231+
),
227232
],
228233
);
229234
}
230235

231236
List<Widget> get contentNoFeatures {
232237
return [
233238
Container(
234-
margin: const EdgeInsets.all(25),
235-
child: const Text(
236-
'Move around to start generating features',
237-
style: TextStyle(fontSize: 20),
238-
))
239+
margin: const EdgeInsets.all(25),
240+
child: const Text(
241+
'Move around to start generating features',
242+
style: TextStyle(fontSize: 20),
243+
),
244+
),
239245
];
240246
}
241247

242248
List<Widget> get contentFeaturesReady {
243249
return [
244250
Container(
245-
margin: const EdgeInsets.all(25),
246-
child: Column(children: [
247-
const Text(
248-
'Statistics for today,',
249-
style: TextStyle(fontSize: 20),
250-
),
251+
margin: const EdgeInsets.all(25),
252+
child: Column(
253+
children: [
254+
const Text('Statistics for today,', style: TextStyle(fontSize: 20)),
251255
Text(
252256
formatDate(_mobilityContext.date!),
253257
style: const TextStyle(fontSize: 20, color: Colors.blue),
254258
),
255-
])),
259+
],
260+
),
261+
),
256262
Expanded(child: featuresOverview),
257263
];
258264
}
@@ -274,16 +280,16 @@ class HomePageState extends State<HomePage> {
274280
}
275281

276282
Widget get navBar => BottomNavigationBar(
277-
onTap: onTabTapped,
278-
currentIndex: _currentIndex,
279-
type: BottomNavigationBarType.fixed,
280-
items: const [
281-
BottomNavigationBarItem(icon: featuresIcon, label: 'Features'),
282-
BottomNavigationBarItem(icon: stopIcon, label: 'Stops'),
283-
BottomNavigationBarItem(icon: placeIcon, label: 'Places'),
284-
BottomNavigationBarItem(icon: moveIcon, label: 'Moves')
285-
],
286-
);
283+
onTap: onTabTapped,
284+
currentIndex: _currentIndex,
285+
type: BottomNavigationBarType.fixed,
286+
items: const [
287+
BottomNavigationBarItem(icon: featuresIcon, label: 'Features'),
288+
BottomNavigationBarItem(icon: stopIcon, label: 'Stops'),
289+
BottomNavigationBarItem(icon: placeIcon, label: 'Places'),
290+
BottomNavigationBarItem(icon: moveIcon, label: 'Moves'),
291+
],
292+
);
287293

288294
@override
289295
Widget build(BuildContext context) {
@@ -312,10 +318,7 @@ class HomePageState extends State<HomePage> {
312318
];
313319

314320
return Scaffold(
315-
appBar: AppBar(
316-
backgroundColor: Colors.teal,
317-
title: Text(widget.title),
318-
),
321+
appBar: AppBar(backgroundColor: Colors.teal, title: Text(widget.title)),
319322
body: pages[_currentIndex],
320323
bottomNavigationBar: navBar,
321324
);

packages/mobility_features/example/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ description: An example app for the Mobility Features package.
33
publish_to: "none"
44

55
environment:
6-
sdk: ">=3.2.0 <4.0.0"
7-
flutter: ">=3.16.0"
6+
sdk: ">=3.8.0 <4.0.0"
7+
flutter: ">=3.19.0"
88

99
dependencies:
1010
flutter:
1111
sdk: flutter
1212
permission_handler: ^11.3.1
1313
carp_background_location: ^4.0.0
14-
14+
1515
mobility_features:
1616
path: ../
1717

0 commit comments

Comments
 (0)