Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
3 Schweinehunde
Encrateia
Commits
eca77bf4
Commit
eca77bf4
authored
May 14, 2020
by
Administrator
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ecor to activity overview
parent
0da2f8b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
17 deletions
+50
-17
lib/widgets/activity_widgets/activity_overview_widget.dart
lib/widgets/activity_widgets/activity_overview_widget.dart
+50
-17
No files found.
lib/widgets/activity_widgets/activity_overview_widget.dart
View file @
eca77bf4
import
'package:encrateia/models/athlete.dart'
;
import
'package:encrateia/models/weight.dart'
;
import
'package:encrateia/utils/enums.dart'
;
import
'package:flutter/material.dart'
;
import
'package:encrateia/utils/date_time_utils.dart'
;
import
'package:intl/intl.dart'
;
import
'package:encrateia/models/activity.dart'
;
import
'package:encrateia/utils/icon_utils.dart'
;
class
ActivityOverviewWidget
extends
State
less
Widget
{
class
ActivityOverviewWidget
extends
State
ful
Widget
{
final
Activity
activity
;
final
Athlete
athlete
;
...
...
@@ -14,6 +16,17 @@ class ActivityOverviewWidget extends StatelessWidget {
@required
this
.
athlete
,
});
@override
_ActivityOverviewWidgetState
createState
()
=>
_ActivityOverviewWidgetState
();
}
class
_ActivityOverviewWidgetState
extends
State
<
ActivityOverviewWidget
>
{
@override
void
initState
()
{
getData
();
super
.
initState
();
}
@override
Widget
build
(
context
)
{
return
ListTileTheme
(
...
...
@@ -23,72 +36,92 @@ class ActivityOverviewWidget extends StatelessWidget {
children:
<
Widget
>[
ListTile
(
leading:
MyIcon
.
time
,
title:
Text
(
Duration
(
seconds:
activity
.
db
.
movingTime
??
0
)
.
asString
()),
title:
Text
(
Duration
(
seconds:
widget
.
activity
.
db
.
movingTime
??
0
)
.
asString
()),
subtitle:
Text
(
'moving time'
),
),
ListTile
(
leading:
MyIcon
.
speed
,
title:
Text
(
activity
.
db
.
avgSpeed
.
toPace
()
+
title:
Text
(
widget
.
activity
.
db
.
avgSpeed
.
toPace
()
+
" / "
+
activity
.
db
.
maxSpeed
.
toPace
()),
widget
.
activity
.
db
.
maxSpeed
.
toPace
()),
subtitle:
Text
(
'avg / max pace'
),
),
ListTile
(
leading:
MyIcon
.
power
,
title:
Text
((
widget
.
activity
.
weight
!=
null
)
?
widget
.
activity
.
get
(
activityAttr:
ActivityAttr
.
ecor
)
.
toStringAsFixed
(
2
)
+
" W s/kg m"
:
"not available"
),
subtitle:
Text
(
'ecor'
),
),
ListTile
(
leading:
MyIcon
.
heartRate
,
title:
Text
(
"
${activity.db.avgHeartRate}
bpm /
${activity.db.maxHeartRate}
bpm"
),
"
${
widget.
activity.db.avgHeartRate}
bpm /
${
widget.
activity.db.maxHeartRate}
bpm"
),
subtitle:
Text
(
'avg / max heart rate'
),
),
ListTile
(
leading:
MyIcon
.
power
,
title:
Text
(
"
${activity.db.avgPower.toStringAsFixed(1)}
W"
),
title:
Text
(
"
${
widget.
activity.db.avgPower.toStringAsFixed(1)}
W"
),
subtitle:
Text
(
'avg power'
),
),
ListTile
(
leading:
MyIcon
.
power
,
title:
Text
(
"
${(activity.db.avgPower / activity.db.avgHeartRate).toStringAsFixed(2)}
W/bpm"
),
"
${(
widget.
activity.db.avgPower /
widget.
activity.db.avgHeartRate).toStringAsFixed(2)}
W/bpm"
),
subtitle:
Text
(
'power / heart rate'
),
),
ListTile
(
leading:
MyIcon
.
distance
,
title:
Text
(
'
${(
activity.db.distance / 1000).toStringAsFixed(2)}
km'
),
title:
Text
(
'
${(widget.
activity.db.distance / 1000).toStringAsFixed(2)}
km'
),
subtitle:
Text
(
'distance'
),
),
ListTile
(
leading:
MyIcon
.
calories
,
title:
Text
(
'
${activity.db.totalCalories}
kcal'
),
title:
Text
(
'
${
widget.
activity.db.totalCalories}
kcal'
),
subtitle:
Text
(
'total calories'
),
),
ListTile
(
leading:
MyIcon
.
timeStamp
,
title:
Text
(
DateFormat
(
"dd MMM yyyy, h:mm:ss"
)
.
format
(
activity
.
db
.
timeCreated
)),
.
format
(
widget
.
activity
.
db
.
timeCreated
)),
subtitle:
Text
(
'time created'
),
),
ListTile
(
leading:
MyIcon
.
climb
,
title:
Text
(
"
${activity.db.totalAscent}
m -
${activity.db.totalDescent}
m"
" =
${activity.db.totalAscent - activity.db.totalDescent}
m"
),
"
${
widget.
activity.db.totalAscent}
m -
${
widget.
activity.db.totalDescent}
m"
" =
${
widget.
activity.db.totalAscent -
widget.
activity.db.totalDescent}
m"
),
subtitle:
Text
(
'total ascent - descent = total climb'
),
),
ListTile
(
leading:
MyIcon
.
cadence
,
title:
Text
(
"
${(activity.db.avgRunningCadence ?? 0 * 2).round()}
spm / "
"
${activity.db.maxRunningCadence ?? 0 * 2}
spm"
),
"
${(
widget.
activity.db.avgRunningCadence ?? 0 * 2).round()}
spm / "
"
${
widget.
activity.db.maxRunningCadence ?? 0 * 2}
spm"
),
subtitle:
Text
(
'avg / max steps per minute'
),
),
ListTile
(
leading:
MyIcon
.
trainingEffect
,
title:
Text
(
activity
.
db
.
totalTrainingEffect
.
toString
()),
title:
Text
(
widget
.
activity
.
db
.
totalTrainingEffect
.
toString
()),
subtitle:
Text
(
'total training effect'
),
),
],
),
);
}
getData
()
async
{
var
weight
=
await
Weight
.
getBy
(
athletesId:
widget
.
athlete
.
db
.
id
,
date:
widget
.
activity
.
db
.
timeCreated
,
);
setState
(()
{
widget
.
activity
.
weight
=
weight
.
db
.
value
;
});
}
}
Stefan Haslinger
@informatom
mentioned in issue
#12 (closed)
·
May 14, 2020
mentioned in issue
#12 (closed)
mentioned in issue #12
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment