diff --git a/lib/screens/add_heart_rate_zone_schema_screen.dart b/lib/screens/add_heart_rate_zone_schema_screen.dart index d5c9941b3c1b8d2348e3075bf93f15c6a95d7832..d143ba38593b674e56a72f3efb066d3789643998 100644 --- a/lib/screens/add_heart_rate_zone_schema_screen.dart +++ b/lib/screens/add_heart_rate_zone_schema_screen.dart @@ -21,7 +21,8 @@ class AddHeartRateZoneSchemaScreen extends StatefulWidget { _AddHeartRateZoneSchemaScreenState(); } -class _AddHeartRateZoneSchemaScreenState extends State { +class _AddHeartRateZoneSchemaScreenState + extends State { List heartRateZones = []; int offset = 0; int rows; @@ -42,6 +43,18 @@ class _AddHeartRateZoneSchemaScreenState extends State[ + 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( decoration: InputDecoration( labelText: "Valid from", @@ -70,7 +83,8 @@ class _AddHeartRateZoneSchemaScreenState extends State updateHeartRateZoneBase(base: int.parse(value)), + onChanged: (value) => + updateHeartRateZoneBase(base: int.parse(value)), ), SizedBox(height: 10), DataTable( @@ -127,8 +141,8 @@ class _AddHeartRateZoneSchemaScreenState extends State AddHeartRateZoneScreen( - heartRateZone: - HeartRateZone(heartRateZoneSchema: widget.heartRateZoneSchema), + heartRateZone: HeartRateZone( + heartRateZoneSchema: widget.heartRateZoneSchema), base: widget.heartRateZoneSchema.db.base, ), ), @@ -160,8 +174,8 @@ class _AddHeartRateZoneSchemaScreenState extends State heartRateZone.db).toList()); + await DbHeartRateZone().upsertAll( + heartRateZones.map((heartRateZone) => heartRateZone.db).toList()); Navigator.of(context).pop(); } @@ -197,8 +211,8 @@ class _AddHeartRateZoneSchemaScreenState extends State heartRateZone.db).toList()); + await DbHeartRateZone().upsertAll( + heartRateZones.map((heartRateZone) => heartRateZone.db).toList()); await getData(); showDialog( context: context, diff --git a/lib/screens/add_power_zone_schema_screen.dart b/lib/screens/add_power_zone_schema_screen.dart index d548103f29e870f66212c9b23ea9c6927e47e671..48d003342a2bc9128dfe35574efab070eff5a370 100644 --- a/lib/screens/add_power_zone_schema_screen.dart +++ b/lib/screens/add_power_zone_schema_screen.dart @@ -42,6 +42,18 @@ class _AddPowerZoneSchemaScreenState extends State { body: ListView( padding: EdgeInsets.only(left: 20, right: 20), children: [ + 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( decoration: InputDecoration( labelText: "Valid from", diff --git a/lib/utils/icon_utils.dart b/lib/utils/icon_utils.dart index b343d6dfb1f3df37b633c39bb6671e388578a045..7f5d48ffb0dba6a7bf49f146c7bdaffe98131494 100644 --- a/lib/utils/icon_utils.dart +++ b/lib/utils/icon_utils.dart @@ -90,6 +90,7 @@ class MyIcon { // V static final 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); }