Commit 7709bcbd authored by Administrator's avatar Administrator

prevent last weight, power/heartRateZone/Schema from being deleted

parent 77e6cf87
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_secure_storage","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.3/","dependencies":[]},{"name":"package_info","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.1/","dependencies":[]},{"name":"path_provider","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.11/","dependencies":[]},{"name":"shared_preferences","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.8/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.1/","dependencies":[]},{"name":"uni_links","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links-0.4.0/","dependencies":[]},{"name":"url_launcher","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.0/","dependencies":[]}],"android":[{"name":"flutter_secure_storage","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.3/","dependencies":[]},{"name":"package_info","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.1/","dependencies":[]},{"name":"path_provider","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.11/","dependencies":[]},{"name":"shared_preferences","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.8/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.1/","dependencies":[]},{"name":"uni_links","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links-0.4.0/","dependencies":[]},{"name":"url_launcher","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.0/","dependencies":[]}],"macos":[{"name":"package_info","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.1/","dependencies":[]},{"name":"path_provider_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+3/","dependencies":[]},{"name":"shared_preferences_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+10/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.1/","dependencies":[]},{"name":"url_launcher_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.0.1+7/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.0.1+2/","dependencies":[]},{"name":"shared_preferences_linux","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-0.0.2+1/","dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-0.0.1+1/","dependencies":[]}],"windows":[],"web":[{"name":"shared_preferences_web","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+7/","dependencies":[]},{"name":"url_launcher_web","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-0.1.2/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_secure_storage","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_linux","shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]},{"name":"uni_links","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_linux","url_launcher_macos"]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2020-09-01 18:47:28.462707","version":"1.20.2"}
\ No newline at end of file
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_secure_storage","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.3/","dependencies":[]},{"name":"package_info","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.1/","dependencies":[]},{"name":"path_provider","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.11/","dependencies":[]},{"name":"shared_preferences","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.8/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.1/","dependencies":[]},{"name":"uni_links","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links-0.4.0/","dependencies":[]},{"name":"url_launcher","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.0/","dependencies":[]}],"android":[{"name":"flutter_secure_storage","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.3/","dependencies":[]},{"name":"package_info","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.1/","dependencies":[]},{"name":"path_provider","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.11/","dependencies":[]},{"name":"shared_preferences","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.8/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.1/","dependencies":[]},{"name":"uni_links","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links-0.4.0/","dependencies":[]},{"name":"url_launcher","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.0/","dependencies":[]}],"macos":[{"name":"package_info","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.1/","dependencies":[]},{"name":"path_provider_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+3/","dependencies":[]},{"name":"shared_preferences_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+10/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.1/","dependencies":[]},{"name":"url_launcher_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.0.1+7/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.0.1+2/","dependencies":[]},{"name":"shared_preferences_linux","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-0.0.2+1/","dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-0.0.1+1/","dependencies":[]}],"windows":[],"web":[{"name":"shared_preferences_web","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+7/","dependencies":[]},{"name":"url_launcher_web","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-0.1.2/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_secure_storage","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_linux","shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]},{"name":"uni_links","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_linux","url_launcher_macos"]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2020-09-03 09:27:55.252286","version":"1.20.2"}
\ No newline at end of file
......@@ -10,10 +10,14 @@ import 'package:datetime_picker_formfield/datetime_picker_formfield.dart';
import 'add_heart_rate_zone_screen.dart';
class AddHeartRateZoneSchemaScreen extends StatefulWidget {
const AddHeartRateZoneSchemaScreen({Key key, this.heartRateZoneSchema})
: super(key: key);
const AddHeartRateZoneSchemaScreen({
Key key,
this.heartRateZoneSchema,
@required this.numberOfSchemas,
}) : super(key: key);
final HeartRateZoneSchema heartRateZoneSchema;
final int numberOfSchemas;
@override
_AddHeartRateZoneSchemaScreenState createState() =>
......@@ -47,8 +51,7 @@ class _AddHeartRateZoneSchemaScreenState
margin: EdgeInsets.all(40),
child: ListTile(
leading: MyIcon.warning,
title:
Text('Instructions to update your current base value'),
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'
......@@ -71,7 +74,8 @@ class _AddHeartRateZoneSchemaScreenState
lastDate: DateTime(2100),
);
},
onChanged: (DateTime value) => copyHeartRateZoneSchema(date: value),
onChanged: (DateTime value) =>
copyHeartRateZoneSchema(date: value),
),
TextFormField(
decoration: const InputDecoration(labelText: 'Name'),
......@@ -124,6 +128,7 @@ class _AddHeartRateZoneSchemaScreenState
AddHeartRateZoneScreen(
heartRateZone: heartRateZone,
base: widget.heartRateZoneSchema.base,
numberOfZones: heartRateZones.length,
),
),
);
......@@ -144,10 +149,12 @@ class _AddHeartRateZoneSchemaScreenState
await Navigator.push(
context,
MaterialPageRoute<BuildContext>(
builder: (BuildContext context) => AddHeartRateZoneScreen(
builder: (BuildContext context) =>
AddHeartRateZoneScreen(
heartRateZone: HeartRateZone(
heartRateZoneSchema: widget.heartRateZoneSchema),
base: widget.heartRateZoneSchema.base,
numberOfZones: heartRateZones.length,
),
),
);
......@@ -160,15 +167,17 @@ class _AddHeartRateZoneSchemaScreenState
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
MyButton.delete(
onPressed: () => deleteHeartRateZoneSchema(
heartRateZoneSchema: widget.heartRateZoneSchema,
if (widget.numberOfSchemas > 1)
MyButton.delete(
onPressed: () => deleteHeartRateZoneSchema(
heartRateZoneSchema: widget.heartRateZoneSchema,
),
),
),
const SizedBox(width: 5),
MyButton.cancel(onPressed: () => Navigator.of(context).pop()),
const SizedBox(width: 5),
MyButton.save(onPressed: () => saveHeartRateZoneSchema(context)),
MyButton.save(
onPressed: () => saveHeartRateZoneSchema(context)),
],
),
],
......@@ -210,8 +219,7 @@ class _AddHeartRateZoneSchemaScreenState
widget.heartRateZoneSchema
..date = date
..id = null;
final int heartRateZoneSchemaId =
await widget.heartRateZoneSchema.save();
final int heartRateZoneSchemaId = await widget.heartRateZoneSchema.save();
for (final HeartRateZone heartRateZone in heartRateZones) {
heartRateZone
..heartRateZoneSchemataId = heartRateZoneSchemaId
......
......@@ -5,14 +5,13 @@ import 'package:encrateia/models/heart_rate_zone.dart';
import 'package:flutter_material_color_picker/flutter_material_color_picker.dart';
class AddHeartRateZoneScreen extends StatefulWidget {
const AddHeartRateZoneScreen({
Key key,
this.heartRateZone,
this.base,
}) : super(key: key);
const AddHeartRateZoneScreen(
{Key key, this.heartRateZone, this.base, @required this.numberOfZones})
: super(key: key);
final HeartRateZone heartRateZone;
final int base;
final int numberOfZones;
@override
_AddHeartRateZoneScreenState createState() => _AddHeartRateZoneScreenState();
......@@ -35,7 +34,7 @@ class _AddHeartRateZoneScreenState extends State<AddHeartRateZoneScreen> {
Navigator.of(context).pop();
MaterialColorPicker(
onColorChange: (Color color) =>
widget.heartRateZone.color = color.value,
widget.heartRateZone.color = color.value,
selectedColor: Color(widget.heartRateZone.color));
},
),
......@@ -49,7 +48,8 @@ class _AddHeartRateZoneScreenState extends State<AddHeartRateZoneScreen> {
_openDialog(
MaterialColorPicker(
selectedColor: Color(widget.heartRateZone.color),
onColorChange: (Color color) => setState(() => widget.heartRateZone.color = color.value),
onColorChange: (Color color) =>
setState(() => widget.heartRateZone.color = color.value),
onBack: () {},
),
);
......@@ -58,13 +58,15 @@ class _AddHeartRateZoneScreenState extends State<AddHeartRateZoneScreen> {
@override
Widget build(BuildContext context) {
final TextEditingController lowerLimitController =
TextEditingController(text: widget.heartRateZone.lowerLimit.toString());
TextEditingController(text: widget.heartRateZone.lowerLimit.toString());
final TextEditingController upperLimitController =
TextEditingController(text: widget.heartRateZone.upperLimit.toString());
final TextEditingController lowerPercentageController = TextEditingController(
text: widget.heartRateZone.lowerPercentage.toString());
final TextEditingController upperPercentageController = TextEditingController(
text: widget.heartRateZone.upperPercentage.toString());
TextEditingController(text: widget.heartRateZone.upperLimit.toString());
final TextEditingController lowerPercentageController =
TextEditingController(
text: widget.heartRateZone.lowerPercentage.toString());
final TextEditingController upperPercentageController =
TextEditingController(
text: widget.heartRateZone.upperPercentage.toString());
return Scaffold(
appBar: AppBar(
......@@ -81,7 +83,8 @@ class _AddHeartRateZoneScreenState extends State<AddHeartRateZoneScreen> {
onChanged: (String value) => widget.heartRateZone.name = value,
),
TextFormField(
decoration: const InputDecoration(labelText: 'Lower Limit in bpm'),
decoration:
const InputDecoration(labelText: 'Lower Limit in bpm'),
controller: lowerLimitController,
keyboardType: TextInputType.number,
onChanged: (String value) {
......@@ -93,7 +96,8 @@ class _AddHeartRateZoneScreenState extends State<AddHeartRateZoneScreen> {
},
),
TextFormField(
decoration: const InputDecoration(labelText: 'Upper Limit in bpm'),
decoration:
const InputDecoration(labelText: 'Upper Limit in bpm'),
controller: upperLimitController,
keyboardType: TextInputType.number,
onChanged: (String value) {
......@@ -105,7 +109,8 @@ class _AddHeartRateZoneScreenState extends State<AddHeartRateZoneScreen> {
},
),
TextFormField(
decoration: const InputDecoration(labelText: 'Lower Percentage in %'),
decoration:
const InputDecoration(labelText: 'Lower Percentage in %'),
controller: lowerPercentageController,
keyboardType: TextInputType.number,
onChanged: (String value) {
......@@ -117,7 +122,8 @@ class _AddHeartRateZoneScreenState extends State<AddHeartRateZoneScreen> {
},
),
TextFormField(
decoration: const InputDecoration(labelText: 'Upper Percentage in %'),
decoration:
const InputDecoration(labelText: 'Upper Percentage in %'),
controller: upperPercentageController,
keyboardType: TextInputType.number,
onChanged: (String value) {
......@@ -146,7 +152,9 @@ class _AddHeartRateZoneScreenState extends State<AddHeartRateZoneScreen> {
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
MyButton.delete(onPressed: () => deleteHeartRateZone(context)),
if (widget.numberOfZones > 1)
MyButton.delete(
onPressed: () => deleteHeartRateZone(context)),
const SizedBox(width: 5),
MyButton.cancel(onPressed: () => Navigator.of(context).pop()),
const SizedBox(width: 5),
......
......@@ -10,10 +10,14 @@ import 'package:datetime_picker_formfield/datetime_picker_formfield.dart';
import 'add_power_zone_screen.dart';
class AddPowerZoneSchemaScreen extends StatefulWidget {
const AddPowerZoneSchemaScreen({Key key, this.powerZoneSchema})
: super(key: key);
const AddPowerZoneSchemaScreen({
Key key,
this.powerZoneSchema,
@required this.numberOfSchemas,
}) : super(key: key);
final PowerZoneSchema powerZoneSchema;
final int numberOfSchemas;
@override
_AddPowerZoneSchemaScreenState createState() =>
......@@ -46,8 +50,7 @@ class _AddPowerZoneSchemaScreenState extends State<AddPowerZoneSchemaScreen> {
margin: EdgeInsets.all(40),
child: ListTile(
leading: MyIcon.warning,
title:
Text('Instructions to update your current base value'),
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'
......@@ -116,9 +119,11 @@ class _AddPowerZoneSchemaScreenState extends State<AddPowerZoneSchemaScreen> {
await Navigator.push(
context,
MaterialPageRoute<BuildContext>(
builder: (BuildContext context) => AddPowerZoneScreen(
builder: (BuildContext context) =>
AddPowerZoneScreen(
powerZone: powerZone,
base: widget.powerZoneSchema.base,
numberOfZones: powerZones.length,
),
),
);
......@@ -140,9 +145,10 @@ class _AddPowerZoneSchemaScreenState extends State<AddPowerZoneSchemaScreen> {
context,
MaterialPageRoute<BuildContext>(
builder: (BuildContext context) => AddPowerZoneScreen(
powerZone:
PowerZone(powerZoneSchema: widget.powerZoneSchema),
powerZone: PowerZone(
powerZoneSchema: widget.powerZoneSchema),
base: widget.powerZoneSchema.base,
numberOfZones: powerZones.length,
),
),
);
......@@ -155,11 +161,12 @@ class _AddPowerZoneSchemaScreenState extends State<AddPowerZoneSchemaScreen> {
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
MyButton.delete(
onPressed: () => deletePowerZoneSchema(
powerZoneSchema: widget.powerZoneSchema,
if (widget.numberOfSchemas > 1)
MyButton.delete(
onPressed: () => deletePowerZoneSchema(
powerZoneSchema: widget.powerZoneSchema,
),
),
),
const SizedBox(width: 5),
MyButton.cancel(onPressed: () => Navigator.of(context).pop()),
const SizedBox(width: 5),
......@@ -192,10 +199,8 @@ class _AddPowerZoneSchemaScreenState extends State<AddPowerZoneSchemaScreen> {
setState(() {
widget.powerZoneSchema.base = base;
for (final PowerZone powerZone in powerZones) {
powerZone.lowerLimit =
(powerZone.lowerPercentage * base / 100).round();
powerZone.upperLimit =
(powerZone.upperPercentage * base / 100).round();
powerZone.lowerLimit = (powerZone.lowerPercentage * base / 100).round();
powerZone.upperLimit = (powerZone.upperPercentage * base / 100).round();
}
});
return null;
......
......@@ -9,10 +9,12 @@ class AddPowerZoneScreen extends StatefulWidget {
Key key,
this.powerZone,
this.base,
@required this.numberOfZones
}) : super(key: key);
final PowerZone powerZone;
final int base;
final int numberOfZones;
@override
_AddPowerZoneScreenState createState() => _AddPowerZoneScreenState();
......@@ -146,6 +148,7 @@ class _AddPowerZoneScreenState extends State<AddPowerZoneScreen> {
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
if (widget.numberOfZones > 1)
MyButton.delete(onPressed: () => deletePowerZone(context)),
const SizedBox(width: 5),
MyButton.cancel(onPressed: () => Navigator.of(context).pop()),
......
......@@ -9,9 +9,11 @@ class AddWeightScreen extends StatelessWidget {
const AddWeightScreen({
Key key,
this.weight,
@required this.numberOfWeights
}) : super(key: key);
final Weight weight;
final int numberOfWeights;
@override
Widget build(BuildContext context) {
......@@ -48,6 +50,7 @@ class AddWeightScreen extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
if (numberOfWeights > 1)
MyButton.delete(
onPressed: () => deleteWeight(context),
),
......
......@@ -41,43 +41,46 @@ class _AthleteBodyWeightWidgetState extends State<AthleteBodyWeightWidget> {
if (weights != null) {
if (weights.isNotEmpty) {
rows = (weights.length < 8) ? weights.length : 8;
return SingleChildScrollView(
child: PaginatedDataTable(
header: Row(
children: <Widget>[
MyButton.add(
child: const Text('New weighting'),
onPressed: () async {
await Navigator.push(
context,
MaterialPageRoute<BuildContext>(
builder: (BuildContext context) => AddWeightScreen(
weight: Weight(athlete: widget.athlete),
return SingleChildScrollView(
child: PaginatedDataTable(
header: Row(
children: <Widget>[
MyButton.add(
child: const Text('New weighting'),
onPressed: () async {
await Navigator.push(
context,
MaterialPageRoute<BuildContext>(
builder: (BuildContext context) => AddWeightScreen(
weight: Weight(
athlete: widget.athlete,
),
numberOfWeights: weights.length,
),
);
getData();
},
),
const Spacer(),
],
),
columns: const <DataColumn>[
DataColumn(label: Text('Date')),
DataColumn(
label: Text('Weight'),
numeric: true,
),
);
getData();
},
),
DataColumn(label: Text('Edit'))
const Spacer(),
],
rowsPerPage: 8,
source: BodyWeightSource(
weights: weights,
context: context,
callback: getData,
),
columns: const <DataColumn>[
DataColumn(label: Text('Date')),
DataColumn(
label: Text('Weight'),
numeric: true,
),
DataColumn(label: Text('Edit'))
],
rowsPerPage: 8,
source: BodyWeightSource(
weights: weights,
context: context,
callback: getData,
),
);
),
);
} else {
return Column(
children: <Widget>[
......@@ -115,6 +118,7 @@ You can change these later.
MaterialPageRoute<BuildContext>(
builder: (BuildContext context) => AddWeightScreen(
weight: Weight(athlete: widget.athlete),
numberOfWeights: weights.length,
),
),
);
......@@ -201,8 +205,10 @@ class BodyWeightSource extends DataTableSource {
await Navigator.push(
context,
MaterialPageRoute<BuildContext>(
builder: (BuildContext context) =>
AddWeightScreen(weight: weights[index]),
builder: (BuildContext context) => AddWeightScreen(
weight: weights[index],
numberOfWeights: weights.length,
),
),
);
callback();
......
......@@ -79,6 +79,7 @@ class _AthleteHeartRateZoneSchemaWidgetState
builder: (BuildContext context) =>
AddHeartRateZoneSchemaScreen(
heartRateZoneSchema: heartRateZoneSchema,
numberOfSchemas: heartRateZoneSchemas.length,
),
),
);
......@@ -103,6 +104,7 @@ class _AthleteHeartRateZoneSchemaWidgetState
AddHeartRateZoneSchemaScreen(
heartRateZoneSchema:
HeartRateZoneSchema(athlete: widget.athlete),
numberOfSchemas: heartRateZoneSchemas.length,
),
),
);
......@@ -159,6 +161,7 @@ You could also create a schema from scratch.
AddHeartRateZoneSchemaScreen(
heartRateZoneSchema:
HeartRateZoneSchema(athlete: widget.athlete),
numberOfSchemas: heartRateZoneSchemas.length,
),
),
);
......
......@@ -78,6 +78,7 @@ class _AthletePowerZoneSchemaWidgetState
builder: (BuildContext context) =>
AddPowerZoneSchemaScreen(
powerZoneSchema: powerZoneSchema,
numberOfSchemas: powerZoneSchemas.length,
),
),
);
......@@ -102,6 +103,7 @@ class _AthletePowerZoneSchemaWidgetState
AddPowerZoneSchemaScreen(
powerZoneSchema:
PowerZoneSchema(athlete: widget.athlete),
numberOfSchemas: powerZoneSchemas.length,
),
),
);
......@@ -161,6 +163,7 @@ You could also create a schema from scratch.
AddPowerZoneSchemaScreen(
powerZoneSchema:
PowerZoneSchema(athlete: widget.athlete),
numberOfSchemas: powerZoneSchemas.length,
),
),
);
......
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