Commit e60d6fed authored by Administrator's avatar Administrator

allow empty activities to be diplayed and deleted

parent 50192c4f
{"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
{"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-17 15:08:22.337417","version":"1.20.1"}
\ No newline at end of file
......@@ -73,17 +73,18 @@ class _ShowActivityScreenState extends State<ShowActivityScreen> {
athlete: widget.athlete,
),
),
navigationButton(
title: 'Laps List',
color: MyColor.lap,
backgroundColor: MyColor.lap,
icon: MyIcon.laps,
context: context,
nextWidget: LapsListWidget(
activity: widget.activity,
athlete: widget.athlete,
if (widget.activity.cachedLaps.isNotEmpty)
navigationButton(
title: 'Laps List',
color: MyColor.lap,
backgroundColor: MyColor.lap,
icon: MyIcon.laps,
context: context,
nextWidget: LapsListWidget(
activity: widget.activity,
athlete: widget.athlete,
),
),
),
if (kDebugMode)
navigationButton(
title: 'Intervals',
......@@ -163,118 +164,129 @@ class _ShowActivityScreenState extends State<ShowActivityScreen> {
athlete: widget.athlete,
),
),
navigationButton(
title: 'Speed',
color: MyColor.navigate,
backgroundColor: MyColor.navigate,
icon: MyIcon.speed,
context: context,
nextWidget: ActivitySpeedWidget(
activity: widget.activity,
athlete: widget.athlete,
if (widget.activity.avgSpeed != null)
navigationButton(
title: 'Speed',
color: MyColor.navigate,
backgroundColor: MyColor.navigate,
icon: MyIcon.speed,
context: context,
nextWidget: ActivitySpeedWidget(
activity: widget.activity,
athlete: widget.athlete,
),
),
),
navigationButton(
title: 'Ecor',
color: MyColor.navigate,
icon: MyIcon.power,
context: context,
nextWidget: ActivityEcorWidget(
activity: widget.activity,
athlete: widget.athlete,
if (widget.activity.ecor != null)
navigationButton(
title: 'Ecor',
color: MyColor.navigate,
icon: MyIcon.power,
context: context,
nextWidget: ActivityEcorWidget(
activity: widget.activity,
athlete: widget.athlete,
),
),
),
navigationButton(
title: 'Speed / Heart Rate',
color: MyColor.navigate,
icon: MyIcon.speed,
context: context,
nextWidget: ActivitySpeedPerHeartRateWidget(
activity: widget.activity,
athlete: widget.athlete,
if (widget.activity.avgSpeed != null)
navigationButton(
title: 'Speed / Heart Rate',
color: MyColor.navigate,
icon: MyIcon.speed,
context: context,
nextWidget: ActivitySpeedPerHeartRateWidget(
activity: widget.activity,
athlete: widget.athlete,
),
),
),
navigationButton(
title: 'Ground Time',
color: MyColor.navigate,
icon: MyIcon.groundTime,
context: context,
nextWidget: ActivityGroundTimeWidget(
activity: widget.activity,
athlete: widget.athlete,
if (widget.activity.avgGroundTime != null)
navigationButton(
title: 'Ground Time',
color: MyColor.navigate,
icon: MyIcon.groundTime,
context: context,
nextWidget: ActivityGroundTimeWidget(
activity: widget.activity,
athlete: widget.athlete,
),
),
),
navigationButton(
title: 'Form Power',
color: MyColor.navigate,
icon: MyIcon.formPower,
context: context,
nextWidget: ActivityFormPowerWidget(
activity: widget.activity,
athlete: widget.athlete,
if (widget.activity.avgFormPower != null)
navigationButton(
title: 'Form Power',
color: MyColor.navigate,
icon: MyIcon.formPower,
context: context,
nextWidget: ActivityFormPowerWidget(
activity: widget.activity,
athlete: widget.athlete,
),
),
),
navigationButton(
title: 'Power Ratio',
color: MyColor.navigate,
icon: MyIcon.formPower,
context: context,
nextWidget: ActivityPowerRatioWidget(
activity: widget.activity,
athlete: widget.athlete,
if (widget.activity.avgPowerRatio != null)
navigationButton(
title: 'Power Ratio',
color: MyColor.navigate,
icon: MyIcon.formPower,
context: context,
nextWidget: ActivityPowerRatioWidget(
activity: widget.activity,
athlete: widget.athlete,
),
),
),
navigationButton(
title: 'Vertical Oscillation',
color: MyColor.navigate,
icon: MyIcon.verticalOscillation,
context: context,
nextWidget: ActivityVerticalOscillationWidget(
activity: widget.activity,
athlete: widget.athlete,
if (widget.activity.avgVerticalOscillation != null)
navigationButton(
title: 'Vertical Oscillation',
color: MyColor.navigate,
icon: MyIcon.verticalOscillation,
context: context,
nextWidget: ActivityVerticalOscillationWidget(
activity: widget.activity,
athlete: widget.athlete,
),
),
),
navigationButton(
title: 'Stride Ratio',
color: MyColor.navigate,
icon: MyIcon.strideRatio,
context: context,
nextWidget: ActivityStrideRatioWidget(
activity: widget.activity,
athlete: widget.athlete,
if (widget.activity.avgStrideRatio != null)
navigationButton(
title: 'Stride Ratio',
color: MyColor.navigate,
icon: MyIcon.strideRatio,
context: context,
nextWidget: ActivityStrideRatioWidget(
activity: widget.activity,
athlete: widget.athlete,
),
),
),
navigationButton(
title: 'Cadence',
color: MyColor.navigate,
icon: MyIcon.cadence,
context: context,
nextWidget: ActivityStrydCadenceWidget(
activity: widget.activity,
athlete: widget.athlete,
if (widget.activity.avgDoubleStrydCadence != null)
navigationButton(
title: 'Cadence',
color: MyColor.navigate,
icon: MyIcon.cadence,
context: context,
nextWidget: ActivityStrydCadenceWidget(
activity: widget.activity,
athlete: widget.athlete,
),
),
),
navigationButton(
title: 'Leg Spring Stiffness',
color: MyColor.navigate,
icon: MyIcon.legSpringStiffness,
context: context,
nextWidget: ActivityLegSpringStiffnessWidget(
activity: widget.activity,
athlete: widget.athlete,
if (widget.activity.avgLegSpringStiffness != null)
navigationButton(
title: 'Leg Spring Stiffness',
color: MyColor.navigate,
icon: MyIcon.legSpringStiffness,
context: context,
nextWidget: ActivityLegSpringStiffnessWidget(
activity: widget.activity,
athlete: widget.athlete,
),
),
),
navigationButton(
title: 'FTP',
color: MyColor.navigate,
icon: MyIcon.ftp,
context: context,
nextWidget: ActivityFtpWidget(
activity: widget.activity,
athlete: widget.athlete,
if (widget.activity.avgPower != null)
navigationButton(
title: 'FTP',
color: MyColor.navigate,
icon: MyIcon.ftp,
context: context,
nextWidget: ActivityFtpWidget(
activity: widget.activity,
athlete: widget.athlete,
),
),
),
if (kDebugMode)
if (kDebugMode && widget.activity.avgPower != null)
navigationButton(
title: 'Work / CP',
color: MyColor.navigate,
......@@ -359,6 +371,12 @@ class _ShowActivityScreenState extends State<ShowActivityScreen> {
];
}
@override
void initState() {
getData();
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
......@@ -495,4 +513,9 @@ class _ShowActivityScreenState extends State<ShowActivityScreen> {
}
setState(() {});
}
Future<void> getData() async {
await widget.activity.laps;
setState(() {});
}
}
......@@ -71,8 +71,10 @@ class PQText extends StatelessWidget {
return Text((value as double).semicirclesAsDegrees() + ' N');
case PQ.speed:
return Text(((value as double) * 3.6).toStringAsFixed(2) + ' km/h / ');
case PQ.speedPerHeartRate:
return Text((value as double).toStringAsFixed(1) + ' m/h / bpm');
}
return const Text('This is an error!'); // just to silence the dart analyzer
return const Text('the pq Parameter was not provided.'); // just to silence the dart analyzer
}
String get formatString {
......
......@@ -69,4 +69,5 @@ enum PQ {
longitude,
latitude,
speed,
speedPerHeartRate,
}
......@@ -59,12 +59,12 @@ class _ActivityAltitudeWidgetState extends State<ActivityAltitudeWidget> {
);
} else {
return const Center(
child: Text('No leg spring stiffness data available.'),
child: Text('No altitude data available.'),
);
}
} else {
return const Center(
child: Text('Loading'),
child: Text('Loading / no records found'),
);
}
}
......
......@@ -49,7 +49,7 @@ class _ActivityPathWidgetState extends State<ActivityPathWidget> {
}
} else {
return const Center(
child: Text('Loading'),
child: Text('Loading / no records found'),
);
}
}
......
import 'package:encrateia/models/athlete.dart';
import 'package:encrateia/models/record_list.dart';
import 'package:encrateia/utils/PQText.dart';
import 'package:encrateia/utils/enums.dart';
import 'package:encrateia/widgets/charts/activity_charts/activity_speed_per_heart_rate_chart.dart';
import 'package:flutter/material.dart';
import 'package:encrateia/models/activity.dart';
import 'package:encrateia/models/event.dart';
import 'package:encrateia/utils/num_utils.dart';
import 'package:encrateia/utils/icon_utils.dart';
class ActivitySpeedPerHeartRateWidget extends StatefulWidget {
......@@ -59,7 +60,7 @@ class _ActivitySpeedPerHeartRateWidgetState
const Divider(),
ListTile(
leading: MyIcon.average,
title: Text(avgSpeedPerHeartRateString),
title: PQText(value: widget.activity.avgSpeedPerHeartRate, pq: PQ.speedPerHeartRate, ),
subtitle: const Text('average speed per heart rate'),
),
],
......@@ -80,9 +81,6 @@ class _ActivitySpeedPerHeartRateWidgetState
Future<void> getData() async {
final Activity activity = widget.activity;
records = RecordList<Event>(await activity.records);
final double avg = 1000 * activity.avgSpeed / activity.avgHeartRate;
avgSpeedPerHeartRateString = avg.toStringOrDashes(1) + ' m/h / bpm';
setState(() {});
}
}
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