Commit a9333b4f authored by Administrator's avatar Administrator

fixing linter warnings

parent 0a06d71d
......@@ -36,8 +36,7 @@ analyzer:
linter:
rules:
# HAS:20200527 disabled temporarily
# - always_declare_return_types
- always_declare_return_types
- always_put_control_body_on_new_line
# - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219
- always_require_non_null_named_parameters
......
import 'package:flutter/material.dart';
import 'screens/dashboard.dart';
import 'package:encrateia/setup.dart';
import 'package:encrateia/utils/my_theme.dart';
import 'package:flutter/material.dart';
import 'screens/dashboard.dart';
void main() async {
await Setup.init();
......
......@@ -9,14 +9,14 @@ import 'package:sqfentity_gen/sqfentity_gen.dart';
part 'model.g.dart';
const tableAthlete = SqfEntityTable(
const SqfEntityTable tableAthlete = SqfEntityTable(
tableName: 'athletes',
primaryKeyName: 'id',
primaryKeyType: PrimaryKeyType.integer_auto_incremental,
useSoftDeleting: false,
modelName: 'DbAthlete',
fields: [
SqfEntityField('state', DbType.text, defaultValue: "new"),
fields: <SqfEntityField>[
SqfEntityField('state', DbType.text, defaultValue: 'new'),
SqfEntityField('firstName', DbType.text),
SqfEntityField('lastName', DbType.text),
SqfEntityField('stravaUsername', DbType.text),
......@@ -28,14 +28,14 @@ const tableAthlete = SqfEntityTable(
],
);
const tableActivity = SqfEntityTable(
const SqfEntityTable tableActivity = SqfEntityTable(
tableName: 'activities',
primaryKeyName: 'id',
primaryKeyType: PrimaryKeyType.integer_auto_incremental,
useSoftDeleting: false,
modelName: 'DbActivity',
fields: [
SqfEntityField('state', DbType.text, defaultValue: "new"),
fields: <SqfEntityField>[
SqfEntityField('state', DbType.text, defaultValue: 'new'),
SqfEntityField('path', DbType.text),
SqfEntityField('stravaId', DbType.integer),
SqfEntityField('name', DbType.text),
......@@ -111,13 +111,13 @@ const tableActivity = SqfEntityTable(
],
);
const tableEvent = SqfEntityTable(
const SqfEntityTable tableEvent = SqfEntityTable(
tableName: 'events',
primaryKeyName: 'id',
primaryKeyType: PrimaryKeyType.integer_auto_incremental,
useSoftDeleting: false,
modelName: 'DbEvent',
fields: [
fields: <SqfEntityField>[
SqfEntityField('event', DbType.text),
SqfEntityField('eventType', DbType.text),
SqfEntityField('eventGroup', DbType.integer),
......@@ -151,13 +151,13 @@ const tableEvent = SqfEntityTable(
],
);
const tableLap = SqfEntityTable(
const SqfEntityTable tableLap = SqfEntityTable(
tableName: 'laps',
primaryKeyName: 'id',
primaryKeyType: PrimaryKeyType.integer_auto_incremental,
useSoftDeleting: false,
modelName: 'DbLap',
fields: [
fields: <SqfEntityField>[
SqfEntityField('timeStamp', DbType.datetime),
SqfEntityField('startTime', DbType.datetime),
SqfEntityField('startPositionLat', DbType.real),
......@@ -218,13 +218,13 @@ const tableLap = SqfEntityTable(
],
);
const tableWeight = SqfEntityTable(
const SqfEntityTable tableWeight = SqfEntityTable(
tableName: 'weights',
primaryKeyName: 'id',
primaryKeyType: PrimaryKeyType.integer_auto_incremental,
useSoftDeleting: false,
modelName: 'DbWeight',
fields: [
fields: <SqfEntityField>[
SqfEntityField('date', DbType.date),
SqfEntityField('value', DbType.real),
SqfEntityFieldRelationship(
......@@ -234,13 +234,13 @@ const tableWeight = SqfEntityTable(
],
);
const tablePowerZoneSchema = SqfEntityTable(
const SqfEntityTable tablePowerZoneSchema = SqfEntityTable(
tableName: 'powerZoneSchemata',
primaryKeyName: 'id',
primaryKeyType: PrimaryKeyType.integer_auto_incremental,
useSoftDeleting: false,
modelName: 'DbPowerZoneSchema',
fields: [
fields: <SqfEntityField>[
SqfEntityField('date', DbType.date),
SqfEntityField('name', DbType.text),
SqfEntityField('base', DbType.integer),
......@@ -251,13 +251,13 @@ const tablePowerZoneSchema = SqfEntityTable(
],
);
const tablePowerZone = SqfEntityTable(
const SqfEntityTable tablePowerZone = SqfEntityTable(
tableName: 'powerZone',
primaryKeyName: 'id',
primaryKeyType: PrimaryKeyType.integer_auto_incremental,
useSoftDeleting: false,
modelName: 'DbPowerZone',
fields: [
fields: <SqfEntityField>[
SqfEntityField('name', DbType.text),
SqfEntityField('lowerPercentage', DbType.integer),
SqfEntityField('upperPercentage', DbType.integer),
......@@ -271,13 +271,13 @@ const tablePowerZone = SqfEntityTable(
],
);
const tableHeartRateZoneSchema = SqfEntityTable(
const SqfEntityTable tableHeartRateZoneSchema = SqfEntityTable(
tableName: 'heartRateZoneSchemata',
primaryKeyName: 'id',
primaryKeyType: PrimaryKeyType.integer_auto_incremental,
useSoftDeleting: false,
modelName: 'DbHeartRateZoneSchema',
fields: [
fields: <SqfEntityField>[
SqfEntityField('date', DbType.date),
SqfEntityField('name', DbType.text),
SqfEntityField('base', DbType.integer),
......@@ -288,13 +288,13 @@ const tableHeartRateZoneSchema = SqfEntityTable(
],
);
const tableHeartRateZone = SqfEntityTable(
const SqfEntityTable tableHeartRateZone = SqfEntityTable(
tableName: 'heartRateZone',
primaryKeyName: 'id',
primaryKeyType: PrimaryKeyType.integer_auto_incremental,
useSoftDeleting: false,
modelName: 'DbHeartRateZone',
fields: [
fields: <SqfEntityField>[
SqfEntityField('name', DbType.text),
SqfEntityField('lowerPercentage', DbType.integer),
SqfEntityField('upperPercentage', DbType.integer),
......@@ -308,13 +308,13 @@ const tableHeartRateZone = SqfEntityTable(
],
);
const tableTagGroup = SqfEntityTable(
const SqfEntityTable tableTagGroup = SqfEntityTable(
tableName: 'tagGroups',
primaryKeyName: 'id',
primaryKeyType: PrimaryKeyType.integer_auto_incremental,
useSoftDeleting: false,
modelName: 'DbTagGroup',
fields: [
fields: <SqfEntityField>[
SqfEntityField('name', DbType.text),
SqfEntityField('color', DbType.integer),
SqfEntityField('system', DbType.bool),
......@@ -325,13 +325,13 @@ const tableTagGroup = SqfEntityTable(
],
);
const tableTag = SqfEntityTable(
const SqfEntityTable tableTag = SqfEntityTable(
tableName: 'tags',
primaryKeyName: 'id',
primaryKeyType: PrimaryKeyType.integer_auto_incremental,
useSoftDeleting: false,
modelName: 'DbTag',
fields: [
fields: <SqfEntityField>[
SqfEntityField('name', DbType.text),
SqfEntityField('color', DbType.integer),
SqfEntityField('sortOrder', DbType.integer),
......@@ -343,13 +343,13 @@ const tableTag = SqfEntityTable(
],
);
const tableLapTagging = SqfEntityTable(
const SqfEntityTable tableLapTagging = SqfEntityTable(
tableName: 'lapTaggings',
primaryKeyName: 'id',
primaryKeyType: PrimaryKeyType.integer_auto_incremental,
useSoftDeleting: false,
modelName: 'DbLapTagging',
fields: [
fields: <SqfEntityField>[
SqfEntityField('system', DbType.bool),
SqfEntityFieldRelationship(
parentTable: tableTag,
......@@ -362,13 +362,13 @@ const tableLapTagging = SqfEntityTable(
],
);
const tableActivityTagging = SqfEntityTable(
const SqfEntityTable tableActivityTagging = SqfEntityTable(
tableName: 'activityTaggings',
primaryKeyName: 'id',
primaryKeyType: PrimaryKeyType.integer_auto_incremental,
useSoftDeleting: false,
modelName: 'DbActivityTagging',
fields: [
fields: <SqfEntityField>[
SqfEntityField('system', DbType.bool),
SqfEntityFieldRelationship(
parentTable: tableTag,
......@@ -383,10 +383,10 @@ const tableActivityTagging = SqfEntityTable(
@SqfEntityBuilder(encrateia)
const encrateia = SqfEntityModel(
const SqfEntityModel encrateia = SqfEntityModel(
modelName: 'DbEncrateia', // optional
databaseName: 'encrateia.db',
databaseTables: [
databaseTables: <SqfEntityTable>[
tableAthlete,
tableActivity,
tableEvent,
......@@ -401,6 +401,6 @@ const encrateia = SqfEntityModel(
tableLapTagging,
tableActivityTagging,
],
sequences: [],
sequences: <SqfEntitySequence>[],
bundledDatabasePath: null,
);
......@@ -454,6 +454,7 @@ class Activity extends ChangeNotifier {
// debugger();
}
}
return null;
}
Future<void> resetCurrentLap() async {
......
This diff is collapsed.
import 'package:flutter/material.dart';
// import 'package:encrateia/utils/icon_utils.dart';
// ignore: avoid_classes_with_only_static_members
class MyIcon {
// A
static final activities = Icon(Icons.view_list);
static final amount = Icon(Icons.playlist_add);
static final analyze = Icon(Icons.multiline_chart);
static final ascent = Icon(Icons.trending_up);
static final athlete = Icon(
static final Icon activities = Icon(Icons.view_list);
static final Icon amount = Icon(Icons.playlist_add);
static final Icon analyze = Icon(Icons.multiline_chart);
static final Icon ascent = Icon(Icons.trending_up);
static final Icon athlete = Icon(
Icons.face,
color: Colors.deepOrange,
);
static final average = Icon(Icons.filter_tilt_shift);
static final Icon average = Icon(Icons.filter_tilt_shift);
// B
static final brokenConnection = Icon(Icons.link_off);
static final Icon brokenConnection = Icon(Icons.link_off);
// C
static final cadence = Icon(Icons.pets);
static final calories = Icon(Icons.battery_charging_full);
static final climb = ascent;
static final cycling = Icon(Icons.directions_bike);
static final cycles = Icon(Icons.repeat);
static final Icon cadence = Icon(Icons.pets);
static final Icon calories = Icon(Icons.battery_charging_full);
static final Icon climb = ascent;
static final Icon cycling = Icon(Icons.directions_bike);
static final Icon cycles = Icon(Icons.repeat);
// D
static final delete = Icon(Icons.delete);
static final distance = Icon(Icons.redo);
static final download = Icon(Icons.cloud_download);
static final downloadLocal = Icon(Icons.file_download);
static final Icon delete = Icon(Icons.delete);
static final Icon distance = Icon(Icons.redo);
static final Icon download = Icon(Icons.cloud_download);
static final Icon downloadLocal = Icon(Icons.file_download);
// E
static final edit = Icon(Icons.edit);
static final event = Icon(Icons.event);
static final Icon edit = Icon(Icons.edit);
static final Icon event = Icon(Icons.event);
// F
static final finished = Icon(Icons.check_box);
static final finishedWhite =
static final Icon finished = Icon(Icons.check_box);
static final Icon finishedWhite =
Icon(Icons.sentiment_very_satisfied, color: Colors.white);
static final formPower = Icon(Icons.ev_station);
static final Icon formPower = Icon(Icons.ev_station);
// G
static final groundTime = Icon(Icons.vertical_align_bottom);
static final Icon groundTime = Icon(Icons.vertical_align_bottom);
// H
static final heartRate = Icon(Icons.spa);
static final help = Icon(Icons.help);
static final Icon heartRate = Icon(Icons.spa);
static final Icon help = Icon(Icons.help);
// I
static final id = Icon(Icons.fingerprint);
static final information = Icon(
static final Icon id = Icon(Icons.fingerprint);
static final Icon information = Icon(
Icons.info_outline,
color: Colors.blue,
);
static final intensity = Icon(Icons.power);
static final Icon intensity = Icon(Icons.power);
// L
static final laps = Icon(Icons.timer);
static final legSpringStiffness = Icon(Icons.airline_seat_recline_extra);
static final Icon laps = Icon(Icons.timer);
static final Icon legSpringStiffness = Icon(Icons.airline_seat_recline_extra);
// M
static final maximum = Icon(Icons.expand_less);
static final metaData = Icon(Icons.storage);
static final minimum = Icon(Icons.expand_more);
static final Icon maximum = Icon(Icons.expand_less);
static final Icon metaData = Icon(Icons.storage);
static final Icon minimum = Icon(Icons.expand_more);
// N
static final number = amount;
static final Icon number = amount;
// O
static final overView = Icon(Icons.landscape);
static final Icon overView = Icon(Icons.landscape);
// P
static final parse = Icon(Icons.build);
static final position = Icon(Icons.map);
static final power = Icon(Icons.ev_station);
static final powerDuration = Icon(Icons.multiline_chart);
static final Icon parse = Icon(Icons.build);
static final Icon position = Icon(Icons.map);
static final Icon power = Icon(Icons.ev_station);
static final Icon powerDuration = Icon(Icons.multiline_chart);
// R
static final repeats = Icon(Icons.loop);
static final running = Icon(Icons.directions_run);
static final runningBig = Icon(Icons.directions_run, size: 50);
static final Icon repeats = Icon(Icons.loop);
static final Icon running = Icon(Icons.directions_run);
static final Icon runningBig = Icon(Icons.directions_run, size: 50);
// S
static final settings = Icon(Icons.settings);
static final show = Icon(Icons.remove_red_eye);
static final speed = Icon(Icons.shutter_speed);
static final sport = Icon(Icons.fitness_center);
static final stanceTime = cadence;
static final standardDeviation = Icon(Icons.unfold_more);
static final stravaDownload = Icon(Icons.cloud_download);
static final stravaDownloadWhite =
static final Icon settings = Icon(Icons.settings);
static final Icon show = Icon(Icons.remove_red_eye);
static final Icon speed = Icon(Icons.shutter_speed);
static final Icon sport = Icon(Icons.fitness_center);
static final Icon stanceTime = cadence;
static final Icon standardDeviation = Icon(Icons.unfold_more);
static final Icon stravaDownload = Icon(Icons.cloud_download);
static final Icon stravaDownloadWhite =
Icon(Icons.cloud_download, color: Colors.white);
static final strideRatio = Icon(Icons.signal_cellular_null);
static final strides = Icon(Icons.directions_walk);
static final Icon strideRatio = Icon(Icons.signal_cellular_null);
static final Icon strides = Icon(Icons.directions_walk);
// T
static final tag = Icon(Icons.label);
static final temperature = Icon(Icons.ac_unit);
static final time = Icon(Icons.timer);
static final timeStamp = Icon(Icons.access_time);
static final title = Icon(Icons.title);
static final trainingEffect = Icon(Icons.fitness_center);
static final Icon tag = Icon(Icons.label);
static final Icon temperature = Icon(Icons.ac_unit);
static final Icon time = Icon(Icons.timer);
static final Icon timeStamp = Icon(Icons.access_time);
static final Icon title = Icon(Icons.title);
static final Icon trainingEffect = Icon(Icons.fitness_center);
//
static final upload = Icon(Icons.file_upload);
static final Icon upload = Icon(Icons.file_upload);
// V
static final verticalOscillation = Icon(Icons.unfold_more);
static final Icon verticalOscillation = Icon(Icons.unfold_more);
// W
static final warning = Icon(Icons.warning);
static final website = Icon(Icons.web);
static final weight = Icon(Icons.restaurant_menu);
static final Icon warning = Icon(Icons.warning);
static final Icon website = Icon(Icons.web);
static final Icon weight = Icon(Icons.restaurant_menu);
}
import 'package:flutter/material.dart';
// import 'package:encrateia/utils/my_color.dart';
// ignore: avoid_classes_with_only_static_members
class MyColor {
static Color blueJeans = Color(0xFF4A89DC);
static Color blueJeansAccent = Color(0xFF5D9CEC);
static Color aqua = Color(0xFF3BAFDA);
static Color aquaAccent = Color(0xFF4FC1E9);
static Color mint = Color(0xFF37BC9B);
static Color mintAccent = Color(0xFF48CFAD);
static Color grass = Color(0xFF8CC152);
static Color grassAccent = Color(0xFFA0D468);
static Color sunFlower = Color(0xFFF6BB42);
static Color sunFlowerAccent = Color(0xFFFFCE54);
static Color bitterSweet = Color(0xFFE9573F);
static Color bitterSweetAccent = Color(0xFFFC6E51);
static Color grapeFruit = Color(0xFFDA4453);
static Color grapeFruitAccent = Color(0xFFED5565);
static Color lavender = Color(0xFF967ADC);
static Color lavenderAccent = Color(0xFFAC92EC);
static Color pinkRose = Color(0xFFD770AD);
static Color pinkRoseAccent = Color(0xFFEC87C0);
static Color lightGray = Color(0xFFE6E9ED);
static Color lightGrayAccent = Color(0xFFF5F7FA);
static Color mediumGray = Color(0xFFAAB2BD);
static Color mediumGrayAccent = Color(0xFFCCD1D9);
static Color darkGray = Color(0xFF434A54);
static Color darkGrayAccent = Color(0xFF656D78);
static Color blueJeans = const Color(0xFF4A89DC);
static Color blueJeansAccent = const Color(0xFF5D9CEC);
static Color aqua = const Color(0xFF3BAFDA);
static Color aquaAccent = const Color(0xFF4FC1E9);
static Color mint = const Color(0xFF37BC9B);
static Color mintAccent = const Color(0xFF48CFAD);
static Color grass = const Color(0xFF8CC152);
static Color grassAccent = const Color(0xFFA0D468);
static Color sunFlower = const Color(0xFFF6BB42);
static Color sunFlowerAccent = const Color(0xFFFFCE54);
static Color bitterSweet = const Color(0xFFE9573F);
static Color bitterSweetAccent = const Color(0xFFFC6E51);
static Color grapeFruit = const Color(0xFFDA4453);
static Color grapeFruitAccent = const Color(0xFFED5565);
static Color lavender = const Color(0xFF967ADC);
static Color lavenderAccent = const Color(0xFFAC92EC);
static Color pinkRose = const Color(0xFFD770AD);
static Color pinkRoseAccent = const Color(0xFFEC87C0);
static Color lightGray = const Color(0xFFE6E9ED);
static Color lightGrayAccent = const Color(0xFFF5F7FA);
static Color mediumGray = const Color(0xFFAAB2BD);
static Color mediumGrayAccent = const Color(0xFFCCD1D9);
static Color darkGray = const Color(0xFF434A54);
static Color darkGrayAccent = const Color(0xFF656D78);
static Color white = Colors.white;
static Color black = Colors.black;
static Color ecstasy = Color(0xFFF9690E);
static Color gamboge = Color(0xFFFFB61E);
static Color brightGoldenYellow = Color(0xFFFFA400);
static Color ecstasy = const Color(0xFFF9690E);
static Color gamboge = const Color(0xFFFFB61E);
static Color brightGoldenYellow = const Color(0xFFFFA400);
static Color normal = mediumGray;
static Color normalAccent = mediumGrayAccent;
......@@ -47,8 +48,8 @@ class MyColor {
static Color warningAccent = sunFlowerAccent;
static Color danger = grapeFruit;
static Color dangerAccent = grapeFruitAccent;
static Color link = Color(0x11ffffff);
static Color linkAccent = Color(0xAAffffff);
static Color link = const Color(0x11ffffff);
static Color linkAccent = const Color(0xAAffffff);
static Color detail = brightGoldenYellow;
static Color settings = lightGray;
......
......@@ -18,9 +18,10 @@ class ActivitiesListWidget extends StatefulWidget {
class _ActivitiesListWidgetState extends State<ActivitiesListWidget> {
List<Activity> activities = <Activity>[];
Flushbar<Object> flushbar;
@override
initState() {
void initState() {
getActivities();
WidgetsBinding.instance.addPostFrameCallback((_) => showMyFlushbar());
super.initState();
......@@ -96,7 +97,7 @@ class _ActivitiesListWidgetState extends State<ActivitiesListWidget> {
}
Future<void> download({Activity activity}) async {
final Flushbar<Object> flushbar = Flushbar<Object>(
flushbar = Flushbar<Object>(
message: 'Download .fit-File for »${activity.db.name}«',
duration: const Duration(seconds: 10),
icon: MyIcon.stravaDownloadWhite,
......@@ -105,11 +106,11 @@ class _ActivitiesListWidgetState extends State<ActivitiesListWidget> {
await activity.download(athlete: widget.athlete);
flushbar.dismiss();
Flushbar<Object>(
flushbar = Flushbar<Object>(
message: 'Download finished',
duration: const Duration(seconds: 1),
icon: MyIcon.finishedWhite,
).show(context);
)..show(context);
setState(() {});
}
......@@ -214,17 +215,17 @@ class _ActivitiesListWidgetState extends State<ActivitiesListWidget> {
void showMyFlushbar() {
if (widget.athlete.email == null) {
Flushbar<Object>(
flushbar = Flushbar<Object>(
message: 'Strava email not provided yet or not a Strava User!',
duration: const Duration(seconds: 3),
backgroundColor: Colors.yellow[900],
).show(context);
)..show(context);
} else if (widget.athlete.password == null) {
Flushbar<Object>(
flushbar = Flushbar<Object>(
message: 'Strava password not provided yet!',
duration: const Duration(seconds: 3),
backgroundColor: Colors.red,
).show(context);
)..show(context);
}
}
}
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