Commit 1ad66f50 authored by Administrator's avatar Administrator

fix more linter warnings

parent 4b93822b
......@@ -345,8 +345,7 @@ class _ShowAthleteScreenState extends State<ShowAthleteScreen> {
activities = await Activity.all(athlete: widget.athlete);
final Iterable<Activity> newActivities =
activities.where((Activity activity) => activity.db.state == 'new');
// ignore: prefer_final_in_for_each
for (Activity activity in newActivities) {
for (final Activity activity in newActivities) {
await download(activity: activity);
}
......
......@@ -8,23 +8,23 @@ import 'package:encrateia/widgets/charts/activity_charts/activity_ground_time_ch
import 'package:encrateia/utils/icon_utils.dart';
class ActivityGroundTimeWidget extends StatefulWidget {
final Activity activity;
final Athlete athlete;
ActivityGroundTimeWidget({
const ActivityGroundTimeWidget({
@required this.activity,
@required this.athlete,
});
final Activity activity;
final Athlete athlete;
@override
_ActivityGroundTimeWidgetState createState() =>
_ActivityGroundTimeWidgetState();
}
class _ActivityGroundTimeWidgetState extends State<ActivityGroundTimeWidget> {
var records = RecordList(<Event>[]);
String avgGroundTimeString = "Loading ...";
String sdevGroundTimeString = "Loading ...";
RecordList<Event> records = RecordList<Event>(<Event>[]);
String avgGroundTimeString = 'Loading ...';
String sdevGroundTimeString = 'Loading ...';
@override
void initState() {
......@@ -33,66 +33,66 @@ class _ActivityGroundTimeWidgetState extends State<ActivityGroundTimeWidget> {
}
@override
Widget build(context) {
if (records.length > 0) {
var groundTimeRecords = records
.where(
(value) => value.db.groundTime != null && value.db.groundTime > 0)
Widget build(BuildContext context) {
if (records.isNotEmpty) {
final List<Event> groundTimeRecords = records
.where((Event value) =>
value.db.groundTime != null && value.db.groundTime > 0)
.toList();
if (groundTimeRecords.length > 0) {
if (groundTimeRecords.isNotEmpty) {
return ListTileTheme(
iconColor: Colors.deepOrange,
child: ListView(
padding: EdgeInsets.only(left: 25),
padding: const EdgeInsets.only(left: 25),
children: <Widget>[
ActivityGroundTimeChart(
records: RecordList(groundTimeRecords),
records: RecordList<Event>(groundTimeRecords),
activity: widget.activity,
athlete: widget.athlete,
),
Text('${widget.athlete.db.recordAggregationCount} records are '
'aggregated into one point in the plot. Only records where '
'ground time > 0 ms are shown.'),
Divider(),
const Divider(),
ListTile(
leading: MyIcon.average,
title: Text(avgGroundTimeString),
subtitle: Text("average ground time"),
subtitle: const Text('average ground time'),
),
ListTile(
leading: MyIcon.standardDeviation,
title: Text(sdevGroundTimeString),
subtitle: Text("standard deviation ground time"),
subtitle: const Text('standard deviation ground time'),
),
ListTile(
leading: MyIcon.amount,
title: Text(groundTimeRecords.length.toString()),
subtitle: Text("number of measurements"),
subtitle: const Text('number of measurements'),
),
],
),
);
} else {
return Center(
child: Text("No ground time data available."),
return const Center(
child: Text('No ground time data available.'),
);
}
} else {
return Center(
child: Text("Loading"),
return const Center(
child: Text('Loading'),
);
}
}
getData() async {
Activity activity = widget.activity;
records = RecordList(await activity.records);
Future<void> getData() async {
final Activity activity = widget.activity;
records = RecordList<Event>(await activity.records);
avgGroundTimeString = activity.db.avgGroundTime != null
? activity.db.avgGroundTime.toStringOrDashes(1) + " ms"
: "- - -";
? activity.db.avgGroundTime.toStringOrDashes(1) + ' ms'
: '- - -';
sdevGroundTimeString =
activity.db.sdevGroundTime.toStringOrDashes(2) + " ms";
activity.db.sdevGroundTime.toStringOrDashes(2) + ' ms';
setState(() {});
}
}
......@@ -8,23 +8,23 @@ import 'package:encrateia/widgets/charts/activity_charts/activity_stride_ratio_c
import 'package:encrateia/utils/icon_utils.dart';
class ActivityStrideRatioWidget extends StatefulWidget {
final Activity activity;
final Athlete athlete;
ActivityStrideRatioWidget({
const ActivityStrideRatioWidget({
@required this.activity,
@required this.athlete,
});
final Activity activity;
final Athlete athlete;
@override
_ActivityStrideRatioWidgetState createState() =>
_ActivityStrideRatioWidgetState();
}
class _ActivityStrideRatioWidgetState extends State<ActivityStrideRatioWidget> {
var records = RecordList(<Event>[]);
String avgStrideRatioString = "Loading ...";
String sdevStrideRatioString = "Loading ...";
RecordList<Event> records = RecordList<Event>(<Event>[]);
String avgStrideRatioString = 'Loading ...';
String sdevStrideRatioString = 'Loading ...';
@override
void initState() {
......@@ -33,67 +33,67 @@ class _ActivityStrideRatioWidgetState extends State<ActivityStrideRatioWidget> {
}
@override
Widget build(context) {
if (records.length > 0) {
var strideRatioRecords = records
.where((value) =>
Widget build(BuildContext context) {
if (records.isNotEmpty) {
final List<Event> strideRatioRecords = records
.where((Event value) =>
value.db.strydCadence != null &&
value.db.verticalOscillation != null &&
value.db.verticalOscillation != 0)
.toList();
if (strideRatioRecords.length > 0) {
if (strideRatioRecords.isNotEmpty) {
return ListTileTheme(
iconColor: Colors.deepOrange,
child: ListView(
padding: EdgeInsets.only(left: 25),
padding: const EdgeInsets.only(left: 25),
children: <Widget>[
ActivityStrideRatioChart(
records: RecordList(strideRatioRecords),
records: RecordList<Event>(strideRatioRecords),
activity: widget.activity,
athlete: widget.athlete,
),
Text("stride ratio = stride length (cm) / vertical oscillation"
" (cm)"),
Text("stridelength (cm) = 10 000 / 6 * speed (km/h) / cadence "
"(strides/min)"),
const Text('stride ratio = stride length (cm) / vertical oscillation'
' (cm)'),
const Text('stride length (cm) = 10 000 / 6 * speed (km/h) / cadence '
'(strides/min)'),
Text('${widget.athlete.db.recordAggregationCount} records are '
'aggregated into one point in the plot. Only records where '
'cadence is present and vertical oscillation > 0 mm are shown.'),
Divider(),
const Divider(),
ListTile(
leading: MyIcon.strideRatio,
title: Text(avgStrideRatioString),
subtitle: Text("average stride ratio"),
subtitle: const Text('average stride ratio'),
),
ListTile(
leading: MyIcon.standardDeviation,
title: Text(sdevStrideRatioString),
subtitle: Text("standard deviation stride ratio "),
subtitle: const Text('standard deviation stride ratio '),
),
ListTile(
leading: MyIcon.amount,
title: Text(strideRatioRecords.length.toString()),
subtitle: Text("number of measurements"),
subtitle: const Text('number of measurements'),
),
],
),
);
} else {
return Center(
child: Text("No stride ratio data available."),
return const Center(
child: Text('No stride ratio data available.'),
);
}
} else {
return Center(
child: Text("Loading"),
return const Center(
child: Text('Loading'),
);
}
}
getData() async {
Activity activity = widget.activity;
records = RecordList(await activity.records);
Future<void> getData() async {
final Activity activity = widget.activity;
records = RecordList<Event>(await activity.records);
avgStrideRatioString = activity.db.avgStrideRatio.toStringOrDashes(1);
sdevStrideRatioString = activity.db.sdevStrideRatio.toStringOrDashes(2);
setState(() {});
......
......@@ -8,14 +8,14 @@ import 'package:encrateia/widgets/charts/activity_charts/activity_stryd_cadence_
import 'package:encrateia/utils/icon_utils.dart';
class ActivityStrydCadenceWidget extends StatefulWidget {
final Activity activity;
final Athlete athlete;
ActivityStrydCadenceWidget({
const ActivityStrydCadenceWidget({
@required this.activity,
@required this.athlete,
});
final Activity activity;
final Athlete athlete;
@override
_ActivityStrydCadenceWidgetState createState() =>
_ActivityStrydCadenceWidgetState();
......@@ -23,9 +23,9 @@ class ActivityStrydCadenceWidget extends StatefulWidget {
class _ActivityStrydCadenceWidgetState
extends State<ActivityStrydCadenceWidget> {
var records = RecordList(<Event>[]);
String avgStrydCadenceString = "Loading ...";
String sdevStrydCadenceString = "Loading ...";
RecordList<Event> records = RecordList<Event>(<Event>[]);
String avgStrydCadenceString = 'Loading ...';
String sdevStrydCadenceString = 'Loading ...';
@override
void initState() {
......@@ -34,65 +34,65 @@ class _ActivityStrydCadenceWidgetState
}
@override
Widget build(context) {
if (records.length > 0) {
var powerRecords = records
.where((value) =>
Widget build(BuildContext context) {
if (records.isNotEmpty) {
final List<Event> powerRecords = records
.where((Event value) =>
value.db.strydCadence != null && value.db.strydCadence > 0)
.toList();
if (powerRecords.length > 0) {
if (powerRecords.isNotEmpty) {
return ListTileTheme(
iconColor: Colors.deepOrange,
child: ListView(
padding: EdgeInsets.only(left: 25),
padding: const EdgeInsets.only(left: 25),
children: <Widget>[
ActivityStrydCadenceChart(
records: RecordList(powerRecords),
records: RecordList<Event>(powerRecords),
activity: widget.activity,
athlete: widget.athlete,
),
Text('${widget.athlete.db.recordAggregationCount} records are '
'aggregated into one point in the plot. Only records where '
'cadence > 0 s/min are shown.'),
Divider(),
const Divider(),
ListTile(
leading: MyIcon.average,
title: Text(avgStrydCadenceString),
subtitle: Text("average cadence"),
subtitle: const Text('average cadence'),
),
ListTile(
leading: MyIcon.standardDeviation,
title: Text(sdevStrydCadenceString),
subtitle: Text("standard deviation cadence"),
subtitle: const Text('standard deviation cadence'),
),
ListTile(
leading: MyIcon.amount,
title: Text(powerRecords.length.toString()),
subtitle: Text("number of measurements"),
subtitle: const Text('number of measurements'),
),
],
),
);
} else {
return Center(
child: Text("No cadence data available."),
return const Center(
child: Text('No cadence data available.'),
);
}
} else {
return Center(
child: Text("Loading"),
return const Center(
child: Text('Loading'),
);
}
}
getData() async {
Activity activity = widget.activity;
records = RecordList(await activity.records);
Future<void> getData() async {
final Activity activity = widget.activity;
records = RecordList<Event>(await activity.records);
avgStrydCadenceString =
activity.db.avgStrydCadence.toStringOrDashes(1) + " spm";
activity.db.avgStrydCadence.toStringOrDashes(1) + ' spm';
sdevStrydCadenceString =
activity.db.sdevStrydCadence.toStringOrDashes(2) + " spm";
activity.db.sdevStrydCadence.toStringOrDashes(2) + ' spm';
setState(() {});
}
}
......@@ -8,14 +8,14 @@ import 'package:encrateia/widgets/charts/activity_charts/activity_vertical_oscil
import 'package:encrateia/utils/icon_utils.dart';
class ActivityVerticalOscillationWidget extends StatefulWidget {
final Activity activity;
final Athlete athlete;
ActivityVerticalOscillationWidget({
const ActivityVerticalOscillationWidget({
@required this.activity,
@required this.athlete,
});
final Activity activity;
final Athlete athlete;
@override
_ActivityVerticalOscillationWidgetState createState() =>
_ActivityVerticalOscillationWidgetState();
......@@ -23,9 +23,9 @@ class ActivityVerticalOscillationWidget extends StatefulWidget {
class _ActivityVerticalOscillationWidgetState
extends State<ActivityVerticalOscillationWidget> {
var records = RecordList(<Event>[]);
String avgVerticalOscillationString = "Loading ...";
String sdevVerticalOscillationString = "Loading ...";
RecordList<Event> records = RecordList<Event>(<Event>[]);
String avgVerticalOscillationString = 'Loading ...';
String sdevVerticalOscillationString = 'Loading ...';
@override
void initState() {
......@@ -34,64 +34,64 @@ class _ActivityVerticalOscillationWidgetState
}
@override
Widget build(context) {
if (records.length > 0) {
var powerRecords = records
.where((value) => value.db.verticalOscillation != null)
Widget build(BuildContext context) {
if (records.isNotEmpty) {
final List<Event> powerRecords = records
.where((Event value) => value.db.verticalOscillation != null)
.toList();
if (powerRecords.length > 0) {
if (powerRecords.isNotEmpty) {
return ListTileTheme(
iconColor: Colors.deepOrange,
child: ListView(
padding: EdgeInsets.only(left: 25),
padding: const EdgeInsets.only(left: 25),
children: <Widget>[
ActivityVerticalOscillationChart(
records: RecordList(powerRecords),
records: RecordList<Event>(powerRecords),
activity: widget.activity,
athlete: widget.athlete,
),
Text('${widget.athlete.db.recordAggregationCount} records are '
'aggregated into one point in the plot. Only records where '
'vertical oscillation is present are shown.'),
Divider(),
const Divider(),
ListTile(
leading: MyIcon.average,
title: Text(avgVerticalOscillationString),
subtitle: Text("average vertical oscillation"),
subtitle: const Text('average vertical oscillation'),
),
ListTile(
leading: MyIcon.standardDeviation,
title: Text(sdevVerticalOscillationString),
subtitle: Text("standard deviation vertical oscillation"),
subtitle: const Text('standard deviation vertical oscillation'),
),
ListTile(
leading: MyIcon.amount,
title: Text(powerRecords.length.toString()),
subtitle: Text("number of measurements"),
subtitle: const Text('number of measurements'),
),
],
),
);
} else {
return Center(
child: Text("No vertical oscillation data available."),
return const Center(
child: Text('No vertical oscillation data available.'),
);
}
} else {
return Center(
child: Text("Loading"),
return const Center(
child: Text('Loading'),
);
}
}
getData() async {
Activity activity = widget.activity;
records = RecordList(await activity.records);
Future<void> getData() async {
final Activity activity = widget.activity;
records = RecordList<Event>(await activity.records);
avgVerticalOscillationString =
activity.db.avgVerticalOscillation.toStringOrDashes(1) + " cm";
activity.db.avgVerticalOscillation.toStringOrDashes(1) + ' cm';
sdevVerticalOscillationString =
activity.db.sdevVerticalOscillation.toStringOrDashes(2) + " cm";
activity.db.sdevVerticalOscillation.toStringOrDashes(2) + ' cm';
setState(() {});
}
}
......@@ -5,10 +5,10 @@ import 'package:encrateia/models/athlete.dart';
import 'package:encrateia/models/activity.dart';
class AthletePowerPerHeartRateWidget extends StatefulWidget {
final Athlete athlete;
AthletePowerPerHeartRateWidget({this.athlete});
const AthletePowerPerHeartRateWidget({this.athlete});
final Athlete athlete;
@override
_AthletePowerPerHeartRateWidgetState createState() =>
_AthletePowerPerHeartRateWidgetState();
......@@ -16,7 +16,7 @@ class AthletePowerPerHeartRateWidget extends StatefulWidget {
class _AthletePowerPerHeartRateWidgetState
extends State<AthletePowerPerHeartRateWidget> {
List<Activity> activities = [];
List<Activity> activities = <Activity>[];
@override
void initState() {
......@@ -25,10 +25,10 @@ class _AthletePowerPerHeartRateWidgetState
}
@override
Widget build(context) {
if (activities.length > 0) {
var powerPerHeartRateActivities = activities
.where((value) =>
Widget build(BuildContext context) {
if (activities.isNotEmpty) {
final List<Activity> powerPerHeartRateActivities = activities
.where((Activity value) =>
value.db.avgPower != null &&
value.db.avgPower > 0 &&
value.db.avgHeartRate != null &&
......@@ -36,11 +36,11 @@ class _AthletePowerPerHeartRateWidgetState
value.db.avgHeartRate != 255)
.toList();
if (powerPerHeartRateActivities.length > 0) {
if (powerPerHeartRateActivities.isNotEmpty) {
return ListTileTheme(
iconColor: Colors.deepOrange,
child: ListView(
padding: EdgeInsets.only(left: 25),
padding: const EdgeInsets.only(left: 25),
children: <Widget>[
AthleteTimeSeriesChart(
activities: powerPerHeartRateActivities,
......@@ -52,19 +52,19 @@ class _AthletePowerPerHeartRateWidgetState
),
);
} else {
return Center(
child: Text("No power per heart rate data available."),
return const Center(
child: Text('No power per heart rate data available.'),
);
}
} else {
return Center(
child: Text("Loading"),
return const Center(
child: Text('Loading'),
);
}
}
getData() async {
Athlete athlete = widget.athlete;
Future<void> getData() async {
final Athlete athlete = widget.athlete;
activities = await athlete.activities;
setState(() {});
}
......
......@@ -5,9 +5,9 @@ import 'package:encrateia/models/athlete.dart';
import 'package:encrateia/models/activity.dart';
class AthletePowerRatioWidget extends StatefulWidget {
final Athlete athlete;
const AthletePowerRatioWidget({this.athlete});
AthletePowerRatioWidget({this.athlete});
final Athlete athlete;
@override
_AthletePowerRatioWidgetState createState() =>
......@@ -15,7 +15,7 @@ class AthletePowerRatioWidget extends StatefulWidget {
}
class _AthletePowerRatioWidgetState extends State<AthletePowerRatioWidget> {
List<Activity> activities = [];
List<Activity> activities = <Activity>[];
@override
void initState() {
......@@ -24,21 +24,21 @@ class _AthletePowerRatioWidgetState extends State<AthletePowerRatioWidget> {
}
@override
Widget build(context) {
if (activities.length > 0) {
var powerRatioActivities = activities
.where((value) =>
Widget build(BuildContext context) {
if (activities.isNotEmpty) {
final List<Activity> powerRatioActivities = activities
.where((Activity value) =>
value.db.avgPower != null &&