Commit c07bd0bf authored by Administrator's avatar Administrator

physical quantity transition continued

parent 36845230
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_secure_storage","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.3/","dependencies":[]},{"name":"package_info","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.1/","dependencies":[]},{"name":"path_provider","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.11/","dependencies":[]},{"name":"shared_preferences","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.8/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.1/","dependencies":[]},{"name":"uni_links","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links-0.4.0/","dependencies":[]},{"name":"url_launcher","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.0/","dependencies":[]}],"android":[{"name":"flutter_secure_storage","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.3/","dependencies":[]},{"name":"package_info","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.1/","dependencies":[]},{"name":"path_provider","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.11/","dependencies":[]},{"name":"shared_preferences","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.8/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.1/","dependencies":[]},{"name":"uni_links","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links-0.4.0/","dependencies":[]},{"name":"url_launcher","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.0/","dependencies":[]}],"macos":[{"name":"package_info","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.1/","dependencies":[]},{"name":"path_provider_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+3/","dependencies":[]},{"name":"shared_preferences_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+10/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.1/","dependencies":[]},{"name":"url_launcher_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.0.1+7/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.0.1+2/","dependencies":[]},{"name":"shared_preferences_linux","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-0.0.2+1/","dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-0.0.1+1/","dependencies":[]}],"windows":[],"web":[{"name":"shared_preferences_web","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+7/","dependencies":[]},{"name":"url_launcher_web","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-0.1.2/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_secure_storage","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_linux","shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]},{"name":"uni_links","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_linux","url_launcher_macos"]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2020-08-14 16:28:14.075552","version":"1.20.1"}
\ No newline at end of file
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_secure_storage","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.3/","dependencies":[]},{"name":"package_info","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.1/","dependencies":[]},{"name":"path_provider","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.11/","dependencies":[]},{"name":"shared_preferences","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.8/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.1/","dependencies":[]},{"name":"uni_links","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links-0.4.0/","dependencies":[]},{"name":"url_launcher","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.0/","dependencies":[]}],"android":[{"name":"flutter_secure_storage","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.3/","dependencies":[]},{"name":"package_info","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.1/","dependencies":[]},{"name":"path_provider","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.11/","dependencies":[]},{"name":"shared_preferences","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.8/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.1/","dependencies":[]},{"name":"uni_links","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links-0.4.0/","dependencies":[]},{"name":"url_launcher","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.0/","dependencies":[]}],"macos":[{"name":"package_info","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.1/","dependencies":[]},{"name":"path_provider_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+3/","dependencies":[]},{"name":"shared_preferences_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+10/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.1/","dependencies":[]},{"name":"url_launcher_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.0.1+7/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.0.1+2/","dependencies":[]},{"name":"shared_preferences_linux","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-0.0.2+1/","dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-0.0.1+1/","dependencies":[]}],"windows":[],"web":[{"name":"shared_preferences_web","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+7/","dependencies":[]},{"name":"url_launcher_web","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-0.1.2/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_secure_storage","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_linux","shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]},{"name":"uni_links","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_linux","url_launcher_macos"]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2020-08-14 20:48:44.333112","version":"1.20.1"}
\ No newline at end of file
......@@ -53,6 +53,28 @@ class PQText extends StatelessWidget {
return Text(Duration(seconds: value as int).asString());
case PQ.trainingEffect:
return Text((value as int).toString());
case PQ.text:
return Text(value as String);
case PQ.temperature:
return Text((value as int).toString() + '°C');
case PQ.verticalOscillation:
return Text((value as double).toStringAsFixed(2) + ' cm');
case PQ.cycles:
return Text((value as double).toString() + ' cycles');
case PQ.integer:
return Text((value as int).toString());
case PQ.fractionalCadence:
return Text((value as double).toStringAsFixed(2));
case PQ.percentage:
return Text((value as double).toStringAsFixed(2) + ' %');
case PQ.stanceTime:
return Text((value as double).toStringAsFixed(2) + ' ms');
case PQ.longitude:
return Text((value as double).semicirclesAsDegrees() + ' E');
case PQ.latitude:
return Text((value as double).semicirclesAsDegrees() + ' N');
case PQ.speed:
return Text(((value as double) * 3.6).toStringAsFixed(2) + ' km/h / ');
}
return const Text('This is an error!'); // just to silence the dart analyzer
}
......@@ -82,22 +104,13 @@ class PQText extends StatelessWidget {
bool get validValue {
switch (pq) {
case PQ.trainingEffect:
case PQ.cadence:
case PQ.calories:
case PQ.dateTime:
case PQ.distance:
case PQ.duration:
case PQ.ecor:
case PQ.elevation:
case PQ.powerPerHeartRate:
return value != null;
case PQ.power:
case PQ.pace:
return value != null && value != -1;
case PQ.heartRate:
return value != null && value != 255;
default:
return value != null;
}
return false; // just to silence the dart analyzer
}
}
......@@ -58,4 +58,15 @@ enum PQ {
cadence,
duration,
trainingEffect,
text,
temperature,
verticalOscillation,
cycles,
integer,
fractionalCadence,
stanceTime,
percentage,
longitude,
latitude,
speed,
}
import 'package:encrateia/models/athlete.dart';
import 'package:encrateia/utils/PQText.dart';
import 'package:encrateia/utils/enums.dart';
import 'package:flutter/material.dart';
import 'package:encrateia/utils/date_time_utils.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:intl/intl.dart';
import 'package:encrateia/models/activity.dart';
class ActivityMetadataWidget extends StatelessWidget {
......@@ -18,103 +18,139 @@ class ActivityMetadataWidget extends StatelessWidget {
return <Widget>[
ListTile(title: Text(activity.name)),
ListTile(
title: Text(
DateFormat('dd MMM yyyy, h:mm:ss').format(activity.timeStamp)),
title: PQText(
value: activity.timeStamp,
pq: PQ.dateTime,
format: DateTimeFormat.longDateTime,
),
subtitle: const Text('timestamp'),
),
ListTile(
title: Text(activity.event),
title: PQText(value: activity.event, pq: PQ.text),
subtitle: const Text('last event'),
),
if (activity.totalStrides != null)
ListTile(
title: Text(activity.totalStrides.toString()),
subtitle: const Text('total strides'),
),
if (activity.maxRunningCadence != null)
ListTile(
title: Text('${activity.avgRunningCadence.round()} /'
' ${activity.maxRunningCadence}'),
subtitle: const Text('avg / max running cadence'),
),
ListTile(
title: Text(
'${activity.avgTemperature}° / ${activity.maxTemperature}°'),
title: PQText(value: activity.totalStrides, pq: PQ.text),
subtitle: const Text('total strides'),
),
ListTile(
title: Row(children: <Widget>[
PQText(value: activity.avgRunningCadence, pq: PQ.cadence),
const Text(' / '),
PQText(value: activity.maxRunningCadence, pq: PQ.cadence),
]),
subtitle: const Text('avg / max running cadence'),
),
ListTile(
title: Row(children: <Widget>[
PQText(value: activity.avgTemperature, pq: PQ.temperature),
const Text(' / '),
PQText(value: activity.maxTemperature, pq: PQ.temperature),
]),
subtitle: const Text('avg / max temperature'),
),
ListTile(
title: Text(activity.avgVerticalOscillation.toStringAsFixed(2)),
title: PQText(
value: activity.avgVerticalOscillation,
pq: PQ.verticalOscillation,
),
subtitle: const Text('avg vertical oscillation'),
),
ListTile(
title: Text(activity.totalFractionalCycles.toStringAsFixed(2)),
title: PQText(value: activity.totalFractionalCycles, pq: PQ.cycles),
subtitle: const Text('total fractional cycles'),
),
ListTile(
title: Text(Duration(seconds: activity.totalElapsedTime).asString()),
title: PQText(value: activity.totalElapsedTime, pq: PQ.duration),
subtitle: const Text('total elapsed time'),
),
ListTile(
title: Text(Duration(seconds: activity.totalTimerTime).asString()),
title: PQText(value: activity.totalTimerTime, pq: PQ.duration),
subtitle: const Text('total timer time'),
),
ListTile(
title: Text('${activity.stravaId} / ${activity.serialNumber}'),
title: Row(children: <Widget>[
PQText(value: activity.stravaId, pq: PQ.integer),
const Text(' / '),
PQText(value: activity.serialNumber, pq: PQ.integer),
]),
subtitle: const Text('Strava / Garmin id'),
),
ListTile(
title: Text(activity.type +
' / ' +
activity.sport +
' / ' +
activity.subSport),
title: Row(children: <Widget>[
PQText(value: activity.type, pq: PQ.text),
const Text(' / '),
PQText(value: activity.sport, pq: PQ.text),
const Text(' / '),
PQText(value: activity.subSport, pq: PQ.text),
]),
subtitle: const Text('activity type / sport / sub sport'),
),
ListTile(
title: Text(activity.eventType + ' / ' + activity.trigger),
title: Row(children: <Widget>[
PQText(value: activity.eventType, pq: PQ.text),
const Text(' / '),
PQText(value: activity.trigger, pq: PQ.text),
]),
subtitle: const Text('event type / trigger'),
),
ListTile(
title: Text('${activity.numLaps} / ${activity.numSessions}'),
title: Row(children: <Widget>[
PQText(value: activity.numLaps, pq: PQ.integer),
const Text(' / '),
PQText(value: activity.numSessions, pq: PQ.integer),
]),
subtitle: const Text('number of laps / sessions'),
),
ListTile(
title: Text(activity.avgFractionalCadence.toStringAsFixed(2) +
' / ' +
activity.maxFractionalCadence.toStringAsFixed(2)),
title: Row(children: <Widget>[
PQText(
value: activity.avgFractionalCadence,
pq: PQ.fractionalCadence,
),
const Text(' / '),
PQText(
value: activity.maxFractionalCadence,
pq: PQ.fractionalCadence,
),
]),
subtitle: const Text('avg / max fractional cadence'),
),
ListTile(
title: Text(
'${activity.avgStanceTime} ms / ${activity.avgStanceTimePercent} %'),
title: Row(children: <Widget>[
PQText(value: activity.avgStanceTime, pq: PQ.stanceTime),
const Text(' / '),
PQText(value: activity.avgStanceTimePercent, pq: PQ.percentage),
]),
subtitle: const Text('avg stance time / avg stance time percent'),
),
ListTile(
title: Text(activity.startPositionLong.semicirclesAsDegrees() +
' E\n' +
activity.startPositionLat.semicirclesAsDegrees() +
' N'),
title: Column(children: <Widget>[
PQText(value: activity.startPositionLong, pq: PQ.longitude),
PQText(value: activity.startPositionLat, pq: PQ.latitude),
]),
subtitle: const Text('start position'),
),
ListTile(
title: Text(activity.necLong.semicirclesAsDegrees() +
' E\n' +
activity.necLat.semicirclesAsDegrees() +
' N'),
title: Column(children: <Widget>[
PQText(value: activity.necLong, pq: PQ.longitude),
PQText(value: activity.necLat, pq: PQ.latitude),
]),
subtitle: const Text('north east corner'),
),
ListTile(
title: Text(activity.swcLong.semicirclesAsDegrees() +
' E\n' +
activity.swcLat.semicirclesAsDegrees() +
' N'),
title: Column(children: <Widget>[
PQText(value: activity.swcLong, pq: PQ.longitude),
PQText(value: activity.swcLat, pq: PQ.latitude),
]),
subtitle: const Text('south west corner'),
),
ListTile(
title: Text((activity.avgSpeed * 3.6).toStringAsFixed(2) +
' km/h / ' +
(activity.maxSpeed * 3.6).toStringAsFixed(2) +
' km/h'),
title: Row(children: <Widget>[
PQText(value: activity.avgSpeed, pq: PQ.speed),
const Text(' / '),
PQText(value: activity.maxSpeed, pq: PQ.speed),
]),
subtitle: const Text('avg / max speed'),
),
];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment