add functionality to bolus calculation
This commit is contained in:
parent
5c22fc0083
commit
796265b048
11
TODO
11
TODO
@ -15,12 +15,10 @@ MAIN TASKS:
|
|||||||
☐ total bolus and carbs per entry
|
☐ total bolus and carbs per entry
|
||||||
|
|
||||||
Log Entry:
|
Log Entry:
|
||||||
☐ replace meal and glucose boli with logbolus entities
|
|
||||||
☐ check for multiple active events with temporary basal/bolus profiles (smallest covered time frame counts)
|
☐ check for multiple active events with temporary basal/bolus profiles (smallest covered time frame counts)
|
||||||
☐ provide splitting functionality for overlapping events
|
☐ provide splitting functionality for overlapping events
|
||||||
|
☐ provide percentage functionality for delayed bolus
|
||||||
Event Types:
|
☐ get rid of useless cancellation warnings
|
||||||
☐ implement reminders as push notifications
|
|
||||||
|
|
||||||
Settings:
|
Settings:
|
||||||
☐ add objectbox class and use instead of shared preferences
|
☐ add objectbox class and use instead of shared preferences
|
||||||
@ -37,15 +35,20 @@ FUTURE TASKS:
|
|||||||
☐ account for deleted/disabled elements in dropdowns
|
☐ account for deleted/disabled elements in dropdowns
|
||||||
☐ hide dropdown overlay on tapping anywhere else (especially menu)
|
☐ hide dropdown overlay on tapping anywhere else (especially menu)
|
||||||
☐ add clear button to dropdown (or all text fields?)
|
☐ add clear button to dropdown (or all text fields?)
|
||||||
|
☐ check through all detail forms and set required fields/according messages
|
||||||
|
☐ find a better way to work with multiple measurements (or disable it?)
|
||||||
Log Overview:
|
Log Overview:
|
||||||
☐ add pagination
|
☐ add pagination
|
||||||
Event Types:
|
Event Types:
|
||||||
☐ add colors as indicators for log entries (and later graphs in reports)
|
☐ add colors as indicators for log entries (and later graphs in reports)
|
||||||
|
☐ implement reminders as push notifications
|
||||||
Settings:
|
Settings:
|
||||||
☐ add option to hide extra customization options (ie. changing pre calculated values)
|
☐ add option to hide extra customization options (ie. changing pre calculated values)
|
||||||
☐ add setting for decimal places
|
☐ add setting for decimal places
|
||||||
|
|
||||||
Archive:
|
Archive:
|
||||||
|
✔ display boli correctly @done(21-11-30 04:14) @project(MAIN TASKS.Log Entry)
|
||||||
|
✔ replace meal and glucose boli with logbolus entities @done(21-11-30 03:56) @project(MAIN TASKS.Log Entry)
|
||||||
✔ adjust/debug active events view @done(21-11-26 22:54) @project(MAIN TASKS.Log Overview)
|
✔ adjust/debug active events view @done(21-11-26 22:54) @project(MAIN TASKS.Log Overview)
|
||||||
✔ show all active events, not just those assigned to the entry @done(21-11-26 22:12) @project(MAIN TASKS.Log Entry)
|
✔ show all active events, not just those assigned to the entry @done(21-11-26 22:12) @project(MAIN TASKS.Log Entry)
|
||||||
✔ add active events view (as main menu item) @done(21-11-26 21:28) @project(MAIN TASKS.Log Overview)
|
✔ add active events view (as main menu item) @done(21-11-26 21:28) @project(MAIN TASKS.Log Overview)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import 'package:diameter/config.dart';
|
import 'package:diameter/config.dart';
|
||||||
import 'package:diameter/main.dart';
|
import 'package:diameter/main.dart';
|
||||||
import 'package:diameter/models/bolus_profile.dart';
|
import 'package:diameter/models/bolus_profile.dart';
|
||||||
import 'package:diameter/models/log_event.dart';
|
|
||||||
import 'package:diameter/utils/date_time_utils.dart';
|
import 'package:diameter/utils/date_time_utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:objectbox/objectbox.dart';
|
import 'package:objectbox/objectbox.dart';
|
||||||
|
@ -15,15 +15,19 @@ class LogBolus {
|
|||||||
double units;
|
double units;
|
||||||
double? carbs;
|
double? carbs;
|
||||||
int? delay;
|
int? delay;
|
||||||
int? mgPerDl;
|
int? mgPerDlCurrent;
|
||||||
double? mmolPerL;
|
int? mgPerDlTarget;
|
||||||
|
int? mgPerDlCorrection;
|
||||||
|
double? mmolPerLCurrent;
|
||||||
|
double? mmolPerLTarget;
|
||||||
|
double? mmolPerLCorrection;
|
||||||
bool setManually;
|
bool setManually;
|
||||||
String? notes;
|
String? notes;
|
||||||
|
|
||||||
// relations
|
// relations
|
||||||
final logEntry = ToOne<LogEntry>();
|
final logEntry = ToOne<LogEntry>();
|
||||||
final rate = ToOne<Bolus>();
|
final rate = ToOne<Bolus>();
|
||||||
final meal = ToOne<LogMeal?>();
|
final meal = ToOne<LogMeal>();
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
LogBolus({
|
LogBolus({
|
||||||
@ -32,8 +36,12 @@ class LogBolus {
|
|||||||
this.units = 0,
|
this.units = 0,
|
||||||
this.carbs,
|
this.carbs,
|
||||||
this.delay,
|
this.delay,
|
||||||
this.mgPerDl,
|
this.mgPerDlCurrent,
|
||||||
this.mmolPerL,
|
this.mgPerDlTarget,
|
||||||
|
this.mgPerDlCorrection,
|
||||||
|
this.mmolPerLCurrent,
|
||||||
|
this.mmolPerLTarget,
|
||||||
|
this.mmolPerLCorrection,
|
||||||
this.setManually = false,
|
this.setManually = false,
|
||||||
this.notes,
|
this.notes,
|
||||||
});
|
});
|
||||||
@ -48,6 +56,12 @@ class LogBolus {
|
|||||||
return builder.build().find();
|
return builder.build().find();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool glucoseBolusForEntryExists(int id) {
|
||||||
|
QueryBuilder<LogBolus> builder = box.query(LogBolus_.deleted.equals(false).and(LogBolus_.mgPerDlCorrection.notNull()));
|
||||||
|
builder.link(LogBolus_.logEntry, LogEntry_.id.equals(id));
|
||||||
|
return builder.build().find().isNotEmpty;
|
||||||
|
}
|
||||||
|
|
||||||
static void remove(int id) {
|
static void remove(int id) {
|
||||||
final item = box.get(id);
|
final item = box.get(id);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
|
import 'package:diameter/config.dart';
|
||||||
import 'package:diameter/main.dart';
|
import 'package:diameter/main.dart';
|
||||||
|
import 'package:diameter/models/log_bolus.dart';
|
||||||
import 'package:diameter/utils/date_time_utils.dart';
|
import 'package:diameter/utils/date_time_utils.dart';
|
||||||
import 'package:objectbox/objectbox.dart';
|
import 'package:objectbox/objectbox.dart';
|
||||||
import 'package:diameter/objectbox.g.dart' show LogEntry_;
|
import 'package:diameter/objectbox.g.dart' show LogEntry_;
|
||||||
@ -14,9 +16,6 @@ class LogEntry {
|
|||||||
DateTime time;
|
DateTime time;
|
||||||
int? mgPerDl;
|
int? mgPerDl;
|
||||||
double? mmolPerL;
|
double? mmolPerL;
|
||||||
double? bolusGlucose;
|
|
||||||
int? delayedBolusDuration;
|
|
||||||
double? delayedBolusRate;
|
|
||||||
String? notes;
|
String? notes;
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
@ -26,9 +25,6 @@ class LogEntry {
|
|||||||
required this.time,
|
required this.time,
|
||||||
this.mgPerDl,
|
this.mgPerDl,
|
||||||
this.mmolPerL,
|
this.mmolPerL,
|
||||||
this.bolusGlucose,
|
|
||||||
this.delayedBolusDuration,
|
|
||||||
this.delayedBolusRate,
|
|
||||||
this.notes,
|
this.notes,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -45,10 +41,20 @@ class LogEntry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool hasUncorrectedGlucose(int id) {
|
||||||
|
final entry = box.get(id);
|
||||||
|
if (((entry?.mgPerDl ?? 0) > moderateGlucoseMgPerDl ||
|
||||||
|
(entry?.mmolPerL ?? 0) > moderateGlucoseMmolPerL)) {
|
||||||
|
return !LogBolus.glucoseBolusForEntryExists(id);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static Map<DateTime, List<LogEntry>> getDailyEntryMap() {
|
static Map<DateTime, List<LogEntry>> getDailyEntryMap() {
|
||||||
Map<DateTime, List<LogEntry>> dateMap = <DateTime, List<LogEntry>>{};
|
Map<DateTime, List<LogEntry>> dateMap = <DateTime, List<LogEntry>>{};
|
||||||
|
|
||||||
QueryBuilder<LogEntry> allByDate = box.query(LogEntry_.deleted.equals(false))
|
QueryBuilder<LogEntry> allByDate = box
|
||||||
|
.query(LogEntry_.deleted.equals(false))
|
||||||
..order(LogEntry_.time, flags: Order.descending);
|
..order(LogEntry_.time, flags: Order.descending);
|
||||||
List<LogEntry> entries = allByDate.build().find();
|
List<LogEntry> entries = allByDate.build().find();
|
||||||
DateTime? date;
|
DateTime? date;
|
||||||
@ -61,7 +67,6 @@ class LogEntry {
|
|||||||
return dateMap;
|
return dateMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return DateTimeUtils.displayDateTime(time);
|
return DateTimeUtils.displayDateTime(time);
|
||||||
|
@ -3,9 +3,8 @@ import 'package:diameter/models/basal_profile.dart';
|
|||||||
import 'package:diameter/models/bolus_profile.dart';
|
import 'package:diameter/models/bolus_profile.dart';
|
||||||
import 'package:diameter/models/log_entry.dart';
|
import 'package:diameter/models/log_entry.dart';
|
||||||
import 'package:diameter/models/log_event_type.dart';
|
import 'package:diameter/models/log_event_type.dart';
|
||||||
import 'package:diameter/objectbox.g.dart';
|
|
||||||
// ignore: unnecessary_import
|
|
||||||
import 'package:objectbox/objectbox.dart';
|
import 'package:objectbox/objectbox.dart';
|
||||||
|
import 'package:diameter/objectbox.g.dart' show LogEvent_, LogEntry_;
|
||||||
|
|
||||||
@Entity(uid: 4303325892753185970)
|
@Entity(uid: 4303325892753185970)
|
||||||
class LogEvent {
|
class LogEvent {
|
||||||
|
@ -19,8 +19,6 @@ class LogMeal {
|
|||||||
double? carbsRatio;
|
double? carbsRatio;
|
||||||
double? portionSize;
|
double? portionSize;
|
||||||
double? carbsPerPortion;
|
double? carbsPerPortion;
|
||||||
int? delayedBolusDuration;
|
|
||||||
double? delayedBolusRate;
|
|
||||||
String? notes;
|
String? notes;
|
||||||
double? bolus;
|
double? bolus;
|
||||||
|
|
||||||
@ -41,9 +39,6 @@ class LogMeal {
|
|||||||
this.carbsRatio,
|
this.carbsRatio,
|
||||||
this.portionSize,
|
this.portionSize,
|
||||||
this.carbsPerPortion,
|
this.carbsPerPortion,
|
||||||
this.bolus,
|
|
||||||
this.delayedBolusDuration,
|
|
||||||
this.delayedBolusRate,
|
|
||||||
this.notes,
|
this.notes,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -196,21 +196,6 @@
|
|||||||
"name": "mmolPerL",
|
"name": "mmolPerL",
|
||||||
"type": 8
|
"type": 8
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"id": "5:3678829169126156351",
|
|
||||||
"name": "bolusGlucose",
|
|
||||||
"type": 8
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "6:1568597071506264632",
|
|
||||||
"name": "delayedBolusDuration",
|
|
||||||
"type": 6
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "7:8795268969829293398",
|
|
||||||
"name": "delayedBolusRate",
|
|
||||||
"type": 8
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"id": "8:6492273995038150006",
|
"id": "8:6492273995038150006",
|
||||||
"name": "notes",
|
"name": "notes",
|
||||||
@ -226,7 +211,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "7:4303325892753185970",
|
"id": "7:4303325892753185970",
|
||||||
"lastPropertyId": "11:2013538196800336796",
|
"lastPropertyId": "12:3041952167628926163",
|
||||||
"name": "LogEvent",
|
"name": "LogEvent",
|
||||||
"properties": [
|
"properties": [
|
||||||
{
|
{
|
||||||
@ -299,6 +284,11 @@
|
|||||||
"flags": 520,
|
"flags": 520,
|
||||||
"indexId": "26:4562998391990896273",
|
"indexId": "26:4562998391990896273",
|
||||||
"relationTarget": "BasalProfile"
|
"relationTarget": "BasalProfile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "12:3041952167628926163",
|
||||||
|
"name": "reminderDuration",
|
||||||
|
"type": 6
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"relations": []
|
"relations": []
|
||||||
@ -394,16 +384,6 @@
|
|||||||
"name": "bolus",
|
"name": "bolus",
|
||||||
"type": 8
|
"type": 8
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"id": "7:3247926313599127440",
|
|
||||||
"name": "delayedBolusDuration",
|
|
||||||
"type": 6
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "8:8789440370359282572",
|
|
||||||
"name": "delayedBolusRate",
|
|
||||||
"type": 8
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"id": "9:1920579694098037947",
|
"id": "9:1920579694098037947",
|
||||||
"name": "notes",
|
"name": "notes",
|
||||||
@ -688,7 +668,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "14:8033487006694871160",
|
"id": "14:8033487006694871160",
|
||||||
"lastPropertyId": "12:4765038304548427459",
|
"lastPropertyId": "18:7503231998671134983",
|
||||||
"name": "LogBolus",
|
"name": "LogBolus",
|
||||||
"properties": [
|
"properties": [
|
||||||
{
|
{
|
||||||
@ -712,16 +692,6 @@
|
|||||||
"name": "delay",
|
"name": "delay",
|
||||||
"type": 6
|
"type": 6
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"id": "5:6855574218883169324",
|
|
||||||
"name": "mgPerDl",
|
|
||||||
"type": 6
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "6:5313708456544000157",
|
|
||||||
"name": "mmolPerL",
|
|
||||||
"type": 8
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"id": "7:3065420032567707091",
|
"id": "7:3065420032567707091",
|
||||||
"name": "setManually",
|
"name": "setManually",
|
||||||
@ -760,6 +730,36 @@
|
|||||||
"id": "12:4765038304548427459",
|
"id": "12:4765038304548427459",
|
||||||
"name": "deleted",
|
"name": "deleted",
|
||||||
"type": 1
|
"type": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "13:2530431967957143684",
|
||||||
|
"name": "mgPerDlCurrent",
|
||||||
|
"type": 6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "14:5210229118898251877",
|
||||||
|
"name": "mgPerDlTarget",
|
||||||
|
"type": 6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "15:657840864788362204",
|
||||||
|
"name": "mgPerDlCorrection",
|
||||||
|
"type": 6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "16:3999403624434995450",
|
||||||
|
"name": "mmolPerLCurrent",
|
||||||
|
"type": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "17:2852253735546692099",
|
||||||
|
"name": "mmolPerLTarget",
|
||||||
|
"type": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "18:7503231998671134983",
|
||||||
|
"name": "mmolPerLCorrection",
|
||||||
|
"type": 8
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"relations": []
|
"relations": []
|
||||||
@ -825,7 +825,14 @@
|
|||||||
9003780003858349085,
|
9003780003858349085,
|
||||||
5421422436108145565,
|
5421422436108145565,
|
||||||
7741631874181070179,
|
7741631874181070179,
|
||||||
5471636804765937328
|
5471636804765937328,
|
||||||
|
6855574218883169324,
|
||||||
|
5313708456544000157,
|
||||||
|
3678829169126156351,
|
||||||
|
1568597071506264632,
|
||||||
|
8795268969829293398,
|
||||||
|
3247926313599127440,
|
||||||
|
8789440370359282572
|
||||||
],
|
],
|
||||||
"retiredRelationUids": [],
|
"retiredRelationUids": [],
|
||||||
"version": 1
|
"version": 1
|
||||||
|
@ -218,21 +218,6 @@ final _entities = <ModelEntity>[
|
|||||||
name: 'mmolPerL',
|
name: 'mmolPerL',
|
||||||
type: 8,
|
type: 8,
|
||||||
flags: 0),
|
flags: 0),
|
||||||
ModelProperty(
|
|
||||||
id: const IdUid(5, 3678829169126156351),
|
|
||||||
name: 'bolusGlucose',
|
|
||||||
type: 8,
|
|
||||||
flags: 0),
|
|
||||||
ModelProperty(
|
|
||||||
id: const IdUid(6, 1568597071506264632),
|
|
||||||
name: 'delayedBolusDuration',
|
|
||||||
type: 6,
|
|
||||||
flags: 0),
|
|
||||||
ModelProperty(
|
|
||||||
id: const IdUid(7, 8795268969829293398),
|
|
||||||
name: 'delayedBolusRate',
|
|
||||||
type: 8,
|
|
||||||
flags: 0),
|
|
||||||
ModelProperty(
|
ModelProperty(
|
||||||
id: const IdUid(8, 6492273995038150006),
|
id: const IdUid(8, 6492273995038150006),
|
||||||
name: 'notes',
|
name: 'notes',
|
||||||
@ -249,7 +234,7 @@ final _entities = <ModelEntity>[
|
|||||||
ModelEntity(
|
ModelEntity(
|
||||||
id: const IdUid(7, 4303325892753185970),
|
id: const IdUid(7, 4303325892753185970),
|
||||||
name: 'LogEvent',
|
name: 'LogEvent',
|
||||||
lastPropertyId: const IdUid(11, 2013538196800336796),
|
lastPropertyId: const IdUid(12, 3041952167628926163),
|
||||||
flags: 0,
|
flags: 0,
|
||||||
properties: <ModelProperty>[
|
properties: <ModelProperty>[
|
||||||
ModelProperty(
|
ModelProperty(
|
||||||
@ -316,7 +301,12 @@ final _entities = <ModelEntity>[
|
|||||||
type: 11,
|
type: 11,
|
||||||
flags: 520,
|
flags: 520,
|
||||||
indexId: const IdUid(26, 4562998391990896273),
|
indexId: const IdUid(26, 4562998391990896273),
|
||||||
relationTarget: 'BasalProfile')
|
relationTarget: 'BasalProfile'),
|
||||||
|
ModelProperty(
|
||||||
|
id: const IdUid(12, 3041952167628926163),
|
||||||
|
name: 'reminderDuration',
|
||||||
|
type: 6,
|
||||||
|
flags: 0)
|
||||||
],
|
],
|
||||||
relations: <ModelRelation>[],
|
relations: <ModelRelation>[],
|
||||||
backlinks: <ModelBacklink>[]),
|
backlinks: <ModelBacklink>[]),
|
||||||
@ -409,16 +399,6 @@ final _entities = <ModelEntity>[
|
|||||||
name: 'bolus',
|
name: 'bolus',
|
||||||
type: 8,
|
type: 8,
|
||||||
flags: 0),
|
flags: 0),
|
||||||
ModelProperty(
|
|
||||||
id: const IdUid(7, 3247926313599127440),
|
|
||||||
name: 'delayedBolusDuration',
|
|
||||||
type: 6,
|
|
||||||
flags: 0),
|
|
||||||
ModelProperty(
|
|
||||||
id: const IdUid(8, 8789440370359282572),
|
|
||||||
name: 'delayedBolusRate',
|
|
||||||
type: 8,
|
|
||||||
flags: 0),
|
|
||||||
ModelProperty(
|
ModelProperty(
|
||||||
id: const IdUid(9, 1920579694098037947),
|
id: const IdUid(9, 1920579694098037947),
|
||||||
name: 'notes',
|
name: 'notes',
|
||||||
@ -688,7 +668,7 @@ final _entities = <ModelEntity>[
|
|||||||
ModelEntity(
|
ModelEntity(
|
||||||
id: const IdUid(14, 8033487006694871160),
|
id: const IdUid(14, 8033487006694871160),
|
||||||
name: 'LogBolus',
|
name: 'LogBolus',
|
||||||
lastPropertyId: const IdUid(12, 4765038304548427459),
|
lastPropertyId: const IdUid(18, 7503231998671134983),
|
||||||
flags: 0,
|
flags: 0,
|
||||||
properties: <ModelProperty>[
|
properties: <ModelProperty>[
|
||||||
ModelProperty(
|
ModelProperty(
|
||||||
@ -711,16 +691,6 @@ final _entities = <ModelEntity>[
|
|||||||
name: 'delay',
|
name: 'delay',
|
||||||
type: 6,
|
type: 6,
|
||||||
flags: 0),
|
flags: 0),
|
||||||
ModelProperty(
|
|
||||||
id: const IdUid(5, 6855574218883169324),
|
|
||||||
name: 'mgPerDl',
|
|
||||||
type: 6,
|
|
||||||
flags: 0),
|
|
||||||
ModelProperty(
|
|
||||||
id: const IdUid(6, 5313708456544000157),
|
|
||||||
name: 'mmolPerL',
|
|
||||||
type: 8,
|
|
||||||
flags: 0),
|
|
||||||
ModelProperty(
|
ModelProperty(
|
||||||
id: const IdUid(7, 3065420032567707091),
|
id: const IdUid(7, 3065420032567707091),
|
||||||
name: 'setManually',
|
name: 'setManually',
|
||||||
@ -756,6 +726,36 @@ final _entities = <ModelEntity>[
|
|||||||
id: const IdUid(12, 4765038304548427459),
|
id: const IdUid(12, 4765038304548427459),
|
||||||
name: 'deleted',
|
name: 'deleted',
|
||||||
type: 1,
|
type: 1,
|
||||||
|
flags: 0),
|
||||||
|
ModelProperty(
|
||||||
|
id: const IdUid(13, 2530431967957143684),
|
||||||
|
name: 'mgPerDlCurrent',
|
||||||
|
type: 6,
|
||||||
|
flags: 0),
|
||||||
|
ModelProperty(
|
||||||
|
id: const IdUid(14, 5210229118898251877),
|
||||||
|
name: 'mgPerDlTarget',
|
||||||
|
type: 6,
|
||||||
|
flags: 0),
|
||||||
|
ModelProperty(
|
||||||
|
id: const IdUid(15, 657840864788362204),
|
||||||
|
name: 'mgPerDlCorrection',
|
||||||
|
type: 6,
|
||||||
|
flags: 0),
|
||||||
|
ModelProperty(
|
||||||
|
id: const IdUid(16, 3999403624434995450),
|
||||||
|
name: 'mmolPerLCurrent',
|
||||||
|
type: 8,
|
||||||
|
flags: 0),
|
||||||
|
ModelProperty(
|
||||||
|
id: const IdUid(17, 2852253735546692099),
|
||||||
|
name: 'mmolPerLTarget',
|
||||||
|
type: 8,
|
||||||
|
flags: 0),
|
||||||
|
ModelProperty(
|
||||||
|
id: const IdUid(18, 7503231998671134983),
|
||||||
|
name: 'mmolPerLCorrection',
|
||||||
|
type: 8,
|
||||||
flags: 0)
|
flags: 0)
|
||||||
],
|
],
|
||||||
relations: <ModelRelation>[],
|
relations: <ModelRelation>[],
|
||||||
@ -838,7 +838,14 @@ ModelDefinition getObjectBoxModel() {
|
|||||||
9003780003858349085,
|
9003780003858349085,
|
||||||
5421422436108145565,
|
5421422436108145565,
|
||||||
7741631874181070179,
|
7741631874181070179,
|
||||||
5471636804765937328
|
5471636804765937328,
|
||||||
|
6855574218883169324,
|
||||||
|
5313708456544000157,
|
||||||
|
3678829169126156351,
|
||||||
|
1568597071506264632,
|
||||||
|
8795268969829293398,
|
||||||
|
3247926313599127440,
|
||||||
|
8789440370359282572
|
||||||
],
|
],
|
||||||
retiredRelationUids: const [],
|
retiredRelationUids: const [],
|
||||||
modelVersion: 5,
|
modelVersion: 5,
|
||||||
@ -1023,9 +1030,6 @@ ModelDefinition getObjectBoxModel() {
|
|||||||
fbb.addInt64(1, object.time.millisecondsSinceEpoch);
|
fbb.addInt64(1, object.time.millisecondsSinceEpoch);
|
||||||
fbb.addInt64(2, object.mgPerDl);
|
fbb.addInt64(2, object.mgPerDl);
|
||||||
fbb.addFloat64(3, object.mmolPerL);
|
fbb.addFloat64(3, object.mmolPerL);
|
||||||
fbb.addFloat64(4, object.bolusGlucose);
|
|
||||||
fbb.addInt64(5, object.delayedBolusDuration);
|
|
||||||
fbb.addFloat64(6, object.delayedBolusRate);
|
|
||||||
fbb.addOffset(7, notesOffset);
|
fbb.addOffset(7, notesOffset);
|
||||||
fbb.addBool(8, object.deleted);
|
fbb.addBool(8, object.deleted);
|
||||||
fbb.finish(fbb.endTable());
|
fbb.finish(fbb.endTable());
|
||||||
@ -1045,12 +1049,6 @@ ModelDefinition getObjectBoxModel() {
|
|||||||
.vTableGetNullable(buffer, rootOffset, 8),
|
.vTableGetNullable(buffer, rootOffset, 8),
|
||||||
mmolPerL: const fb.Float64Reader()
|
mmolPerL: const fb.Float64Reader()
|
||||||
.vTableGetNullable(buffer, rootOffset, 10),
|
.vTableGetNullable(buffer, rootOffset, 10),
|
||||||
bolusGlucose: const fb.Float64Reader()
|
|
||||||
.vTableGetNullable(buffer, rootOffset, 12),
|
|
||||||
delayedBolusDuration: const fb.Int64Reader()
|
|
||||||
.vTableGetNullable(buffer, rootOffset, 14),
|
|
||||||
delayedBolusRate: const fb.Float64Reader()
|
|
||||||
.vTableGetNullable(buffer, rootOffset, 16),
|
|
||||||
notes: const fb.StringReader()
|
notes: const fb.StringReader()
|
||||||
.vTableGetNullable(buffer, rootOffset, 18));
|
.vTableGetNullable(buffer, rootOffset, 18));
|
||||||
|
|
||||||
@ -1073,7 +1071,7 @@ ModelDefinition getObjectBoxModel() {
|
|||||||
objectToFB: (LogEvent object, fb.Builder fbb) {
|
objectToFB: (LogEvent object, fb.Builder fbb) {
|
||||||
final notesOffset =
|
final notesOffset =
|
||||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||||
fbb.startTable(12);
|
fbb.startTable(13);
|
||||||
fbb.addInt64(0, object.id);
|
fbb.addInt64(0, object.id);
|
||||||
fbb.addInt64(1, object.time.millisecondsSinceEpoch);
|
fbb.addInt64(1, object.time.millisecondsSinceEpoch);
|
||||||
fbb.addInt64(2, object.endTime?.millisecondsSinceEpoch);
|
fbb.addInt64(2, object.endTime?.millisecondsSinceEpoch);
|
||||||
@ -1085,6 +1083,7 @@ ModelDefinition getObjectBoxModel() {
|
|||||||
fbb.addBool(8, object.deleted);
|
fbb.addBool(8, object.deleted);
|
||||||
fbb.addInt64(9, object.bolusProfile.targetId);
|
fbb.addInt64(9, object.bolusProfile.targetId);
|
||||||
fbb.addInt64(10, object.basalProfile.targetId);
|
fbb.addInt64(10, object.basalProfile.targetId);
|
||||||
|
fbb.addInt64(11, object.reminderDuration);
|
||||||
fbb.finish(fbb.endTable());
|
fbb.finish(fbb.endTable());
|
||||||
return object.id;
|
return object.id;
|
||||||
},
|
},
|
||||||
@ -1104,6 +1103,8 @@ ModelDefinition getObjectBoxModel() {
|
|||||||
: DateTime.fromMillisecondsSinceEpoch(endTimeValue),
|
: DateTime.fromMillisecondsSinceEpoch(endTimeValue),
|
||||||
hasEndTime: const fb.BoolReader()
|
hasEndTime: const fb.BoolReader()
|
||||||
.vTableGet(buffer, rootOffset, 10, false),
|
.vTableGet(buffer, rootOffset, 10, false),
|
||||||
|
reminderDuration: const fb.Int64Reader()
|
||||||
|
.vTableGetNullable(buffer, rootOffset, 26),
|
||||||
notes: const fb.StringReader()
|
notes: const fb.StringReader()
|
||||||
.vTableGetNullable(buffer, rootOffset, 12));
|
.vTableGetNullable(buffer, rootOffset, 12));
|
||||||
object.logEntry.targetId =
|
object.logEntry.targetId =
|
||||||
@ -1199,8 +1200,6 @@ ModelDefinition getObjectBoxModel() {
|
|||||||
fbb.addFloat64(3, object.portionSize);
|
fbb.addFloat64(3, object.portionSize);
|
||||||
fbb.addFloat64(4, object.carbsPerPortion);
|
fbb.addFloat64(4, object.carbsPerPortion);
|
||||||
fbb.addFloat64(5, object.bolus);
|
fbb.addFloat64(5, object.bolus);
|
||||||
fbb.addInt64(6, object.delayedBolusDuration);
|
|
||||||
fbb.addFloat64(7, object.delayedBolusRate);
|
|
||||||
fbb.addOffset(8, notesOffset);
|
fbb.addOffset(8, notesOffset);
|
||||||
fbb.addInt64(9, object.logEntry.targetId);
|
fbb.addInt64(9, object.logEntry.targetId);
|
||||||
fbb.addInt64(10, object.meal.targetId);
|
fbb.addInt64(10, object.meal.targetId);
|
||||||
@ -1229,14 +1228,10 @@ ModelDefinition getObjectBoxModel() {
|
|||||||
.vTableGetNullable(buffer, rootOffset, 10),
|
.vTableGetNullable(buffer, rootOffset, 10),
|
||||||
carbsPerPortion: const fb.Float64Reader()
|
carbsPerPortion: const fb.Float64Reader()
|
||||||
.vTableGetNullable(buffer, rootOffset, 12),
|
.vTableGetNullable(buffer, rootOffset, 12),
|
||||||
bolus: const fb.Float64Reader()
|
|
||||||
.vTableGetNullable(buffer, rootOffset, 14),
|
|
||||||
delayedBolusDuration: const fb.Int64Reader()
|
|
||||||
.vTableGetNullable(buffer, rootOffset, 16),
|
|
||||||
delayedBolusRate: const fb.Float64Reader()
|
|
||||||
.vTableGetNullable(buffer, rootOffset, 18),
|
|
||||||
notes: const fb.StringReader()
|
notes: const fb.StringReader()
|
||||||
.vTableGetNullable(buffer, rootOffset, 20));
|
.vTableGetNullable(buffer, rootOffset, 20))
|
||||||
|
..bolus = const fb.Float64Reader()
|
||||||
|
.vTableGetNullable(buffer, rootOffset, 14);
|
||||||
object.logEntry.targetId =
|
object.logEntry.targetId =
|
||||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 22, 0);
|
const fb.Int64Reader().vTableGet(buffer, rootOffset, 22, 0);
|
||||||
object.logEntry.attach(store);
|
object.logEntry.attach(store);
|
||||||
@ -1472,19 +1467,23 @@ ModelDefinition getObjectBoxModel() {
|
|||||||
objectToFB: (LogBolus object, fb.Builder fbb) {
|
objectToFB: (LogBolus object, fb.Builder fbb) {
|
||||||
final notesOffset =
|
final notesOffset =
|
||||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||||
fbb.startTable(13);
|
fbb.startTable(19);
|
||||||
fbb.addInt64(0, object.id);
|
fbb.addInt64(0, object.id);
|
||||||
fbb.addFloat64(1, object.units);
|
fbb.addFloat64(1, object.units);
|
||||||
fbb.addFloat64(2, object.carbs);
|
fbb.addFloat64(2, object.carbs);
|
||||||
fbb.addInt64(3, object.delay);
|
fbb.addInt64(3, object.delay);
|
||||||
fbb.addInt64(4, object.mgPerDl);
|
|
||||||
fbb.addFloat64(5, object.mmolPerL);
|
|
||||||
fbb.addBool(6, object.setManually);
|
fbb.addBool(6, object.setManually);
|
||||||
fbb.addOffset(7, notesOffset);
|
fbb.addOffset(7, notesOffset);
|
||||||
fbb.addInt64(8, object.logEntry.targetId);
|
fbb.addInt64(8, object.logEntry.targetId);
|
||||||
fbb.addInt64(9, object.rate.targetId);
|
fbb.addInt64(9, object.rate.targetId);
|
||||||
fbb.addInt64(10, object.meal.targetId);
|
fbb.addInt64(10, object.meal.targetId);
|
||||||
fbb.addBool(11, object.deleted);
|
fbb.addBool(11, object.deleted);
|
||||||
|
fbb.addInt64(12, object.mgPerDlCurrent);
|
||||||
|
fbb.addInt64(13, object.mgPerDlTarget);
|
||||||
|
fbb.addInt64(14, object.mgPerDlCorrection);
|
||||||
|
fbb.addFloat64(15, object.mmolPerLCurrent);
|
||||||
|
fbb.addFloat64(16, object.mmolPerLTarget);
|
||||||
|
fbb.addFloat64(17, object.mmolPerLCorrection);
|
||||||
fbb.finish(fbb.endTable());
|
fbb.finish(fbb.endTable());
|
||||||
return object.id;
|
return object.id;
|
||||||
},
|
},
|
||||||
@ -1502,10 +1501,18 @@ ModelDefinition getObjectBoxModel() {
|
|||||||
.vTableGetNullable(buffer, rootOffset, 8),
|
.vTableGetNullable(buffer, rootOffset, 8),
|
||||||
delay: const fb.Int64Reader()
|
delay: const fb.Int64Reader()
|
||||||
.vTableGetNullable(buffer, rootOffset, 10),
|
.vTableGetNullable(buffer, rootOffset, 10),
|
||||||
mgPerDl: const fb.Int64Reader()
|
mgPerDlCurrent: const fb.Int64Reader()
|
||||||
.vTableGetNullable(buffer, rootOffset, 12),
|
.vTableGetNullable(buffer, rootOffset, 28),
|
||||||
mmolPerL: const fb.Float64Reader()
|
mgPerDlTarget: const fb.Int64Reader()
|
||||||
.vTableGetNullable(buffer, rootOffset, 14),
|
.vTableGetNullable(buffer, rootOffset, 30),
|
||||||
|
mgPerDlCorrection: const fb.Int64Reader()
|
||||||
|
.vTableGetNullable(buffer, rootOffset, 32),
|
||||||
|
mmolPerLCurrent: const fb.Float64Reader()
|
||||||
|
.vTableGetNullable(buffer, rootOffset, 34),
|
||||||
|
mmolPerLTarget: const fb.Float64Reader()
|
||||||
|
.vTableGetNullable(buffer, rootOffset, 36),
|
||||||
|
mmolPerLCorrection: const fb.Float64Reader()
|
||||||
|
.vTableGetNullable(buffer, rootOffset, 38),
|
||||||
setManually: const fb.BoolReader()
|
setManually: const fb.BoolReader()
|
||||||
.vTableGet(buffer, rootOffset, 16, false),
|
.vTableGet(buffer, rootOffset, 16, false),
|
||||||
notes: const fb.StringReader()
|
notes: const fb.StringReader()
|
||||||
@ -1694,25 +1701,13 @@ class LogEntry_ {
|
|||||||
static final mmolPerL =
|
static final mmolPerL =
|
||||||
QueryDoubleProperty<LogEntry>(_entities[4].properties[3]);
|
QueryDoubleProperty<LogEntry>(_entities[4].properties[3]);
|
||||||
|
|
||||||
/// see [LogEntry.bolusGlucose]
|
|
||||||
static final bolusGlucose =
|
|
||||||
QueryDoubleProperty<LogEntry>(_entities[4].properties[4]);
|
|
||||||
|
|
||||||
/// see [LogEntry.delayedBolusDuration]
|
|
||||||
static final delayedBolusDuration =
|
|
||||||
QueryIntegerProperty<LogEntry>(_entities[4].properties[5]);
|
|
||||||
|
|
||||||
/// see [LogEntry.delayedBolusRate]
|
|
||||||
static final delayedBolusRate =
|
|
||||||
QueryDoubleProperty<LogEntry>(_entities[4].properties[6]);
|
|
||||||
|
|
||||||
/// see [LogEntry.notes]
|
/// see [LogEntry.notes]
|
||||||
static final notes =
|
static final notes =
|
||||||
QueryStringProperty<LogEntry>(_entities[4].properties[7]);
|
QueryStringProperty<LogEntry>(_entities[4].properties[4]);
|
||||||
|
|
||||||
/// see [LogEntry.deleted]
|
/// see [LogEntry.deleted]
|
||||||
static final deleted =
|
static final deleted =
|
||||||
QueryBooleanProperty<LogEntry>(_entities[4].properties[8]);
|
QueryBooleanProperty<LogEntry>(_entities[4].properties[5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// [LogEvent] entity fields to define ObjectBox queries.
|
/// [LogEvent] entity fields to define ObjectBox queries.
|
||||||
@ -1759,6 +1754,10 @@ class LogEvent_ {
|
|||||||
/// see [LogEvent.basalProfile]
|
/// see [LogEvent.basalProfile]
|
||||||
static final basalProfile =
|
static final basalProfile =
|
||||||
QueryRelationToOne<LogEvent, BasalProfile>(_entities[5].properties[10]);
|
QueryRelationToOne<LogEvent, BasalProfile>(_entities[5].properties[10]);
|
||||||
|
|
||||||
|
/// see [LogEvent.reminderDuration]
|
||||||
|
static final reminderDuration =
|
||||||
|
QueryIntegerProperty<LogEvent>(_entities[5].properties[11]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// [LogEventType] entity fields to define ObjectBox queries.
|
/// [LogEventType] entity fields to define ObjectBox queries.
|
||||||
@ -1819,48 +1818,40 @@ class LogMeal_ {
|
|||||||
/// see [LogMeal.bolus]
|
/// see [LogMeal.bolus]
|
||||||
static final bolus = QueryDoubleProperty<LogMeal>(_entities[7].properties[5]);
|
static final bolus = QueryDoubleProperty<LogMeal>(_entities[7].properties[5]);
|
||||||
|
|
||||||
/// see [LogMeal.delayedBolusDuration]
|
|
||||||
static final delayedBolusDuration =
|
|
||||||
QueryIntegerProperty<LogMeal>(_entities[7].properties[6]);
|
|
||||||
|
|
||||||
/// see [LogMeal.delayedBolusRate]
|
|
||||||
static final delayedBolusRate =
|
|
||||||
QueryDoubleProperty<LogMeal>(_entities[7].properties[7]);
|
|
||||||
|
|
||||||
/// see [LogMeal.notes]
|
/// see [LogMeal.notes]
|
||||||
static final notes = QueryStringProperty<LogMeal>(_entities[7].properties[8]);
|
static final notes = QueryStringProperty<LogMeal>(_entities[7].properties[6]);
|
||||||
|
|
||||||
/// see [LogMeal.logEntry]
|
/// see [LogMeal.logEntry]
|
||||||
static final logEntry =
|
static final logEntry =
|
||||||
QueryRelationToOne<LogMeal, LogEntry>(_entities[7].properties[9]);
|
QueryRelationToOne<LogMeal, LogEntry>(_entities[7].properties[7]);
|
||||||
|
|
||||||
/// see [LogMeal.meal]
|
/// see [LogMeal.meal]
|
||||||
static final meal =
|
static final meal =
|
||||||
QueryRelationToOne<LogMeal, Meal>(_entities[7].properties[10]);
|
QueryRelationToOne<LogMeal, Meal>(_entities[7].properties[8]);
|
||||||
|
|
||||||
/// see [LogMeal.mealSource]
|
/// see [LogMeal.mealSource]
|
||||||
static final mealSource =
|
static final mealSource =
|
||||||
QueryRelationToOne<LogMeal, MealSource>(_entities[7].properties[11]);
|
QueryRelationToOne<LogMeal, MealSource>(_entities[7].properties[9]);
|
||||||
|
|
||||||
/// see [LogMeal.mealCategory]
|
/// see [LogMeal.mealCategory]
|
||||||
static final mealCategory =
|
static final mealCategory =
|
||||||
QueryRelationToOne<LogMeal, MealCategory>(_entities[7].properties[12]);
|
QueryRelationToOne<LogMeal, MealCategory>(_entities[7].properties[10]);
|
||||||
|
|
||||||
/// see [LogMeal.mealPortionType]
|
/// see [LogMeal.mealPortionType]
|
||||||
static final mealPortionType =
|
static final mealPortionType =
|
||||||
QueryRelationToOne<LogMeal, MealPortionType>(_entities[7].properties[13]);
|
QueryRelationToOne<LogMeal, MealPortionType>(_entities[7].properties[11]);
|
||||||
|
|
||||||
/// see [LogMeal.portionSizeAccuracy]
|
/// see [LogMeal.portionSizeAccuracy]
|
||||||
static final portionSizeAccuracy =
|
static final portionSizeAccuracy =
|
||||||
QueryRelationToOne<LogMeal, Accuracy>(_entities[7].properties[14]);
|
QueryRelationToOne<LogMeal, Accuracy>(_entities[7].properties[12]);
|
||||||
|
|
||||||
/// see [LogMeal.carbsRatioAccuracy]
|
/// see [LogMeal.carbsRatioAccuracy]
|
||||||
static final carbsRatioAccuracy =
|
static final carbsRatioAccuracy =
|
||||||
QueryRelationToOne<LogMeal, Accuracy>(_entities[7].properties[15]);
|
QueryRelationToOne<LogMeal, Accuracy>(_entities[7].properties[13]);
|
||||||
|
|
||||||
/// see [LogMeal.deleted]
|
/// see [LogMeal.deleted]
|
||||||
static final deleted =
|
static final deleted =
|
||||||
QueryBooleanProperty<LogMeal>(_entities[7].properties[16]);
|
QueryBooleanProperty<LogMeal>(_entities[7].properties[14]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// [Meal] entity fields to define ObjectBox queries.
|
/// [Meal] entity fields to define ObjectBox queries.
|
||||||
@ -2010,37 +2001,53 @@ class LogBolus_ {
|
|||||||
static final delay =
|
static final delay =
|
||||||
QueryIntegerProperty<LogBolus>(_entities[12].properties[3]);
|
QueryIntegerProperty<LogBolus>(_entities[12].properties[3]);
|
||||||
|
|
||||||
/// see [LogBolus.mgPerDl]
|
|
||||||
static final mgPerDl =
|
|
||||||
QueryIntegerProperty<LogBolus>(_entities[12].properties[4]);
|
|
||||||
|
|
||||||
/// see [LogBolus.mmolPerL]
|
|
||||||
static final mmolPerL =
|
|
||||||
QueryDoubleProperty<LogBolus>(_entities[12].properties[5]);
|
|
||||||
|
|
||||||
/// see [LogBolus.setManually]
|
/// see [LogBolus.setManually]
|
||||||
static final setManually =
|
static final setManually =
|
||||||
QueryBooleanProperty<LogBolus>(_entities[12].properties[6]);
|
QueryBooleanProperty<LogBolus>(_entities[12].properties[4]);
|
||||||
|
|
||||||
/// see [LogBolus.notes]
|
/// see [LogBolus.notes]
|
||||||
static final notes =
|
static final notes =
|
||||||
QueryStringProperty<LogBolus>(_entities[12].properties[7]);
|
QueryStringProperty<LogBolus>(_entities[12].properties[5]);
|
||||||
|
|
||||||
/// see [LogBolus.logEntry]
|
/// see [LogBolus.logEntry]
|
||||||
static final logEntry =
|
static final logEntry =
|
||||||
QueryRelationToOne<LogBolus, LogEntry>(_entities[12].properties[8]);
|
QueryRelationToOne<LogBolus, LogEntry>(_entities[12].properties[6]);
|
||||||
|
|
||||||
/// see [LogBolus.rate]
|
/// see [LogBolus.rate]
|
||||||
static final rate =
|
static final rate =
|
||||||
QueryRelationToOne<LogBolus, Bolus>(_entities[12].properties[9]);
|
QueryRelationToOne<LogBolus, Bolus>(_entities[12].properties[7]);
|
||||||
|
|
||||||
/// see [LogBolus.meal]
|
/// see [LogBolus.meal]
|
||||||
static final meal =
|
static final meal =
|
||||||
QueryRelationToOne<LogBolus, LogMeal>(_entities[12].properties[10]);
|
QueryRelationToOne<LogBolus, LogMeal>(_entities[12].properties[8]);
|
||||||
|
|
||||||
/// see [LogBolus.deleted]
|
/// see [LogBolus.deleted]
|
||||||
static final deleted =
|
static final deleted =
|
||||||
QueryBooleanProperty<LogBolus>(_entities[12].properties[11]);
|
QueryBooleanProperty<LogBolus>(_entities[12].properties[9]);
|
||||||
|
|
||||||
|
/// see [LogBolus.mgPerDlCurrent]
|
||||||
|
static final mgPerDlCurrent =
|
||||||
|
QueryIntegerProperty<LogBolus>(_entities[12].properties[10]);
|
||||||
|
|
||||||
|
/// see [LogBolus.mgPerDlTarget]
|
||||||
|
static final mgPerDlTarget =
|
||||||
|
QueryIntegerProperty<LogBolus>(_entities[12].properties[11]);
|
||||||
|
|
||||||
|
/// see [LogBolus.mgPerDlCorrection]
|
||||||
|
static final mgPerDlCorrection =
|
||||||
|
QueryIntegerProperty<LogBolus>(_entities[12].properties[12]);
|
||||||
|
|
||||||
|
/// see [LogBolus.mmolPerLCurrent]
|
||||||
|
static final mmolPerLCurrent =
|
||||||
|
QueryDoubleProperty<LogBolus>(_entities[12].properties[13]);
|
||||||
|
|
||||||
|
/// see [LogBolus.mmolPerLTarget]
|
||||||
|
static final mmolPerLTarget =
|
||||||
|
QueryDoubleProperty<LogBolus>(_entities[12].properties[14]);
|
||||||
|
|
||||||
|
/// see [LogBolus.mmolPerLCorrection]
|
||||||
|
static final mmolPerLCorrection =
|
||||||
|
QueryDoubleProperty<LogBolus>(_entities[12].properties[15]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// [Accuracy] entity fields to define ObjectBox queries.
|
/// [Accuracy] entity fields to define ObjectBox queries.
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
import 'package:diameter/components/dialogs.dart';
|
|
||||||
import 'package:diameter/config.dart';
|
|
||||||
import 'package:diameter/models/log_entry.dart';
|
|
||||||
import 'package:diameter/models/log_event.dart';
|
import 'package:diameter/models/log_event.dart';
|
||||||
import 'package:diameter/screens/log/log_entry/log_event_detail.dart';
|
import 'package:diameter/screens/log/log_entry/log_event_detail.dart';
|
||||||
import 'package:diameter/screens/log/log_entry/log_event_list.dart';
|
import 'package:diameter/screens/log/log_entry/log_event_list.dart';
|
||||||
import 'package:diameter/utils/date_time_utils.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:diameter/navigation.dart';
|
import 'package:diameter/navigation.dart';
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:diameter/components/detail.dart';
|
import 'package:diameter/components/detail.dart';
|
||||||
import 'package:diameter/components/dialogs.dart';
|
import 'package:diameter/components/dialogs.dart';
|
||||||
import 'package:diameter/components/dropdown.dart';
|
import 'package:diameter/components/dropdown.dart';
|
||||||
@ -9,15 +11,31 @@ import 'package:diameter/models/log_entry.dart';
|
|||||||
import 'package:diameter/models/log_meal.dart';
|
import 'package:diameter/models/log_meal.dart';
|
||||||
import 'package:diameter/navigation.dart';
|
import 'package:diameter/navigation.dart';
|
||||||
import 'package:diameter/settings.dart';
|
import 'package:diameter/settings.dart';
|
||||||
|
import 'package:diameter/utils/utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
enum BolusType {
|
||||||
|
meal,
|
||||||
|
glucose,
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GlucoseParameter {
|
||||||
|
mgdlCurrent,
|
||||||
|
mgdlTarget,
|
||||||
|
mgdlCorrection,
|
||||||
|
mmolCurrent,
|
||||||
|
mmolTarget,
|
||||||
|
mmolCorrection,
|
||||||
|
}
|
||||||
|
|
||||||
class LogBolusDetailScreen extends StatefulWidget {
|
class LogBolusDetailScreen extends StatefulWidget {
|
||||||
static const String routeName = '/log-bolus';
|
static const String routeName = '/log-bolus';
|
||||||
|
|
||||||
final int logEntryId;
|
final int logEntryId;
|
||||||
final int id;
|
final int id;
|
||||||
|
|
||||||
const LogBolusDetailScreen({Key? key, this.logEntryId = 0, this.id = 0})
|
const LogBolusDetailScreen(
|
||||||
|
{Key? key, this.logEntryId = 0, this.id = 0})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -35,12 +53,17 @@ class _LogBolusDetailScreenState extends State<LogBolusDetailScreen> {
|
|||||||
|
|
||||||
final _unitsController = TextEditingController(text: '');
|
final _unitsController = TextEditingController(text: '');
|
||||||
final _carbsController = TextEditingController(text: '');
|
final _carbsController = TextEditingController(text: '');
|
||||||
final _mgPerDlController = TextEditingController(text: '');
|
final _mgPerDlCurrentController = TextEditingController(text: '');
|
||||||
final _mmolPerLController = TextEditingController(text: '');
|
final _mgPerDlTargetController = TextEditingController(text: '');
|
||||||
|
final _mgPerDlCorrectionController = TextEditingController(text: '');
|
||||||
|
final _mmolPerLCurrentController = TextEditingController(text: '');
|
||||||
|
final _mmolPerLTargetController = TextEditingController(text: '');
|
||||||
|
final _mmolPerLCorrectionController = TextEditingController(text: '');
|
||||||
final _delayController = TextEditingController(text: '');
|
final _delayController = TextEditingController(text: '');
|
||||||
final _notesController = TextEditingController(text: '');
|
final _notesController = TextEditingController(text: '');
|
||||||
|
|
||||||
bool _setManually = false;
|
bool _setManually = false;
|
||||||
|
BolusType _bolusType = BolusType.meal;
|
||||||
LogMeal? _meal;
|
LogMeal? _meal;
|
||||||
Bolus? _rate;
|
Bolus? _rate;
|
||||||
|
|
||||||
@ -55,10 +78,7 @@ class _LogBolusDetailScreenState extends State<LogBolusDetailScreen> {
|
|||||||
_logMeals = LogMeal.getAllForEntry(widget.logEntryId);
|
_logMeals = LogMeal.getAllForEntry(widget.logEntryId);
|
||||||
|
|
||||||
if (widget.id != 0) {
|
if (widget.id != 0) {
|
||||||
_unitsController.text = _logBolus!.units.toString();
|
|
||||||
_carbsController.text = (_logBolus!.carbs ?? '').toString();
|
_carbsController.text = (_logBolus!.carbs ?? '').toString();
|
||||||
_mgPerDlController.text = (_logBolus!.mgPerDl ?? '').toString();
|
|
||||||
_mmolPerLController.text = (_logBolus!.mmolPerL ?? '').toString();
|
|
||||||
_delayController.text = (_logBolus!.delay ?? '').toString();
|
_delayController.text = (_logBolus!.delay ?? '').toString();
|
||||||
_notesController.text = _logBolus!.notes ?? '';
|
_notesController.text = _logBolus!.notes ?? '';
|
||||||
_setManually = _logBolus!.setManually;
|
_setManually = _logBolus!.setManually;
|
||||||
@ -67,6 +87,27 @@ class _LogBolusDetailScreenState extends State<LogBolusDetailScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_rate ??= Bolus.getRateForTime(_logEntry?.time);
|
_rate ??= Bolus.getRateForTime(_logEntry?.time);
|
||||||
|
|
||||||
|
_mgPerDlCurrentController.text =
|
||||||
|
(_logBolus?.mgPerDlCurrent ?? (LogEntry.hasUncorrectedGlucose(widget.logEntryId) ? _logEntry?.mgPerDl ?? 0 : 0)).toString();
|
||||||
|
_mgPerDlTargetController.text =
|
||||||
|
(_logBolus?.mgPerDlTarget ?? moderateGlucoseMgPerDl).toString();
|
||||||
|
_mgPerDlCorrectionController.text =
|
||||||
|
(_logBolus?.mgPerDlCorrection ?? max((int.tryParse(_mgPerDlCurrentController.text) ?? 0) - (int.tryParse(_mgPerDlTargetController.text) ?? 0), 0)).toString();
|
||||||
|
_mmolPerLCurrentController.text =
|
||||||
|
(_logBolus?.mmolPerLCurrent ?? (LogEntry.hasUncorrectedGlucose(widget.logEntryId) ? _logEntry?.mmolPerL ?? 0 : 0)).toString();
|
||||||
|
_mmolPerLTargetController.text =
|
||||||
|
(_logBolus?.mmolPerLTarget ?? moderateGlucoseMmolPerL).toString();
|
||||||
|
_mmolPerLCorrectionController.text =
|
||||||
|
(_logBolus?.mmolPerLCorrection ?? max((double.tryParse(_mmolPerLCurrentController.text) ?? 0) - (double.tryParse(_mmolPerLTargetController.text) ?? 0), 0)).toString();
|
||||||
|
|
||||||
|
_unitsController.text = (_logBolus?.units ??
|
||||||
|
(_rate != null && !_setManually ? ((int.tryParse(_mgPerDlCorrectionController.text) ?? 0) / ((_rate!.mgPerDl ?? 0) / _rate!.units)) : 0)
|
||||||
|
).toString();
|
||||||
|
|
||||||
|
if (widget.id == 0 && LogEntry.hasUncorrectedGlucose(widget.logEntryId)) {
|
||||||
|
_bolusType = BolusType.glucose;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void reload() {
|
void reload() {
|
||||||
@ -98,6 +139,68 @@ class _LogBolusDetailScreenState extends State<LogBolusDetailScreen> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onChangeGlucose({GlucoseMeasurement? calculateFrom}) {
|
||||||
|
int? mgPerDlCurrent;
|
||||||
|
int? mgPerDlTarget;
|
||||||
|
int? mgPerDlCorrection;
|
||||||
|
|
||||||
|
double? mmolPerLCurrent;
|
||||||
|
double? mmolPerLTarget;
|
||||||
|
double? mmolPerLCorrection;
|
||||||
|
|
||||||
|
if (calculateFrom != GlucoseMeasurement.mmolPerL &&
|
||||||
|
_mgPerDlCurrentController.text != '' &&
|
||||||
|
_mgPerDlTargetController.text != '') {
|
||||||
|
mgPerDlCurrent = int.tryParse(_mgPerDlCurrentController.text);
|
||||||
|
mgPerDlTarget = int.tryParse(_mgPerDlTargetController.text);
|
||||||
|
mgPerDlCorrection = max((mgPerDlCurrent ?? 0) - (mgPerDlTarget ?? 0), 0);
|
||||||
|
}
|
||||||
|
if (calculateFrom != GlucoseMeasurement.mgPerDl &&
|
||||||
|
_mmolPerLCurrentController.text != '') {
|
||||||
|
mmolPerLCurrent = double.tryParse(_mmolPerLCurrentController.text);
|
||||||
|
mmolPerLTarget = double.tryParse(_mmolPerLTargetController.text);
|
||||||
|
mmolPerLCorrection =
|
||||||
|
max((mmolPerLCurrent ?? 0) - (mmolPerLTarget ?? 0), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((mgPerDlCurrent != null && mmolPerLCurrent == null) ||
|
||||||
|
(mgPerDlTarget != null && mmolPerLTarget == null) ||
|
||||||
|
(mgPerDlCorrection != null && mmolPerLCorrection == null)) {
|
||||||
|
setState(() {
|
||||||
|
_mgPerDlCorrectionController.text = (mgPerDlCorrection ?? 0).toString();
|
||||||
|
_mmolPerLCurrentController.text =
|
||||||
|
Utils.convertMgPerDlToMmolPerL(mgPerDlCurrent ?? 0).toString();
|
||||||
|
_mmolPerLTargetController.text =
|
||||||
|
Utils.convertMgPerDlToMmolPerL(mgPerDlTarget ?? 0).toString();
|
||||||
|
_mmolPerLCorrectionController.text =
|
||||||
|
Utils.convertMgPerDlToMmolPerL(mgPerDlCorrection ?? 0).toString();
|
||||||
|
if (_rate != null && !_setManually) {
|
||||||
|
_unitsController.text = ((mgPerDlCorrection ?? 0) /
|
||||||
|
((_rate!.mgPerDl ?? 0) / _rate!.units))
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if ((mmolPerLCurrent != null && mgPerDlCurrent == null) ||
|
||||||
|
(mmolPerLTarget != null && mgPerDlTarget == null) ||
|
||||||
|
(mmolPerLCorrection != null && mgPerDlCorrection == null)) {
|
||||||
|
setState(() {
|
||||||
|
_mmolPerLCurrentController.text = (mmolPerLCorrection ?? 0).toString();
|
||||||
|
_mgPerDlCurrentController.text =
|
||||||
|
Utils.convertMmolPerLToMgPerDl(mmolPerLCurrent ?? 0).toString();
|
||||||
|
_mgPerDlTargetController.text =
|
||||||
|
Utils.convertMmolPerLToMgPerDl(mmolPerLTarget ?? 0).toString();
|
||||||
|
_mgPerDlCorrectionController.text =
|
||||||
|
Utils.convertMmolPerLToMgPerDl(mmolPerLCorrection ?? 0).toString();
|
||||||
|
if (_rate != null && !_setManually) {
|
||||||
|
_unitsController.text = ((mmolPerLCorrection ?? 0) /
|
||||||
|
((_rate!.mmolPerL ?? 0) / _rate!.units))
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void handleSaveAction() async {
|
void handleSaveAction() async {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isSaving = true;
|
_isSaving = true;
|
||||||
@ -106,13 +209,26 @@ class _LogBolusDetailScreenState extends State<LogBolusDetailScreen> {
|
|||||||
LogBolus logBolus = LogBolus(
|
LogBolus logBolus = LogBolus(
|
||||||
id: widget.id,
|
id: widget.id,
|
||||||
units: double.tryParse(_unitsController.text) ?? 0,
|
units: double.tryParse(_unitsController.text) ?? 0,
|
||||||
carbs: double.tryParse(_carbsController.text),
|
|
||||||
mgPerDl: int.tryParse(_mgPerDlController.text),
|
|
||||||
mmolPerL: double.tryParse(_mmolPerLController.text),
|
|
||||||
delay: int.tryParse(_delayController.text),
|
delay: int.tryParse(_delayController.text),
|
||||||
setManually: _setManually,
|
setManually: _setManually,
|
||||||
notes: _notesController.text,
|
notes: _notesController.text,
|
||||||
);
|
);
|
||||||
|
if (_bolusType == BolusType.meal) {
|
||||||
|
logBolus.carbs = double.tryParse(_carbsController.text);
|
||||||
|
logBolus.mgPerDlCurrent = null;
|
||||||
|
logBolus.mmolPerLCurrent = null;
|
||||||
|
} else {
|
||||||
|
logBolus.carbs = null;
|
||||||
|
logBolus.mgPerDlCurrent = int.tryParse(_mgPerDlCurrentController.text);
|
||||||
|
logBolus.mmolPerLCurrent =
|
||||||
|
double.tryParse(_mmolPerLCurrentController.text);
|
||||||
|
logBolus.mgPerDlTarget = int.tryParse(_mgPerDlTargetController.text);
|
||||||
|
logBolus.mmolPerLTarget =
|
||||||
|
double.tryParse(_mmolPerLTargetController.text);
|
||||||
|
logBolus.mgPerDlCorrection = int.tryParse(_mgPerDlCorrectionController.text);
|
||||||
|
logBolus.mmolPerLCorrection =
|
||||||
|
double.tryParse(_mmolPerLCorrectionController.text);
|
||||||
|
}
|
||||||
logBolus.logEntry.target = _logEntry;
|
logBolus.logEntry.target = _logEntry;
|
||||||
logBolus.meal.target = _meal;
|
logBolus.meal.target = _meal;
|
||||||
logBolus.rate.target = _rate;
|
logBolus.rate.target = _rate;
|
||||||
@ -129,8 +245,12 @@ class _LogBolusDetailScreenState extends State<LogBolusDetailScreen> {
|
|||||||
((_isNew &&
|
((_isNew &&
|
||||||
(_unitsController.text != '' ||
|
(_unitsController.text != '' ||
|
||||||
_carbsController.text != '' ||
|
_carbsController.text != '' ||
|
||||||
_mgPerDlController.text != '' ||
|
_mgPerDlCurrentController.text != '' ||
|
||||||
_mmolPerLController.text != '' ||
|
_mgPerDlTargetController.text != '' ||
|
||||||
|
_mgPerDlCorrectionController.text != '' ||
|
||||||
|
_mmolPerLCurrentController.text != '' ||
|
||||||
|
_mmolPerLTargetController.text != '' ||
|
||||||
|
_mmolPerLCorrectionController.text != '' ||
|
||||||
_delayController.text != '' ||
|
_delayController.text != '' ||
|
||||||
_setManually ||
|
_setManually ||
|
||||||
_notesController.text != '')) ||
|
_notesController.text != '')) ||
|
||||||
@ -138,10 +258,18 @@ class _LogBolusDetailScreenState extends State<LogBolusDetailScreen> {
|
|||||||
(double.tryParse(_unitsController.text) != _logBolus!.units ||
|
(double.tryParse(_unitsController.text) != _logBolus!.units ||
|
||||||
double.tryParse(_carbsController.text) !=
|
double.tryParse(_carbsController.text) !=
|
||||||
_logBolus!.carbs ||
|
_logBolus!.carbs ||
|
||||||
int.tryParse(_mgPerDlController.text) !=
|
int.tryParse(_mgPerDlCurrentController.text) !=
|
||||||
_logBolus!.mgPerDl ||
|
_logBolus!.mgPerDlCurrent ||
|
||||||
double.tryParse(_mmolPerLController.text) !=
|
int.tryParse(_mgPerDlTargetController.text) !=
|
||||||
_logBolus!.mmolPerL ||
|
_logBolus!.mgPerDlTarget ||
|
||||||
|
int.tryParse(_mgPerDlCorrectionController.text) !=
|
||||||
|
_logBolus!.mgPerDlCorrection ||
|
||||||
|
double.tryParse(_mmolPerLCurrentController.text) !=
|
||||||
|
_logBolus!.mmolPerLCurrent ||
|
||||||
|
double.tryParse(_mmolPerLTargetController.text) !=
|
||||||
|
_logBolus!.mmolPerLTarget ||
|
||||||
|
double.tryParse(_mmolPerLCorrectionController.text) !=
|
||||||
|
_logBolus!.mmolPerLCorrection ||
|
||||||
int.tryParse(_delayController.text) != _logBolus!.delay ||
|
int.tryParse(_delayController.text) != _logBolus!.delay ||
|
||||||
_setManually != _logBolus!.setManually ||
|
_setManually != _logBolus!.setManually ||
|
||||||
_notesController.text != (_logBolus!.notes ?? ''))))) {
|
_notesController.text != (_logBolus!.notes ?? ''))))) {
|
||||||
@ -185,13 +313,192 @@ class _LogBolusDetailScreenState extends State<LogBolusDetailScreen> {
|
|||||||
),
|
),
|
||||||
BooleanFormField(
|
BooleanFormField(
|
||||||
value: _setManually,
|
value: _setManually,
|
||||||
label: 'set Bolus manually',
|
label: 'set manually',
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_setManually = value;
|
_setManually = value;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: RadioListTile(
|
||||||
|
title: const Text('for glucose'),
|
||||||
|
groupValue: _bolusType,
|
||||||
|
value: BolusType.glucose,
|
||||||
|
onChanged: (_) {
|
||||||
|
setState(() {
|
||||||
|
_bolusType = BolusType.glucose;
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: RadioListTile(
|
||||||
|
title: const Text('for meal'),
|
||||||
|
groupValue: _bolusType,
|
||||||
|
value: BolusType.meal,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
_bolusType = BolusType.meal;
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: _bolusType == BolusType.glucose
|
||||||
|
? [
|
||||||
|
Row(
|
||||||
|
children: glucoseMeasurement ==
|
||||||
|
GlucoseMeasurement.mgPerDl ||
|
||||||
|
glucoseDisplayMode ==
|
||||||
|
GlucoseDisplayMode.both ||
|
||||||
|
glucoseDisplayMode ==
|
||||||
|
GlucoseDisplayMode.bothForDetail
|
||||||
|
? [
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(right: 5.0),
|
||||||
|
child: TextFormField(
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Current',
|
||||||
|
suffixText: 'mg/dl',
|
||||||
|
),
|
||||||
|
controller: _mgPerDlCurrentController,
|
||||||
|
onChanged: (_) => onChangeGlucose(
|
||||||
|
calculateFrom:
|
||||||
|
GlucoseMeasurement.mgPerDl),
|
||||||
|
keyboardType: const TextInputType
|
||||||
|
.numberWithOptions(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 5.0),
|
||||||
|
child: TextFormField(
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Target',
|
||||||
|
suffixText: 'mg/dl',
|
||||||
|
),
|
||||||
|
controller: _mgPerDlTargetController,
|
||||||
|
onChanged: (_) => onChangeGlucose(
|
||||||
|
calculateFrom:
|
||||||
|
GlucoseMeasurement.mgPerDl),
|
||||||
|
keyboardType: const TextInputType
|
||||||
|
.numberWithOptions(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(left: 5.0),
|
||||||
|
child: TextFormField(
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Correction',
|
||||||
|
suffixText: 'mg/dl',
|
||||||
|
),
|
||||||
|
controller:
|
||||||
|
_mgPerDlCorrectionController,
|
||||||
|
readOnly: true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
glucoseDisplayMode ==
|
||||||
|
GlucoseDisplayMode.both ||
|
||||||
|
glucoseDisplayMode ==
|
||||||
|
GlucoseDisplayMode.bothForDetail
|
||||||
|
? IconButton(
|
||||||
|
onPressed: () => onChangeGlucose(
|
||||||
|
calculateFrom:
|
||||||
|
GlucoseMeasurement
|
||||||
|
.mmolPerL),
|
||||||
|
icon: const Icon(Icons.calculate),
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
]
|
||||||
|
: [],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: glucoseMeasurement ==
|
||||||
|
GlucoseMeasurement.mmolPerL ||
|
||||||
|
glucoseDisplayMode ==
|
||||||
|
GlucoseDisplayMode.both ||
|
||||||
|
glucoseDisplayMode ==
|
||||||
|
GlucoseDisplayMode.bothForDetail
|
||||||
|
? [
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(right: 5),
|
||||||
|
child: TextFormField(
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Current',
|
||||||
|
suffixText: 'mmol/l',
|
||||||
|
),
|
||||||
|
controller:
|
||||||
|
_mmolPerLCurrentController,
|
||||||
|
onChanged: (_) => onChangeGlucose(
|
||||||
|
calculateFrom:
|
||||||
|
GlucoseMeasurement.mmolPerL),
|
||||||
|
keyboardType: const TextInputType
|
||||||
|
.numberWithOptions(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 5.0),
|
||||||
|
child: TextFormField(
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Target',
|
||||||
|
suffixText: 'mmol/l',
|
||||||
|
),
|
||||||
|
controller: _mmolPerLTargetController,
|
||||||
|
onChanged: (_) => onChangeGlucose(
|
||||||
|
calculateFrom:
|
||||||
|
GlucoseMeasurement.mmolPerL),
|
||||||
|
keyboardType: const TextInputType
|
||||||
|
.numberWithOptions(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(left: 5.0),
|
||||||
|
child: TextFormField(
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Correction',
|
||||||
|
suffixText: 'mmol/l',
|
||||||
|
),
|
||||||
|
controller:
|
||||||
|
_mmolPerLCorrectionController,
|
||||||
|
readOnly: true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
glucoseDisplayMode ==
|
||||||
|
GlucoseDisplayMode.both ||
|
||||||
|
glucoseDisplayMode ==
|
||||||
|
GlucoseDisplayMode.bothForDetail
|
||||||
|
? IconButton(
|
||||||
|
onPressed: () => onChangeGlucose(
|
||||||
|
calculateFrom:
|
||||||
|
GlucoseMeasurement.mgPerDl),
|
||||||
|
icon: const Icon(Icons.calculate),
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
]
|
||||||
|
: [],
|
||||||
|
),
|
||||||
|
]
|
||||||
|
: [
|
||||||
AutoCompleteDropdownButton<LogMeal>(
|
AutoCompleteDropdownButton<LogMeal>(
|
||||||
selectedItem: _meal,
|
selectedItem: _meal,
|
||||||
label: 'Meal',
|
label: 'Meal',
|
||||||
@ -208,14 +515,17 @@ class _LogBolusDetailScreenState extends State<LogBolusDetailScreen> {
|
|||||||
suffixText: nutritionMeasurement ==
|
suffixText: nutritionMeasurement ==
|
||||||
NutritionMeasurement.grams
|
NutritionMeasurement.grams
|
||||||
? 'g'
|
? 'g'
|
||||||
: nutritionMeasurement == NutritionMeasurement.ounces
|
: nutritionMeasurement ==
|
||||||
|
NutritionMeasurement.ounces
|
||||||
? 'oz'
|
? 'oz'
|
||||||
: '',
|
: '',
|
||||||
),
|
),
|
||||||
controller: _carbsController,
|
controller: _carbsController,
|
||||||
onChanged: (_) => onChangeCarbs(),
|
onChanged: (_) => onChangeCarbs(),
|
||||||
keyboardType:
|
keyboardType: const TextInputType.numberWithOptions(
|
||||||
const TextInputType.numberWithOptions(decimal: true),
|
decimal: true),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
|
@ -54,7 +54,7 @@ class _LogBolusListScreenState extends State<LogBolusListScreen> {
|
|||||||
|
|
||||||
void onDelete(LogBolus logBolus) {
|
void onDelete(LogBolus logBolus) {
|
||||||
LogBolus.remove(logBolus.id);
|
LogBolus.remove(logBolus.id);
|
||||||
reload(message: 'Meal deleted');
|
reload(message: 'Bolus deleted');
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleDeleteAction(LogBolus logBolus) async {
|
void handleDeleteAction(LogBolus logBolus) async {
|
||||||
@ -94,9 +94,12 @@ class _LogBolusListScreenState extends State<LogBolusListScreen> {
|
|||||||
final bolus = widget.logBoli[index];
|
final bolus = widget.logBoli[index];
|
||||||
return ListTile(
|
return ListTile(
|
||||||
onTap: () => handleEditAction(bolus),
|
onTap: () => handleEditAction(bolus),
|
||||||
title: Text(
|
title: Text('${bolus.units} U'),
|
||||||
'${bolus.units} U per ${bolus.carbs}${nutritionMeasurement == NutritionMeasurement.grams ? ' g' : ' oz'} carbs/${glucoseMeasurement == GlucoseMeasurement.mgPerDl ? bolus.mgPerDl : bolus.mmolPerL} ${glucoseMeasurement == GlucoseMeasurement.mgPerDl ? 'mg/dl' : 'mmol/l'}'),
|
subtitle: Text(bolus.carbs != null ?
|
||||||
|
'for ${bolus.meal.target.toString()} (${bolus.carbs}${nutritionMeasurement == NutritionMeasurement.grams ? ' g' : ' oz'} carbs)'
|
||||||
|
: 'to correct ${glucoseMeasurement == GlucoseMeasurement.mgPerDl ? bolus.mgPerDlCorrection : bolus.mmolPerLCorrection} ${glucoseMeasurement == GlucoseMeasurement.mgPerDl ? 'mg/dl' : 'mmol/l'}'),
|
||||||
trailing: Row(
|
trailing: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
bolus.meal.target != null
|
bolus.meal.target != null
|
||||||
? IconButton(
|
? IconButton(
|
||||||
|
@ -45,9 +45,6 @@ class _LogEntryScreenState extends State<LogEntryScreen> {
|
|||||||
final _dateController = TextEditingController(text: '');
|
final _dateController = TextEditingController(text: '');
|
||||||
final _mgPerDlController = TextEditingController(text: '');
|
final _mgPerDlController = TextEditingController(text: '');
|
||||||
final _mmolPerLController = TextEditingController(text: '');
|
final _mmolPerLController = TextEditingController(text: '');
|
||||||
final _bolusGlucoseController = TextEditingController(text: '');
|
|
||||||
final _delayedBolusRateController = TextEditingController(text: '');
|
|
||||||
final _delayedBolusDurationController = TextEditingController(text: '');
|
|
||||||
final _notesController = TextEditingController(text: '');
|
final _notesController = TextEditingController(text: '');
|
||||||
|
|
||||||
late FloatingActionButton addMealButton;
|
late FloatingActionButton addMealButton;
|
||||||
@ -105,11 +102,6 @@ class _LogEntryScreenState extends State<LogEntryScreen> {
|
|||||||
_time = _logEntry!.time;
|
_time = _logEntry!.time;
|
||||||
_mgPerDlController.text = (_logEntry!.mgPerDl ?? '').toString();
|
_mgPerDlController.text = (_logEntry!.mgPerDl ?? '').toString();
|
||||||
_mmolPerLController.text = (_logEntry!.mmolPerL ?? '').toString();
|
_mmolPerLController.text = (_logEntry!.mmolPerL ?? '').toString();
|
||||||
_bolusGlucoseController.text = (_logEntry!.bolusGlucose ?? '').toString();
|
|
||||||
_delayedBolusRateController.text =
|
|
||||||
(_logEntry!.delayedBolusRate ?? '').toString();
|
|
||||||
_delayedBolusDurationController.text =
|
|
||||||
(_logEntry!.delayedBolusDuration ?? '').toString();
|
|
||||||
_notesController.text = _logEntry!.notes ?? '';
|
_notesController.text = _logEntry!.notes ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,10 +175,6 @@ class _LogEntryScreenState extends State<LogEntryScreen> {
|
|||||||
time: _time,
|
time: _time,
|
||||||
mgPerDl: int.tryParse(_mgPerDlController.text),
|
mgPerDl: int.tryParse(_mgPerDlController.text),
|
||||||
mmolPerL: double.tryParse(_mmolPerLController.text),
|
mmolPerL: double.tryParse(_mmolPerLController.text),
|
||||||
bolusGlucose: double.tryParse(_bolusGlucoseController.text),
|
|
||||||
delayedBolusDuration:
|
|
||||||
int.tryParse(_delayedBolusDurationController.text),
|
|
||||||
delayedBolusRate: double.tryParse(_delayedBolusRateController.text),
|
|
||||||
notes: _notesController.text,
|
notes: _notesController.text,
|
||||||
));
|
));
|
||||||
Navigator.pushReplacementNamed(context, '/log',
|
Navigator.pushReplacementNamed(context, '/log',
|
||||||
@ -202,21 +190,11 @@ class _LogEntryScreenState extends State<LogEntryScreen> {
|
|||||||
((_isNew &&
|
((_isNew &&
|
||||||
(int.tryParse(_mgPerDlController.text) != null ||
|
(int.tryParse(_mgPerDlController.text) != null ||
|
||||||
double.tryParse(_mmolPerLController.text) != null ||
|
double.tryParse(_mmolPerLController.text) != null ||
|
||||||
double.tryParse(_bolusGlucoseController.text) != null ||
|
|
||||||
int.tryParse(_delayedBolusDurationController.text) !=
|
|
||||||
null ||
|
|
||||||
double.tryParse(_delayedBolusRateController.text) != null ||
|
|
||||||
_notesController.text != '')) ||
|
_notesController.text != '')) ||
|
||||||
(!_isNew &&
|
(!_isNew &&
|
||||||
(int.tryParse(_mgPerDlController.text) != _logEntry!.mgPerDl ||
|
(int.tryParse(_mgPerDlController.text) != _logEntry!.mgPerDl ||
|
||||||
double.tryParse(_mmolPerLController.text) !=
|
double.tryParse(_mmolPerLController.text) !=
|
||||||
_logEntry!.mmolPerL ||
|
_logEntry!.mmolPerL ||
|
||||||
double.tryParse(_bolusGlucoseController.text) !=
|
|
||||||
_logEntry!.bolusGlucose ||
|
|
||||||
int.tryParse(_delayedBolusDurationController.text) !=
|
|
||||||
_logEntry!.delayedBolusDuration ||
|
|
||||||
double.tryParse(_delayedBolusRateController.text) !=
|
|
||||||
_logEntry!.delayedBolusRate ||
|
|
||||||
_notesController.text != (_logEntry!.notes ?? ''))))) {
|
_notesController.text != (_logEntry!.notes ?? ''))))) {
|
||||||
Dialogs.showCancelConfirmationDialog(
|
Dialogs.showCancelConfirmationDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -383,7 +361,7 @@ class _LogEntryScreenState extends State<LogEntryScreen> {
|
|||||||
_mmolPerLController.text
|
_mmolPerLController.text
|
||||||
.trim()
|
.trim()
|
||||||
.isEmpty) {
|
.isEmpty) {
|
||||||
return 'How many mg/dl or mmol/l does the rate make up for?';
|
return 'How high is your blood sugar?';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
@ -425,7 +403,7 @@ class _LogEntryScreenState extends State<LogEntryScreen> {
|
|||||||
_mgPerDlController.text
|
_mgPerDlController.text
|
||||||
.trim()
|
.trim()
|
||||||
.isEmpty) {
|
.isEmpty) {
|
||||||
return 'How many mg/dl or mmol/l does rhe rate make up for?';
|
return 'How high is your blood sugar?';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
@ -445,33 +423,6 @@ class _LogEntryScreenState extends State<LogEntryScreen> {
|
|||||||
: Container(),
|
: Container(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
TextFormField(
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
labelText: 'Bolus Units',
|
|
||||||
suffixText: 'U',
|
|
||||||
),
|
|
||||||
controller: _bolusGlucoseController,
|
|
||||||
keyboardType: const TextInputType.numberWithOptions(
|
|
||||||
decimal: true),
|
|
||||||
),
|
|
||||||
// ignore: todo
|
|
||||||
// TODO: change field functionality according to time format
|
|
||||||
TextFormField(
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
labelText: 'Delayed Bolus Duration',
|
|
||||||
suffixText: ' min',
|
|
||||||
),
|
|
||||||
controller: _delayedBolusDurationController,
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
),
|
|
||||||
TextFormField(
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
labelText: 'Delayed Bolus Units',
|
|
||||||
),
|
|
||||||
controller: _delayedBolusRateController,
|
|
||||||
keyboardType: const TextInputType.numberWithOptions(
|
|
||||||
decimal: true),
|
|
||||||
),
|
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: _notesController,
|
controller: _notesController,
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
|
@ -38,9 +38,6 @@ class _LogMealDetailScreenState extends State<LogMealDetailScreen> {
|
|||||||
final _carbsRatioController = TextEditingController(text: '');
|
final _carbsRatioController = TextEditingController(text: '');
|
||||||
final _portionSizeController = TextEditingController(text: '');
|
final _portionSizeController = TextEditingController(text: '');
|
||||||
final _carbsPerPortionController = TextEditingController(text: '');
|
final _carbsPerPortionController = TextEditingController(text: '');
|
||||||
final _bolusController = TextEditingController(text: '');
|
|
||||||
final _delayedBolusRateController = TextEditingController(text: '');
|
|
||||||
final _delayedBolusDurationController = TextEditingController(text: '');
|
|
||||||
final _notesController = TextEditingController(text: '');
|
final _notesController = TextEditingController(text: '');
|
||||||
|
|
||||||
Meal? _meal;
|
Meal? _meal;
|
||||||
@ -75,11 +72,6 @@ class _LogMealDetailScreenState extends State<LogMealDetailScreen> {
|
|||||||
_portionSizeController.text = (_logMeal!.portionSize ?? '').toString();
|
_portionSizeController.text = (_logMeal!.portionSize ?? '').toString();
|
||||||
_carbsPerPortionController.text =
|
_carbsPerPortionController.text =
|
||||||
(_logMeal!.carbsPerPortion ?? '').toString();
|
(_logMeal!.carbsPerPortion ?? '').toString();
|
||||||
_bolusController.text = (_logMeal!.bolus ?? '').toString();
|
|
||||||
_delayedBolusRateController.text =
|
|
||||||
(_logMeal!.delayedBolusRate ?? '').toString();
|
|
||||||
_delayedBolusDurationController.text =
|
|
||||||
(_logMeal!.delayedBolusDuration ?? '').toString();
|
|
||||||
_notesController.text = _logMeal!.notes ?? '';
|
_notesController.text = _logMeal!.notes ?? '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,13 +98,6 @@ class _LogMealDetailScreenState extends State<LogMealDetailScreen> {
|
|||||||
if (meal.carbsPerPortion != null) {
|
if (meal.carbsPerPortion != null) {
|
||||||
_carbsPerPortionController.text = meal.carbsPerPortion.toString();
|
_carbsPerPortionController.text = meal.carbsPerPortion.toString();
|
||||||
}
|
}
|
||||||
if (meal.delayedBolusRate != null) {
|
|
||||||
_delayedBolusRateController.text = meal.delayedBolusRate.toString();
|
|
||||||
}
|
|
||||||
if (meal.delayedBolusDuration != null) {
|
|
||||||
_delayedBolusDurationController.text =
|
|
||||||
meal.delayedBolusDuration.toString();
|
|
||||||
}
|
|
||||||
if (meal.mealSource.hasValue) {
|
if (meal.mealSource.hasValue) {
|
||||||
_mealSource = meal.mealSource.target;
|
_mealSource = meal.mealSource.target;
|
||||||
}
|
}
|
||||||
@ -142,11 +127,6 @@ class _LogMealDetailScreenState extends State<LogMealDetailScreen> {
|
|||||||
carbsRatio: double.tryParse(_carbsRatioController.text),
|
carbsRatio: double.tryParse(_carbsRatioController.text),
|
||||||
portionSize: double.tryParse(_portionSizeController.text),
|
portionSize: double.tryParse(_portionSizeController.text),
|
||||||
carbsPerPortion: double.tryParse(_carbsPerPortionController.text),
|
carbsPerPortion: double.tryParse(_carbsPerPortionController.text),
|
||||||
bolus: double.tryParse(_bolusController.text),
|
|
||||||
delayedBolusDuration:
|
|
||||||
int.tryParse(_delayedBolusDurationController.text),
|
|
||||||
delayedBolusRate: double.tryParse(_delayedBolusRateController.text),
|
|
||||||
notes: _notesController.text,
|
|
||||||
);
|
);
|
||||||
logMeal.logEntry.targetId = widget.logEntryId;
|
logMeal.logEntry.targetId = widget.logEntryId;
|
||||||
logMeal.meal.target = _meal;
|
logMeal.meal.target = _meal;
|
||||||
@ -177,10 +157,6 @@ class _LogMealDetailScreenState extends State<LogMealDetailScreen> {
|
|||||||
double.tryParse(_carbsPerPortionController.text) != null ||
|
double.tryParse(_carbsPerPortionController.text) != null ||
|
||||||
_carbsRatioAccuracy != null ||
|
_carbsRatioAccuracy != null ||
|
||||||
_portionSizeAccuracy != null ||
|
_portionSizeAccuracy != null ||
|
||||||
double.tryParse(_bolusController.text) != null ||
|
|
||||||
int.tryParse(_delayedBolusDurationController.text) !=
|
|
||||||
null ||
|
|
||||||
double.tryParse(_delayedBolusRateController.text) != null ||
|
|
||||||
_notesController.text != '')) ||
|
_notesController.text != '')) ||
|
||||||
(!_isNew &&
|
(!_isNew &&
|
||||||
(_valueController.text != _logMeal!.value ||
|
(_valueController.text != _logMeal!.value ||
|
||||||
@ -198,11 +174,6 @@ class _LogMealDetailScreenState extends State<LogMealDetailScreen> {
|
|||||||
_logMeal!.carbsRatioAccuracy.target ||
|
_logMeal!.carbsRatioAccuracy.target ||
|
||||||
_portionSizeAccuracy !=
|
_portionSizeAccuracy !=
|
||||||
_logMeal!.portionSizeAccuracy.target ||
|
_logMeal!.portionSizeAccuracy.target ||
|
||||||
double.tryParse(_bolusController.text) != _logMeal!.bolus ||
|
|
||||||
int.tryParse(_delayedBolusDurationController.text) !=
|
|
||||||
_logMeal!.delayedBolusDuration ||
|
|
||||||
double.tryParse(_delayedBolusRateController.text) !=
|
|
||||||
_logMeal!.delayedBolusRate ||
|
|
||||||
_notesController.text != (_logMeal!.notes ?? ''))))) {
|
_notesController.text != (_logMeal!.notes ?? ''))))) {
|
||||||
Dialogs.showCancelConfirmationDialog(
|
Dialogs.showCancelConfirmationDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -428,33 +399,6 @@ class _LogMealDetailScreenState extends State<LogMealDetailScreen> {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
TextFormField(
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
labelText: 'Bolus Units',
|
|
||||||
suffixText: ' U',
|
|
||||||
),
|
|
||||||
controller: _bolusController,
|
|
||||||
keyboardType:
|
|
||||||
const TextInputType.numberWithOptions(decimal: true),
|
|
||||||
),
|
|
||||||
TextFormField(
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
labelText: 'Delayed Bolus Duration',
|
|
||||||
suffixText: ' min',
|
|
||||||
),
|
|
||||||
controller: _delayedBolusDurationController,
|
|
||||||
keyboardType: const TextInputType.numberWithOptions(),
|
|
||||||
),
|
|
||||||
TextFormField(
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
labelText: 'Delayed Bolus Units',
|
|
||||||
suffixText: ' U',
|
|
||||||
alignLabelWithHint: true,
|
|
||||||
),
|
|
||||||
controller: _delayedBolusRateController,
|
|
||||||
keyboardType:
|
|
||||||
const TextInputType.numberWithOptions(decimal: true),
|
|
||||||
),
|
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: _notesController,
|
controller: _notesController,
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
|
Loading…
Reference in New Issue
Block a user