Commit 0da2f8b3 authored by Administrator's avatar Administrator

instruction on updating current base values

parent 508f711a
...@@ -21,7 +21,8 @@ class AddHeartRateZoneSchemaScreen extends StatefulWidget { ...@@ -21,7 +21,8 @@ class AddHeartRateZoneSchemaScreen extends StatefulWidget {
_AddHeartRateZoneSchemaScreenState(); _AddHeartRateZoneSchemaScreenState();
} }
class _AddHeartRateZoneSchemaScreenState extends State<AddHeartRateZoneSchemaScreen> { class _AddHeartRateZoneSchemaScreenState
extends State<AddHeartRateZoneSchemaScreen> {
List<HeartRateZone> heartRateZones = []; List<HeartRateZone> heartRateZones = [];
int offset = 0; int offset = 0;
int rows; int rows;
...@@ -42,6 +43,18 @@ class _AddHeartRateZoneSchemaScreenState extends State<AddHeartRateZoneSchemaScr ...@@ -42,6 +43,18 @@ class _AddHeartRateZoneSchemaScreenState extends State<AddHeartRateZoneSchemaScr
body: ListView( body: ListView(
padding: EdgeInsets.only(left: 20, right: 20), padding: EdgeInsets.only(left: 20, right: 20),
children: <Widget>[ children: <Widget>[
Card(
margin: EdgeInsets.all(40),
child: ListTile(
leading: MyIcon.warning,
title: Text("Instructions to update your current base value"),
subtitle: Text(
"1) Change the VALID FROM date to today to copy the heart rate zone schema.\n"
"2) Edit the BASE VALUE to the new value.\n"
"3) Click SAVE to persist your changes.",
),
),
),
DateTimeField( DateTimeField(
decoration: InputDecoration( decoration: InputDecoration(
labelText: "Valid from", labelText: "Valid from",
...@@ -70,7 +83,8 @@ class _AddHeartRateZoneSchemaScreenState extends State<AddHeartRateZoneSchemaScr ...@@ -70,7 +83,8 @@ class _AddHeartRateZoneSchemaScreenState extends State<AddHeartRateZoneSchemaScr
), ),
initialValue: widget.heartRateZoneSchema.db.base.toString(), initialValue: widget.heartRateZoneSchema.db.base.toString(),
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
onChanged: (value) => updateHeartRateZoneBase(base: int.parse(value)), onChanged: (value) =>
updateHeartRateZoneBase(base: int.parse(value)),
), ),
SizedBox(height: 10), SizedBox(height: 10),
DataTable( DataTable(
...@@ -127,8 +141,8 @@ class _AddHeartRateZoneSchemaScreenState extends State<AddHeartRateZoneSchemaScr ...@@ -127,8 +141,8 @@ class _AddHeartRateZoneSchemaScreenState extends State<AddHeartRateZoneSchemaScr
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => AddHeartRateZoneScreen( builder: (context) => AddHeartRateZoneScreen(
heartRateZone: heartRateZone: HeartRateZone(
HeartRateZone(heartRateZoneSchema: widget.heartRateZoneSchema), heartRateZoneSchema: widget.heartRateZoneSchema),
base: widget.heartRateZoneSchema.db.base, base: widget.heartRateZoneSchema.db.base,
), ),
), ),
...@@ -160,8 +174,8 @@ class _AddHeartRateZoneSchemaScreenState extends State<AddHeartRateZoneSchemaScr ...@@ -160,8 +174,8 @@ class _AddHeartRateZoneSchemaScreenState extends State<AddHeartRateZoneSchemaScr
saveHeartRateZoneSchema(BuildContext context) async { saveHeartRateZoneSchema(BuildContext context) async {
await widget.heartRateZoneSchema.db.save(); await widget.heartRateZoneSchema.db.save();
await DbHeartRateZone() await DbHeartRateZone().upsertAll(
.upsertAll(heartRateZones.map((heartRateZone) => heartRateZone.db).toList()); heartRateZones.map((heartRateZone) => heartRateZone.db).toList());
Navigator.of(context).pop(); Navigator.of(context).pop();
} }
...@@ -197,8 +211,8 @@ class _AddHeartRateZoneSchemaScreenState extends State<AddHeartRateZoneSchemaScr ...@@ -197,8 +211,8 @@ class _AddHeartRateZoneSchemaScreenState extends State<AddHeartRateZoneSchemaScr
..heartRateZoneSchemataId = heartRateZoneSchemaId ..heartRateZoneSchemataId = heartRateZoneSchemaId
..id = null; ..id = null;
} }
await DbHeartRateZone() await DbHeartRateZone().upsertAll(
.upsertAll(heartRateZones.map((heartRateZone) => heartRateZone.db).toList()); heartRateZones.map((heartRateZone) => heartRateZone.db).toList());
await getData(); await getData();
showDialog( showDialog(
context: context, context: context,
......
...@@ -42,6 +42,18 @@ class _AddPowerZoneSchemaScreenState extends State<AddPowerZoneSchemaScreen> { ...@@ -42,6 +42,18 @@ class _AddPowerZoneSchemaScreenState extends State<AddPowerZoneSchemaScreen> {
body: ListView( body: ListView(
padding: EdgeInsets.only(left: 20, right: 20), padding: EdgeInsets.only(left: 20, right: 20),
children: <Widget>[ children: <Widget>[
Card(
margin: EdgeInsets.all(40),
child: ListTile(
leading: MyIcon.warning,
title: Text("Instructions to update your current base value"),
subtitle: Text(
"1) Change the VALID FROM date to today to copy the power zone schema.\n"
"2) Edit the BASE VALUE to the new value.\n"
"3) Click SAVE to persist your changes.",
),
),
),
DateTimeField( DateTimeField(
decoration: InputDecoration( decoration: InputDecoration(
labelText: "Valid from", labelText: "Valid from",
......
...@@ -90,6 +90,7 @@ class MyIcon { ...@@ -90,6 +90,7 @@ class MyIcon {
// V // V
static final verticalOscillation = Icon(Icons.unfold_more); static final verticalOscillation = Icon(Icons.unfold_more);
// W // W
static final warning = Icon(Icons.warning);
static final website = Icon(Icons.web); static final website = Icon(Icons.web);
static final weight = Icon(Icons.restaurant_menu); static final weight = Icon(Icons.restaurant_menu);
} }
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