Commit 0ede42fc authored by Administrator's avatar Administrator

flashbars for Strava-download and .fit-download

parent 54e8571e
......@@ -3,6 +3,7 @@ import 'package:encrateia/models/athlete.dart';
import 'package:encrateia/models/activity.dart';
import 'package:encrateia/widgets/activities_list_widget.dart';
import 'package:encrateia/utils/icon_utils.dart';
import 'package:flushbar/flushbar.dart';
class ListActivitiesScreen extends StatefulWidget {
final Athlete athlete;
......@@ -38,7 +39,19 @@ class _ListActivitiesScreenState extends State<ListActivitiesScreen> {
}
Future queryStrava() async {
var flushbar = Flushbar(
message: "Downloading new activities",
duration: Duration(seconds: 30),
icon: MyIcon.stravaDownloadWhite,
)..show(context);
await Activity.queryStrava(athlete: widget.athlete);
flushbar.dismiss();
Flushbar(
message: "Download finished",
duration: Duration(seconds: 1),
icon: MyIcon.finishedWhite,
)..show(context);
setState(() {});
}
}
......@@ -20,10 +20,13 @@ class MyIcon {
static final delete = Icon(Icons.delete);
static final distance = Icon(Icons.redo);
static final download = Icon(Icons.cloud_download);
// E
static final edit = Icon(Icons.edit);
static final event = Icon(Icons.event);
// F
static final finished = Icon(Icons.check_box);
static final finishedWhite = Icon(Icons.check_box, color: Colors.white);
static final formPower = Icon(Icons.ev_station);
// G
static final groundTime = Icon(Icons.vertical_align_bottom);
......@@ -59,6 +62,7 @@ class MyIcon {
static final stanceTime = cadence;
static final standardDeviation = Icon(Icons.unfold_more);
static final stravaDownload = Icon(Icons.cloud_download);
static final stravaDownloadWhite = Icon(Icons.cloud_download, color: Colors.white);
static final strides = Icon(Icons.directions_walk);
// T
static final temperature = Icon(Icons.ac_unit);
......
......@@ -112,14 +112,28 @@ class _ActivitiesListWidgetState extends State<ActivitiesListWidget> {
}
Future download({Activity activity}) async {
var flushbar = Flushbar(
message: "Download .fit-File for »${activity.db.name}«",
duration: Duration(seconds: 30),
icon: MyIcon.stravaDownloadWhite,
)..show(context);
await activity.download(athlete: widget.athlete);
flushbar.dismiss();
Flushbar(
message: "Download finished",
duration: Duration(seconds: 1),
icon: MyIcon.finishedWhite,
)..show(context);
setState(() {});
}
Future parse({Activity activity}) async {
var flushbar = Flushbar(
message: "0% of storing »${activity.db.name}«",
duration: Duration(milliseconds: 1000),
duration: Duration(seconds: 3),
animationDuration: Duration(milliseconds: 1),
titleText: LinearProgressIndicator(value: 0),
)..show(context);
......@@ -130,7 +144,7 @@ class _ActivitiesListWidgetState extends State<ActivitiesListWidget> {
flushbar = Flushbar(
titleText: LinearProgressIndicator(value: value/100),
message: "$value% of storing »${activity.db.name}«",
duration: Duration(milliseconds: 1000),
duration: Duration(seconds: 3),
animationDuration: Duration(milliseconds: 1),
)
..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