refactor models, fix active events view, add basal and bolus profiles to events
This commit is contained in:
parent
f0f8898627
commit
5c22fc0083
38
TODO
38
TODO
@ -1,42 +1,37 @@
|
||||
MAIN TASKS:
|
||||
General/Framework:
|
||||
☐ add deleted flag to all data models
|
||||
☐ adjust remove and fetch methods accordingly
|
||||
☐ find a general way to deal with duration fields
|
||||
☐ implement tostring methods for all models
|
||||
|
||||
Accuracies:
|
||||
☐ implement reordering
|
||||
|
||||
Basal/Bolus:
|
||||
☐ create distinct visual mode for picking the active profile (or remove active flag)
|
||||
☐ replace active profile picking mode with simple dropdown
|
||||
☐ indicate both the default rate and the currently active one (according to event)
|
||||
|
||||
Log Overview:
|
||||
☐ add active events view (as main menu item?)
|
||||
☐ adjust/debug active events view
|
||||
☐ display more information
|
||||
☐ apply target color settings to glucose
|
||||
☐ total bolus and carbs per entry
|
||||
|
||||
Log Entry:
|
||||
☐ replace meal and glucose boli with logbolus entities
|
||||
☐ check for multiple active events with temporary basal/bolus profiles
|
||||
☐ check for multiple active events with temporary basal/bolus profiles (smallest covered time frame counts)
|
||||
☐ provide splitting functionality for overlapping events
|
||||
|
||||
Event Types:
|
||||
☐ add option to change bolus/basal profile for event duration (dropdown with detail option)
|
||||
☐ add reminder option
|
||||
☐ implement reminders as push notification
|
||||
☐ implement reminders as push notifications
|
||||
|
||||
Settings:
|
||||
☐ add objectbox class and use instead of shared preferences
|
||||
☐ add fields for date and time formats
|
||||
☐ add fields for glucose target
|
||||
☐ add option to hide warning dialogs on cancel
|
||||
☐ add option to hide extra customization options (ie. changing pre calculated values)
|
||||
☐ add setting for decimal places
|
||||
☐ add fields for preferred date and time formats
|
||||
☐ add fields for glucose target (as map of cutoff glucose and colors)
|
||||
☐ add option to hide warning dialogs on cancel or event stop
|
||||
|
||||
FUTURE TASKS:
|
||||
General/Framework:
|
||||
☐ make all fields readonly if user somehow gets to a deleted record detail view
|
||||
☐ add functionality to delete dead records
|
||||
☐ clean up controllers (dispose method of each stateful widget)
|
||||
☐ add explanations to each section
|
||||
☐ account for deleted/disabled elements in dropdowns
|
||||
@ -44,9 +39,20 @@ FUTURE TASKS:
|
||||
☐ add clear button to dropdown (or all text fields?)
|
||||
Log Overview:
|
||||
☐ add pagination
|
||||
Event Types:
|
||||
☐ add colors as indicators for log entries (and later graphs in reports)
|
||||
Settings:
|
||||
☐ add option to hide extra customization options (ie. changing pre calculated values)
|
||||
☐ add setting for decimal places
|
||||
|
||||
|
||||
Archive:
|
||||
✔ 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)
|
||||
✔ add active events view (as main menu item) @done(21-11-26 21:28) @project(MAIN TASKS.Log Overview)
|
||||
✔ add option to change bolus/basal profile for event duration @done(21-11-26 21:13) @project(MAIN TASKS.Event Types)
|
||||
✔ add deleted flag to all data models @done(21-11-26 18:56) @project(MAIN TASKS.General/Framework)
|
||||
✔ adjust remove and fetch methods accordingly @done(21-11-26 20:52) @project(MAIN TASKS.General/Framework)
|
||||
✔ implement tostring methods for all models @done(21-11-26 20:52) @project(MAIN TASKS.General/Framework)
|
||||
✔ fix logmeals/logboli/logevents @done(21-11-25 17:10) @project(MAIN TASKS.Log Entry)
|
||||
✔ add tab for bolus overview @done(21-11-24 22:05) @project(MAIN TASKS.Log Entry)
|
||||
✔ calculate bolus suggestions according to active profile @done(21-11-24 22:05) @project(MAIN TASKS.Log Entry)
|
||||
|
@ -5,7 +5,6 @@ class AutoCompleteDropdownButton<T> extends StatefulWidget {
|
||||
final String label;
|
||||
final T? selectedItem;
|
||||
final List<T> items;
|
||||
final String Function(T item) renderItem;
|
||||
final void Function(T? value) onChanged;
|
||||
final List<T> Function(String? value)? applyQuery;
|
||||
|
||||
@ -14,7 +13,6 @@ class AutoCompleteDropdownButton<T> extends StatefulWidget {
|
||||
this.selectedItem,
|
||||
required this.label,
|
||||
required this.items,
|
||||
required this.renderItem,
|
||||
required this.onChanged,
|
||||
this.applyQuery})
|
||||
: super(key: key);
|
||||
@ -40,7 +38,7 @@ class _AutoCompleteDropdownButtonState<T>
|
||||
setState(() {
|
||||
controller.text = widget.selectedItem == null
|
||||
? ''
|
||||
: widget.renderItem(widget.selectedItem!);
|
||||
: widget.selectedItem!.toString();
|
||||
options = widget.items;
|
||||
suggestions = [];
|
||||
});
|
||||
@ -81,8 +79,8 @@ class _AutoCompleteDropdownButtonState<T>
|
||||
items.addAll(options
|
||||
.where((item) =>
|
||||
!(widget.selectedItem != null &&
|
||||
widget.renderItem(item) ==
|
||||
widget.renderItem(widget.selectedItem!)) &&
|
||||
item.toString() ==
|
||||
widget.selectedItem!.toString()) &&
|
||||
!suggestions.contains(item))
|
||||
.map((item) => buildListTile(item))
|
||||
.toList());
|
||||
@ -132,7 +130,7 @@ class _AutoCompleteDropdownButtonState<T>
|
||||
title: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(widget.renderItem(item)),
|
||||
child: Text(item.toString()),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -147,14 +145,14 @@ class _AutoCompleteDropdownButtonState<T>
|
||||
|
||||
void handleChanged(item) {
|
||||
widget.onChanged(item);
|
||||
controller.text = widget.renderItem(item);
|
||||
controller.text = item.toString();
|
||||
hideOverlay();
|
||||
}
|
||||
|
||||
void onChangeQuery(String value) {
|
||||
if (value.trim() == '' ||
|
||||
(widget.selectedItem != null &&
|
||||
value == widget.renderItem(widget.selectedItem!))) {
|
||||
value == widget.selectedItem!.toString())) {
|
||||
setState(() {
|
||||
suggestions = [];
|
||||
});
|
||||
@ -162,7 +160,7 @@ class _AutoCompleteDropdownButtonState<T>
|
||||
if (widget.applyQuery == null) {
|
||||
setState(() {
|
||||
suggestions = widget.items.where((item) {
|
||||
String itemString = widget.renderItem(item).toLowerCase();
|
||||
String itemString = item.toString().toLowerCase();
|
||||
String valueLowercase = value.toLowerCase();
|
||||
return itemString.contains(valueLowercase);
|
||||
}).toList();
|
||||
|
@ -3,6 +3,7 @@ import 'package:diameter/object_box.dart';
|
||||
import 'package:diameter/screens/accuracy_detail.dart';
|
||||
import 'package:diameter/screens/basal/basal_profile_detail.dart';
|
||||
import 'package:diameter/screens/bolus/bolus_profile_detail.dart';
|
||||
import 'package:diameter/screens/log/active_log_event_list.dart';
|
||||
import 'package:diameter/screens/log/log.dart';
|
||||
import 'package:diameter/screens/log/log_entry/log_entry.dart';
|
||||
import 'package:diameter/screens/log/log_entry/log_event_detail.dart';
|
||||
@ -54,6 +55,7 @@ Future<void> main() async {
|
||||
Routes.logEvent: (context) => const LogEventDetailScreen(),
|
||||
Routes.logEventTypes: (context) => const LogEventTypeListScreen(),
|
||||
Routes.logEventType: (context) => const LogEventTypeDetailScreen(),
|
||||
Routes.activeEvents: (context) => const ActiveEventListScreen(),
|
||||
Routes.accuracies: (context) => const AccuracyListScreen(),
|
||||
Routes.accuracy: (context) => const AccuracyDetailScreen(),
|
||||
Routes.meals: (context) => const MealListScreen(),
|
||||
|
@ -1,21 +1,24 @@
|
||||
import 'package:diameter/main.dart';
|
||||
import 'package:diameter/objectbox.g.dart';
|
||||
// ignore: unnecessary_import
|
||||
import 'package:objectbox/objectbox.dart';
|
||||
import 'package:diameter/objectbox.g.dart' show Accuracy_;
|
||||
|
||||
@Entity(uid: 291512798403320400)
|
||||
class Accuracy {
|
||||
static final Box<Accuracy> box = objectBox.store.box<Accuracy>();
|
||||
|
||||
// properties
|
||||
int id;
|
||||
bool deleted;
|
||||
String value;
|
||||
bool forCarbsRatio;
|
||||
bool forPortionSize;
|
||||
int? confidenceRating;
|
||||
String? notes;
|
||||
|
||||
// constructor
|
||||
Accuracy({
|
||||
this.id = 0,
|
||||
this.deleted = false,
|
||||
this.value = '',
|
||||
this.forCarbsRatio = false,
|
||||
this.forPortionSize = false,
|
||||
@ -23,25 +26,41 @@ class Accuracy {
|
||||
this.notes,
|
||||
});
|
||||
|
||||
// methods
|
||||
static Accuracy? get(int id) => box.get(id);
|
||||
static void put(Accuracy accuracy) => box.put(accuracy);
|
||||
|
||||
static List<Accuracy> getAll() {
|
||||
QueryBuilder<Accuracy> all = box.query()..order(Accuracy_.confidenceRating);
|
||||
QueryBuilder<Accuracy> all = box
|
||||
.query(Accuracy_.deleted.equals(false))
|
||||
..order(Accuracy_.confidenceRating);
|
||||
return all.build().find();
|
||||
}
|
||||
static void put(Accuracy accuracy) => box.put(accuracy);
|
||||
static void remove(int id) => box.remove(id);
|
||||
|
||||
|
||||
static void remove(int id) {
|
||||
final item = box.get(id);
|
||||
if (item != null) {
|
||||
item.deleted = true;
|
||||
box.put(item);
|
||||
}
|
||||
}
|
||||
|
||||
static List<Accuracy> getAllForPortionSize() {
|
||||
QueryBuilder<Accuracy> allForPortionSize = box
|
||||
.query(Accuracy_.forPortionSize.equals(true))
|
||||
.query(Accuracy_.forPortionSize.equals(true) & Accuracy_.deleted.equals(false))
|
||||
..order(Accuracy_.confidenceRating);
|
||||
return allForPortionSize.build().find();
|
||||
}
|
||||
|
||||
static List<Accuracy> getAllForCarbsRatio() {
|
||||
QueryBuilder<Accuracy> allForCarbsRatio = box
|
||||
.query(Accuracy_.forCarbsRatio.equals(true))
|
||||
.query(Accuracy_.forCarbsRatio.equals(true) & Accuracy_.deleted.equals(false))
|
||||
..order(Accuracy_.confidenceRating);
|
||||
return allForCarbsRatio.build().find();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
@ -1,39 +1,55 @@
|
||||
import 'package:diameter/main.dart';
|
||||
import 'package:diameter/models/basal_profile.dart';
|
||||
import 'package:diameter/objectbox.g.dart';
|
||||
// ignore: unnecessary_import
|
||||
import 'package:diameter/utils/date_time_utils.dart';
|
||||
import 'package:objectbox/objectbox.dart';
|
||||
import 'package:diameter/objectbox.g.dart' show Basal_, BasalProfile_;
|
||||
|
||||
@Entity(uid: 1467758525778521891)
|
||||
class Basal {
|
||||
static final Box<Basal> box = objectBox.store.box<Basal>();
|
||||
|
||||
int id;
|
||||
|
||||
// properties
|
||||
int id;
|
||||
bool deleted;
|
||||
@Property(type: PropertyType.date)
|
||||
DateTime startTime;
|
||||
|
||||
@Property(type: PropertyType.date)
|
||||
DateTime endTime;
|
||||
|
||||
double units;
|
||||
|
||||
|
||||
// relations
|
||||
final basalProfile = ToOne<BasalProfile>();
|
||||
|
||||
// constructor
|
||||
Basal({
|
||||
this.id = 0,
|
||||
this.deleted = false,
|
||||
required this.startTime,
|
||||
required this.endTime,
|
||||
this.units = 0,
|
||||
});
|
||||
|
||||
// methods
|
||||
static Basal? get(int id) => box.get(id);
|
||||
static void put(Basal basal) => box.put(basal);
|
||||
static void remove(int id) => box.remove(id);
|
||||
|
||||
static void remove(int id) {
|
||||
final item = box.get(id);
|
||||
if (item != null) {
|
||||
item.deleted = true;
|
||||
box.put(item);
|
||||
}
|
||||
}
|
||||
|
||||
static List<Basal> getAllForProfile(int id) {
|
||||
QueryBuilder<Basal> builder = box.query()..order(Basal_.startTime);
|
||||
QueryBuilder<Basal> builder = box.query(Basal_.deleted.equals(false))
|
||||
..order(Basal_.startTime);
|
||||
builder.link(Basal_.basalProfile, BasalProfile_.id.equals(id));
|
||||
return builder.build().find();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return DateTimeUtils.displayTime(startTime);
|
||||
}
|
||||
}
|
||||
|
@ -1,39 +1,59 @@
|
||||
import 'package:diameter/main.dart';
|
||||
import 'package:diameter/objectbox.g.dart';
|
||||
// ignore: unnecessary_import
|
||||
import 'package:objectbox/objectbox.dart';
|
||||
import 'package:diameter/objectbox.g.dart' show BasalProfile_;
|
||||
|
||||
@Entity(uid: 3613736032926903785)
|
||||
class BasalProfile {
|
||||
static final Box<BasalProfile> box = objectBox.store.box<BasalProfile>();
|
||||
|
||||
// properties
|
||||
int id;
|
||||
bool deleted;
|
||||
String name;
|
||||
bool active;
|
||||
String? notes;
|
||||
|
||||
// constructor
|
||||
BasalProfile({
|
||||
this.id = 0,
|
||||
this.deleted = false,
|
||||
this.name = '',
|
||||
this.active = false,
|
||||
this.notes,
|
||||
});
|
||||
|
||||
// methods
|
||||
static BasalProfile? get(int id) => box.get(id);
|
||||
static List<BasalProfile> getAll() => box.getAll();
|
||||
static void put(BasalProfile basalProfile) => box.put(basalProfile);
|
||||
static void remove(int id) => box.remove(id);
|
||||
|
||||
static List<BasalProfile> getAll() {
|
||||
QueryBuilder<BasalProfile> all = box.query(BasalProfile_.deleted.equals(false));
|
||||
return all.build().find();
|
||||
}
|
||||
|
||||
static void remove(int id) {
|
||||
final item = box.get(id);
|
||||
if (item != null) {
|
||||
item.deleted = true;
|
||||
box.put(item);
|
||||
}
|
||||
}
|
||||
|
||||
static int activeCount() {
|
||||
Query<BasalProfile> query =
|
||||
box.query(BasalProfile_.active.equals(true)).build();
|
||||
Query<BasalProfile> query = box
|
||||
.query(BasalProfile_.active.equals(true) & BasalProfile_.deleted.equals(false)).build();
|
||||
return query.find().length;
|
||||
}
|
||||
|
||||
static void setAllInactive() {
|
||||
box.putMany(box.getAll().map((element) {
|
||||
element.active = false;
|
||||
return element;
|
||||
box.putMany(box.getAll().map((item) {
|
||||
item.active = false;
|
||||
return item;
|
||||
}).toList());
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,19 @@
|
||||
import 'package:diameter/config.dart';
|
||||
import 'package:diameter/main.dart';
|
||||
import 'package:diameter/models/bolus_profile.dart';
|
||||
import 'package:diameter/objectbox.g.dart';
|
||||
import 'package:diameter/models/log_event.dart';
|
||||
import 'package:diameter/utils/date_time_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
// ignore: unnecessary_import
|
||||
import 'package:objectbox/objectbox.dart';
|
||||
import 'package:diameter/objectbox.g.dart' show Bolus_, BolusProfile_;
|
||||
|
||||
@Entity(uid: 3417770529060202389)
|
||||
class Bolus {
|
||||
static final Box<Bolus> box = objectBox.store.box<Bolus>();
|
||||
|
||||
// properties
|
||||
int id;
|
||||
bool deleted;
|
||||
@Property(type: PropertyType.date)
|
||||
DateTime startTime;
|
||||
@Property(type: PropertyType.date)
|
||||
@ -21,10 +23,13 @@ class Bolus {
|
||||
int? mgPerDl;
|
||||
double? mmolPerL;
|
||||
|
||||
// relations
|
||||
final bolusProfile = ToOne<BolusProfile>();
|
||||
|
||||
// constructor
|
||||
Bolus({
|
||||
this.id = 0,
|
||||
this.deleted = false,
|
||||
required this.startTime,
|
||||
required this.endTime,
|
||||
this.units = 0,
|
||||
@ -33,21 +38,28 @@ class Bolus {
|
||||
this.mmolPerL,
|
||||
});
|
||||
|
||||
// methods
|
||||
static Bolus? get(int id) => box.get(id);
|
||||
static void put(Bolus bolus) => box.put(bolus);
|
||||
static void remove(int id) => box.remove(id);
|
||||
|
||||
static List<Bolus> getAllForProfile(int id) {
|
||||
QueryBuilder<Bolus> builder = box.query()..order(Bolus_.startTime);
|
||||
QueryBuilder<Bolus> builder = box.query(Bolus_.deleted.equals(false))
|
||||
..order(Bolus_.startTime);
|
||||
builder.link(Bolus_.bolusProfile, BolusProfile_.id.equals(id));
|
||||
return builder.build().find();
|
||||
}
|
||||
|
||||
static void remove(int id) {
|
||||
final item = box.get(id);
|
||||
if (item != null) {
|
||||
item.deleted = true;
|
||||
box.put(item);
|
||||
}
|
||||
}
|
||||
|
||||
static Bolus? getRateForTime(DateTime? dateTime) {
|
||||
if (dateTime != null) {
|
||||
// ignore: todo
|
||||
// TODO: check if an event is active that would change the active profile
|
||||
final bolusProfile = BolusProfile.getActive();
|
||||
final bolusProfile = BolusProfile.getActive(dateTime);
|
||||
final time = DateTimeUtils.convertTimeOfDayToDateTime(
|
||||
TimeOfDay.fromDateTime(dateTime));
|
||||
if (bolusProfile != null) {
|
||||
@ -62,7 +74,12 @@ class Bolus {
|
||||
});
|
||||
return result.length != 1 ? null : result.single;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return DateTimeUtils.displayTime(startTime);
|
||||
}
|
||||
}
|
||||
|
@ -1,32 +1,52 @@
|
||||
import 'package:diameter/main.dart';
|
||||
import 'package:diameter/objectbox.g.dart';
|
||||
// ignore: unnecessary_import
|
||||
import 'package:diameter/models/log_event.dart';
|
||||
import 'package:objectbox/objectbox.dart';
|
||||
import 'package:diameter/objectbox.g.dart' show BolusProfile_;
|
||||
|
||||
@Entity(uid: 8812452529027052317)
|
||||
class BolusProfile {
|
||||
static final Box<BolusProfile> box = objectBox.store.box<BolusProfile>();
|
||||
|
||||
// properties
|
||||
int id;
|
||||
bool deleted;
|
||||
String name;
|
||||
bool active;
|
||||
String? notes;
|
||||
|
||||
// constructor
|
||||
BolusProfile({
|
||||
this.id = 0,
|
||||
this.deleted = false,
|
||||
this.name = '',
|
||||
this.active = false,
|
||||
this.notes,
|
||||
});
|
||||
|
||||
// methods
|
||||
static BolusProfile? get(int id) => box.get(id);
|
||||
static List<BolusProfile> getAll() => box.getAll();
|
||||
static void put(BolusProfile bolusProfile) => box.put(bolusProfile);
|
||||
static void remove(int id) => box.remove(id);
|
||||
|
||||
static List<BolusProfile> getAll() {
|
||||
QueryBuilder<BolusProfile> all =
|
||||
box.query(BolusProfile_.deleted.equals(false));
|
||||
return all.build().find();
|
||||
}
|
||||
|
||||
static void remove(int id) {
|
||||
final item = box.get(id);
|
||||
if (item != null) {
|
||||
item.deleted = true;
|
||||
box.put(item);
|
||||
}
|
||||
}
|
||||
|
||||
static int activeCount() {
|
||||
Query<BolusProfile> query =
|
||||
box.query(BolusProfile_.active.equals(true)).build();
|
||||
Query<BolusProfile> query = box
|
||||
.query(BolusProfile_.active
|
||||
.equals(true)
|
||||
.and(BolusProfile_.deleted.equals(false)))
|
||||
.build();
|
||||
return query.find().length;
|
||||
}
|
||||
|
||||
@ -37,10 +57,33 @@ class BolusProfile {
|
||||
}).toList());
|
||||
}
|
||||
|
||||
static BolusProfile? getActive() {
|
||||
Query<BolusProfile> query =
|
||||
box.query(BolusProfile_.active.equals(true)).build();
|
||||
static BolusProfile? getActive(DateTime? dateTime) {
|
||||
if (dateTime != null) {
|
||||
List<LogEvent> activeEvents = LogEvent.getAllActiveForTime(dateTime)
|
||||
.where((event) => event.bolusProfile.target != null).toList();
|
||||
if (activeEvents.length > 1) {
|
||||
final now = DateTime.now();
|
||||
activeEvents =
|
||||
activeEvents.where((item) => !activeEvents.any((other) =>
|
||||
item.time.isBefore(other.time) || (item.endTime ?? now).isAfter(other.endTime ?? now)
|
||||
)).toList();
|
||||
}
|
||||
if (activeEvents.length == 1) {
|
||||
return activeEvents.single.bolusProfile.target;
|
||||
}
|
||||
}
|
||||
|
||||
Query<BolusProfile> query = box
|
||||
.query(BolusProfile_.active
|
||||
.equals(true)
|
||||
.and(BolusProfile_.deleted.equals(false)))
|
||||
.build();
|
||||
final result = query.find();
|
||||
return result.length != 1 ? null : result.single;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
@ -2,14 +2,16 @@ import 'package:diameter/main.dart';
|
||||
import 'package:diameter/models/bolus.dart';
|
||||
import 'package:diameter/models/log_entry.dart';
|
||||
import 'package:diameter/models/log_meal.dart';
|
||||
import 'package:diameter/objectbox.g.dart';
|
||||
import 'package:objectbox/objectbox.dart';
|
||||
import 'package:diameter/objectbox.g.dart' show LogBolus_, LogEntry_;
|
||||
|
||||
@Entity(uid: 8033487006694871160)
|
||||
class LogBolus {
|
||||
static final Box<LogBolus> box = objectBox.store.box<LogBolus>();
|
||||
|
||||
// properties
|
||||
int id;
|
||||
bool deleted;
|
||||
double units;
|
||||
double? carbs;
|
||||
int? delay;
|
||||
@ -18,12 +20,15 @@ class LogBolus {
|
||||
bool setManually;
|
||||
String? notes;
|
||||
|
||||
// relations
|
||||
final logEntry = ToOne<LogEntry>();
|
||||
final rate = ToOne<Bolus>();
|
||||
final meal = ToOne<LogMeal?>();
|
||||
|
||||
// constructor
|
||||
LogBolus({
|
||||
this.id = 0,
|
||||
this.deleted = false,
|
||||
this.units = 0,
|
||||
this.carbs,
|
||||
this.delay,
|
||||
@ -33,7 +38,26 @@ class LogBolus {
|
||||
this.notes,
|
||||
});
|
||||
|
||||
// methods
|
||||
static LogBolus? get(int id) => box.get(id);
|
||||
static void put(LogBolus logBolus) => box.put(logBolus);
|
||||
static void remove(int id) => box.remove(id);
|
||||
|
||||
static List<LogBolus> getAllForEntry(int id) {
|
||||
QueryBuilder<LogBolus> builder = box.query(LogBolus_.deleted.equals(false));
|
||||
builder.link(LogBolus_.logEntry, LogEntry_.id.equals(id));
|
||||
return builder.build().find();
|
||||
}
|
||||
|
||||
static void remove(int id) {
|
||||
final item = box.get(id);
|
||||
if (item != null) {
|
||||
item.deleted = true;
|
||||
box.put(item);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return units.toString();
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,17 @@
|
||||
import 'package:diameter/main.dart';
|
||||
import 'package:diameter/models/log_bolus.dart';
|
||||
import 'package:diameter/models/log_event.dart';
|
||||
import 'package:diameter/models/log_meal.dart';
|
||||
import 'package:diameter/objectbox.g.dart';
|
||||
// ignore: unnecessary_import
|
||||
import 'package:diameter/utils/date_time_utils.dart';
|
||||
import 'package:objectbox/objectbox.dart';
|
||||
import 'package:diameter/objectbox.g.dart' show LogEntry_;
|
||||
|
||||
@Entity(uid: 752131069307970560)
|
||||
class LogEntry {
|
||||
static final Box<LogEntry> box = objectBox.store.box<LogEntry>();
|
||||
|
||||
// properties
|
||||
int id;
|
||||
|
||||
bool deleted;
|
||||
@Property(type: PropertyType.date)
|
||||
DateTime time;
|
||||
|
||||
int? mgPerDl;
|
||||
double? mmolPerL;
|
||||
double? bolusGlucose;
|
||||
@ -22,20 +19,10 @@ class LogEntry {
|
||||
double? delayedBolusRate;
|
||||
String? notes;
|
||||
|
||||
@Backlink('logEntry')
|
||||
final events = ToMany<LogEvent>();
|
||||
|
||||
@Backlink('endLogEntry')
|
||||
final endedEvents = ToMany<LogEvent>();
|
||||
|
||||
@Backlink('logEntry')
|
||||
final meals = ToMany<LogMeal>();
|
||||
|
||||
@Backlink('logEntry')
|
||||
final boli = ToMany<LogBolus>();
|
||||
|
||||
// constructor
|
||||
LogEntry({
|
||||
this.id = 0,
|
||||
this.deleted = false,
|
||||
required this.time,
|
||||
this.mgPerDl,
|
||||
this.mmolPerL,
|
||||
@ -45,15 +32,23 @@ class LogEntry {
|
||||
this.notes,
|
||||
});
|
||||
|
||||
static LogEntry? get(int id) => box.get(id);
|
||||
// methods
|
||||
static LogEntry? get(int id) => id == 0 ? null : box.get(id);
|
||||
static List<LogEntry> getAll() => box.getAll();
|
||||
static void put(LogEntry logEntry) => box.put(logEntry);
|
||||
static void remove(int id) => box.remove(id);
|
||||
|
||||
static void remove(int id) {
|
||||
final item = box.get(id);
|
||||
if (item != null) {
|
||||
item.deleted = true;
|
||||
box.put(item);
|
||||
}
|
||||
}
|
||||
|
||||
static Map<DateTime, List<LogEntry>> getDailyEntryMap() {
|
||||
Map<DateTime, List<LogEntry>> dateMap = <DateTime, List<LogEntry>>{};
|
||||
|
||||
QueryBuilder<LogEntry> allByDate = box.query()
|
||||
QueryBuilder<LogEntry> allByDate = box.query(LogEntry_.deleted.equals(false))
|
||||
..order(LogEntry_.time, flags: Order.descending);
|
||||
List<LogEntry> entries = allByDate.build().find();
|
||||
DateTime? date;
|
||||
@ -65,4 +60,10 @@ class LogEntry {
|
||||
|
||||
return dateMap;
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return DateTimeUtils.displayDateTime(time);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
import 'package:diameter/main.dart';
|
||||
import 'package:diameter/models/basal_profile.dart';
|
||||
import 'package:diameter/models/bolus_profile.dart';
|
||||
import 'package:diameter/models/log_entry.dart';
|
||||
import 'package:diameter/models/log_event_type.dart';
|
||||
import 'package:diameter/objectbox.g.dart';
|
||||
@ -9,37 +11,85 @@ import 'package:objectbox/objectbox.dart';
|
||||
class LogEvent {
|
||||
static final Box<LogEvent> box = objectBox.store.box<LogEvent>();
|
||||
|
||||
// properties
|
||||
int id;
|
||||
|
||||
bool deleted;
|
||||
@Property(type: PropertyType.date)
|
||||
DateTime time;
|
||||
|
||||
@Property(type: PropertyType.date)
|
||||
DateTime? endTime;
|
||||
|
||||
bool hasEndTime;
|
||||
int? reminderDuration;
|
||||
String? notes;
|
||||
|
||||
// relations
|
||||
final logEntry = ToOne<LogEntry>();
|
||||
final endLogEntry = ToOne<LogEntry>();
|
||||
final eventType = ToOne<LogEventType>();
|
||||
final bolusProfile = ToOne<BolusProfile>();
|
||||
final basalProfile = ToOne<BasalProfile>();
|
||||
|
||||
// constructor
|
||||
LogEvent({
|
||||
this.id = 0,
|
||||
this.deleted = false,
|
||||
required this.time,
|
||||
this.endTime,
|
||||
this.hasEndTime = false,
|
||||
this.reminderDuration,
|
||||
this.notes,
|
||||
});
|
||||
|
||||
// methods
|
||||
static LogEvent? get(int id) => box.get(id);
|
||||
static List<LogEvent> getAll() => box.getAll();
|
||||
static void put(LogEvent logEvent) => box.put(logEvent);
|
||||
static void remove(int id) => box.remove(id);
|
||||
|
||||
static void remove(int id) {
|
||||
final item = box.get(id);
|
||||
if (item != null) {
|
||||
item.deleted = true;
|
||||
box.put(item);
|
||||
}
|
||||
}
|
||||
|
||||
static List<LogEvent> getAllOngoing() {
|
||||
QueryBuilder<LogEvent> query =
|
||||
box.query(LogEvent_.hasEndTime.equals(true) & LogEvent_.endTime.isNull())..order(LogEvent_.time);
|
||||
QueryBuilder<LogEvent> query = box.query(LogEvent_.hasEndTime.equals(true) &
|
||||
LogEvent_.endTime.isNull() &
|
||||
LogEvent_.deleted.equals(false))
|
||||
..order(LogEvent_.time);
|
||||
return query.build().find();
|
||||
}
|
||||
|
||||
static List<LogEvent> getAllActiveForTime(DateTime? dateTime) {
|
||||
if (dateTime != null) {
|
||||
QueryBuilder<LogEvent> builder = box.query(
|
||||
LogEvent_.hasEndTime.equals(true) & LogEvent_.deleted.equals(false))
|
||||
..order(LogEvent_.time);
|
||||
final eventsWithEndTime = builder.build().find();
|
||||
return eventsWithEndTime.where((event) {
|
||||
return (!dateTime.isBefore(event.time)) &&
|
||||
!dateTime.isAfter(event.endTime ?? DateTime.now());
|
||||
}).toList();
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
static List<LogEvent> getAllForEntry(int id) {
|
||||
QueryBuilder<LogEvent> builder = box.query(LogEvent_.deleted.equals(false))
|
||||
..order(LogEvent_.time);
|
||||
builder.link(LogEvent_.logEntry, LogEntry_.id.equals(id));
|
||||
return builder.build().find();
|
||||
}
|
||||
|
||||
static List<LogEvent> getAllEndedByEntry(int id) {
|
||||
QueryBuilder<LogEvent> builder = box.query(LogEvent_.deleted.equals(false))
|
||||
..order(LogEvent_.time);
|
||||
builder.link(LogEvent_.endLogEntry, LogEntry_.id.equals(id));
|
||||
return builder.build().find();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return eventType.target?.value ?? '';
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,54 @@
|
||||
import 'package:diameter/main.dart';
|
||||
import 'package:diameter/models/basal_profile.dart';
|
||||
import 'package:diameter/models/bolus_profile.dart';
|
||||
import 'package:objectbox/objectbox.dart';
|
||||
import 'package:diameter/objectbox.g.dart' show LogEventType_;
|
||||
|
||||
@Entity(uid: 8362795406595606110)
|
||||
class LogEventType {
|
||||
static final Box<LogEventType> box = objectBox.store.box<LogEventType>();
|
||||
|
||||
// properties
|
||||
int id;
|
||||
bool deleted;
|
||||
String value;
|
||||
bool hasEndTime;
|
||||
int? defaultReminderDuration;
|
||||
String? notes;
|
||||
|
||||
// constructor
|
||||
LogEventType({
|
||||
this.id = 0,
|
||||
this.deleted = false,
|
||||
this.value = '',
|
||||
this.hasEndTime = false,
|
||||
this.defaultReminderDuration,
|
||||
this.notes,
|
||||
});
|
||||
|
||||
// relations
|
||||
final bolusProfile = ToOne<BolusProfile>();
|
||||
final basalProfile = ToOne<BasalProfile>();
|
||||
|
||||
// methods
|
||||
static LogEventType? get(int id) => box.get(id);
|
||||
static List<LogEventType> getAll() => box.getAll();
|
||||
static void put(LogEventType logEventType) => box.put(logEventType);
|
||||
static void remove(int id) => box.remove(id);
|
||||
|
||||
static List<LogEventType> getAll() {
|
||||
QueryBuilder<LogEventType> builder = box.query(LogEventType_.deleted.equals(false))..order(LogEventType_.value);
|
||||
return builder.build().find();
|
||||
}
|
||||
|
||||
static void remove(int id) {
|
||||
final item = box.get(id);
|
||||
if (item != null) {
|
||||
item.deleted = true;
|
||||
box.put(item);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
@ -6,21 +6,25 @@ import 'package:diameter/models/meal_portion_type.dart';
|
||||
import 'package:diameter/models/meal_source.dart';
|
||||
import 'package:diameter/models/accuracy.dart';
|
||||
import 'package:objectbox/objectbox.dart';
|
||||
import 'package:diameter/objectbox.g.dart' show LogMeal_, LogEntry_;
|
||||
|
||||
@Entity(uid: 411177866700467286)
|
||||
class LogMeal {
|
||||
static final Box<LogMeal> box = objectBox.store.box<LogMeal>();
|
||||
|
||||
// properties
|
||||
int id;
|
||||
bool deleted;
|
||||
String value;
|
||||
double? carbsRatio;
|
||||
double? portionSize;
|
||||
double? carbsPerPortion;
|
||||
double? bolus;
|
||||
int? delayedBolusDuration;
|
||||
double? delayedBolusRate;
|
||||
String? notes;
|
||||
double? bolus;
|
||||
|
||||
// relations
|
||||
final logEntry = ToOne<LogEntry>();
|
||||
final meal = ToOne<Meal>();
|
||||
final mealSource = ToOne<MealSource>();
|
||||
@ -29,8 +33,10 @@ class LogMeal {
|
||||
final portionSizeAccuracy = ToOne<Accuracy>();
|
||||
final carbsRatioAccuracy = ToOne<Accuracy>();
|
||||
|
||||
// constructor
|
||||
LogMeal({
|
||||
this.id = 0,
|
||||
this.deleted = false,
|
||||
this.value = '',
|
||||
this.carbsRatio,
|
||||
this.portionSize,
|
||||
@ -41,8 +47,25 @@ class LogMeal {
|
||||
this.notes,
|
||||
});
|
||||
|
||||
// methods
|
||||
static LogMeal? get(int id) => box.get(id);
|
||||
static List<LogMeal> getAll() => box.getAll();
|
||||
static void put(LogMeal logMeal) => box.put(logMeal);
|
||||
static void remove(int id) => box.remove(id);
|
||||
static void remove(int id) {
|
||||
final item = box.get(id);
|
||||
if (item != null) {
|
||||
item.deleted = true;
|
||||
box.put(item);
|
||||
}
|
||||
}
|
||||
|
||||
static List<LogMeal> getAllForEntry(int id) {
|
||||
QueryBuilder<LogMeal> builder = box.query(LogMeal_.deleted.equals(false));
|
||||
builder.link(LogMeal_.logEntry, LogEntry_.id.equals(id));
|
||||
return builder.build().find();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,9 @@ enum PortionCarbsParameter { carbsRatio, portionSize, carbsPerPortion }
|
||||
class Meal {
|
||||
static final Box<Meal> box = objectBox.store.box<Meal>();
|
||||
|
||||
// properties
|
||||
int id;
|
||||
bool deleted;
|
||||
String value;
|
||||
double? carbsRatio;
|
||||
double? portionSize;
|
||||
@ -20,15 +22,17 @@ class Meal {
|
||||
double? delayedBolusRate;
|
||||
String? notes;
|
||||
|
||||
|
||||
// relations
|
||||
final mealSource = ToOne<MealSource>();
|
||||
final mealCategory = ToOne<MealCategory>();
|
||||
final mealPortionType = ToOne<MealPortionType>();
|
||||
final portionSizeAccuracy = ToOne<Accuracy>();
|
||||
final carbsRatioAccuracy = ToOne<Accuracy>();
|
||||
|
||||
// constructor
|
||||
Meal({
|
||||
this.id = 0,
|
||||
this.deleted = false,
|
||||
this.value = '',
|
||||
this.carbsRatio,
|
||||
this.portionSize,
|
||||
@ -38,8 +42,22 @@ class Meal {
|
||||
this.notes,
|
||||
});
|
||||
|
||||
// methods
|
||||
static Meal? get(int id) => box.get(id);
|
||||
static List<Meal> getAll() => box.getAll();
|
||||
static void put(Meal meal) => box.put(meal);
|
||||
static void remove(int id) => box.remove(id);
|
||||
|
||||
static List<Meal> getAll() => box.getAll();
|
||||
|
||||
static void remove(int id) {
|
||||
final item = box.get(id);
|
||||
if (item != null) {
|
||||
item.deleted = true;
|
||||
box.put(item);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
@ -5,18 +5,36 @@ import 'package:objectbox/objectbox.dart';
|
||||
class MealCategory {
|
||||
static final Box<MealCategory> box = objectBox.store.box<MealCategory>();
|
||||
|
||||
// properties
|
||||
int id;
|
||||
bool deleted;
|
||||
String value;
|
||||
String? notes;
|
||||
|
||||
// constructor
|
||||
MealCategory({
|
||||
this.id = 0,
|
||||
this.deleted = false,
|
||||
this.value = '',
|
||||
this.notes,
|
||||
});
|
||||
|
||||
// methods
|
||||
static MealCategory? get(int id) => box.get(id);
|
||||
static List<MealCategory> getAll() => box.getAll();
|
||||
static void put(MealCategory mealCategory) => box.put(mealCategory);
|
||||
static void remove(int id) => box.remove(id);
|
||||
|
||||
static List<MealCategory> getAll() => box.getAll();
|
||||
|
||||
static void remove(int id) {
|
||||
final item = box.get(id);
|
||||
if (item != null) {
|
||||
item.deleted = true;
|
||||
box.put(item);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
@ -5,18 +5,36 @@ import 'package:objectbox/objectbox.dart';
|
||||
class MealPortionType {
|
||||
static final Box<MealPortionType> box = objectBox.store.box<MealPortionType>();
|
||||
|
||||
// properties
|
||||
int id;
|
||||
bool deleted;
|
||||
String value;
|
||||
String? notes;
|
||||
|
||||
// constructor
|
||||
MealPortionType({
|
||||
this.id = 0,
|
||||
this.deleted = false,
|
||||
this.value = '',
|
||||
this.notes,
|
||||
});
|
||||
|
||||
// methods
|
||||
static MealPortionType? get(int id) => box.get(id);
|
||||
static List<MealPortionType> getAll() => box.getAll();
|
||||
static void put(MealPortionType mealPortionType) => box.put(mealPortionType);
|
||||
static void remove(int id) => box.remove(id);
|
||||
|
||||
static List<MealPortionType> getAll() => box.getAll();
|
||||
|
||||
static void remove(int id) {
|
||||
final item = box.get(id);
|
||||
if (item != null) {
|
||||
item.deleted = true;
|
||||
box.put(item);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
@ -8,23 +8,42 @@ import 'package:objectbox/objectbox.dart';
|
||||
class MealSource {
|
||||
static final Box<MealSource> box = objectBox.store.box<MealSource>();
|
||||
|
||||
// properties
|
||||
int id;
|
||||
bool deleted;
|
||||
String value;
|
||||
String? notes;
|
||||
|
||||
// relations
|
||||
final defaultMealCategory = ToOne<MealCategory>();
|
||||
final defaultMealPortionType = ToOne<MealPortionType>();
|
||||
final defaultCarbsRatioAccuracy = ToOne<Accuracy>();
|
||||
final defaultPortionSizeAccuracy = ToOne<Accuracy>();
|
||||
|
||||
// constructor
|
||||
MealSource({
|
||||
this.id = 0,
|
||||
this.deleted = false,
|
||||
this.value = '',
|
||||
this.notes,
|
||||
});
|
||||
|
||||
// methods
|
||||
static MealSource? get(int id) => box.get(id);
|
||||
static List<MealSource> getAll() => box.getAll();
|
||||
static void put(MealSource mealSource) => box.put(mealSource);
|
||||
static void remove(int id) => box.remove(id);
|
||||
|
||||
static List<MealSource> getAll() => box.getAll();
|
||||
|
||||
static void remove(int id) {
|
||||
final item = box.get(id);
|
||||
if (item != null) {
|
||||
item.deleted = true;
|
||||
box.put(item);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import 'package:diameter/screens/bolus/bolus_profile_list.dart';
|
||||
import 'package:diameter/screens/log/log.dart';
|
||||
import 'package:diameter/screens/log/log_entry/log_entry.dart';
|
||||
import 'package:diameter/screens/log/log_entry/log_event_detail.dart';
|
||||
import 'package:diameter/screens/log/active_log_event_list.dart';
|
||||
import 'package:diameter/screens/log/log_event_type_detail.dart';
|
||||
import 'package:diameter/screens/log/log_event_type_list.dart';
|
||||
import 'package:diameter/screens/log/log_entry/log_meal_detail.dart';
|
||||
@ -42,6 +43,7 @@ class Routes {
|
||||
static const String logEventType = LogEventTypeDetailScreen.routeName;
|
||||
static const String logEventTypes = LogEventTypeListScreen.routeName;
|
||||
static const List<String> logEventTypeRoutes = [logEventType, logEventTypes];
|
||||
static const String activeEvents = ActiveEventListScreen.routeName;
|
||||
|
||||
static const String meal = MealDetailScreen.routeName;
|
||||
static const String meals = MealListScreen.routeName;
|
||||
@ -105,6 +107,14 @@ class _NavigationState extends State<Navigation> {
|
||||
},
|
||||
selected: Routes.logEntryRoutes.contains(widget.currentLocation),
|
||||
),
|
||||
ListTile(
|
||||
title: const Text('Active Events'),
|
||||
leading: const Icon(Icons.event),
|
||||
onTap: () {
|
||||
selectDestination(Routes.activeEvents);
|
||||
},
|
||||
selected: widget.currentLocation == Routes.activeEvents,
|
||||
),
|
||||
ListTile(
|
||||
title: const Text('Meals'),
|
||||
leading: const Icon(Icons.restaurant),
|
||||
|
@ -5,7 +5,7 @@
|
||||
"entities": [
|
||||
{
|
||||
"id": "2:1467758525778521891",
|
||||
"lastPropertyId": "5:3908367275335317130",
|
||||
"lastPropertyId": "6:3409466778841164684",
|
||||
"name": "Basal",
|
||||
"properties": [
|
||||
{
|
||||
@ -36,13 +36,18 @@
|
||||
"flags": 520,
|
||||
"indexId": "1:8279975749291974737",
|
||||
"relationTarget": "BasalProfile"
|
||||
},
|
||||
{
|
||||
"id": "6:3409466778841164684",
|
||||
"name": "deleted",
|
||||
"type": 1
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
},
|
||||
{
|
||||
"id": "3:3613736032926903785",
|
||||
"lastPropertyId": "4:6719547342639071472",
|
||||
"lastPropertyId": "5:8140071977687660397",
|
||||
"name": "BasalProfile",
|
||||
"properties": [
|
||||
{
|
||||
@ -65,13 +70,18 @@
|
||||
"id": "4:6719547342639071472",
|
||||
"name": "notes",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "5:8140071977687660397",
|
||||
"name": "deleted",
|
||||
"type": 1
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
},
|
||||
{
|
||||
"id": "4:3417770529060202389",
|
||||
"lastPropertyId": "8:7679622918986671917",
|
||||
"lastPropertyId": "9:7440090146687096977",
|
||||
"name": "Bolus",
|
||||
"properties": [
|
||||
{
|
||||
@ -117,13 +127,18 @@
|
||||
"flags": 520,
|
||||
"indexId": "2:1936045997906240691",
|
||||
"relationTarget": "BolusProfile"
|
||||
},
|
||||
{
|
||||
"id": "9:7440090146687096977",
|
||||
"name": "deleted",
|
||||
"type": 1
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
},
|
||||
{
|
||||
"id": "5:8812452529027052317",
|
||||
"lastPropertyId": "4:3030493484602726372",
|
||||
"lastPropertyId": "5:8082994824481464395",
|
||||
"name": "BolusProfile",
|
||||
"properties": [
|
||||
{
|
||||
@ -146,13 +161,18 @@
|
||||
"id": "4:3030493484602726372",
|
||||
"name": "notes",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "5:8082994824481464395",
|
||||
"name": "deleted",
|
||||
"type": 1
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
},
|
||||
{
|
||||
"id": "6:752131069307970560",
|
||||
"lastPropertyId": "8:6492273995038150006",
|
||||
"lastPropertyId": "9:1692732373071965573",
|
||||
"name": "LogEntry",
|
||||
"properties": [
|
||||
{
|
||||
@ -195,13 +215,18 @@
|
||||
"id": "8:6492273995038150006",
|
||||
"name": "notes",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "9:1692732373071965573",
|
||||
"name": "deleted",
|
||||
"type": 1
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
},
|
||||
{
|
||||
"id": "7:4303325892753185970",
|
||||
"lastPropertyId": "8:2514297323717317184",
|
||||
"lastPropertyId": "11:2013538196800336796",
|
||||
"name": "LogEvent",
|
||||
"properties": [
|
||||
{
|
||||
@ -253,13 +278,34 @@
|
||||
"flags": 520,
|
||||
"indexId": "5:1417691902662024007",
|
||||
"relationTarget": "LogEventType"
|
||||
},
|
||||
{
|
||||
"id": "9:8477413048577624801",
|
||||
"name": "deleted",
|
||||
"type": 1
|
||||
},
|
||||
{
|
||||
"id": "10:987218091728524211",
|
||||
"name": "bolusProfileId",
|
||||
"type": 11,
|
||||
"flags": 520,
|
||||
"indexId": "25:2500612771974500993",
|
||||
"relationTarget": "BolusProfile"
|
||||
},
|
||||
{
|
||||
"id": "11:2013538196800336796",
|
||||
"name": "basalProfileId",
|
||||
"type": 11,
|
||||
"flags": 520,
|
||||
"indexId": "26:4562998391990896273",
|
||||
"relationTarget": "BasalProfile"
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
},
|
||||
{
|
||||
"id": "8:8362795406595606110",
|
||||
"lastPropertyId": "5:7361377572496986196",
|
||||
"lastPropertyId": "8:1869014400856897151",
|
||||
"name": "LogEventType",
|
||||
"properties": [
|
||||
{
|
||||
@ -287,13 +333,34 @@
|
||||
"id": "5:7361377572496986196",
|
||||
"name": "notes",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "6:5428344494256722438",
|
||||
"name": "deleted",
|
||||
"type": 1
|
||||
},
|
||||
{
|
||||
"id": "7:9194648252717310397",
|
||||
"name": "bolusProfileId",
|
||||
"type": 11,
|
||||
"flags": 520,
|
||||
"indexId": "27:758221514459743282",
|
||||
"relationTarget": "BolusProfile"
|
||||
},
|
||||
{
|
||||
"id": "8:1869014400856897151",
|
||||
"name": "basalProfileId",
|
||||
"type": 11,
|
||||
"flags": 520,
|
||||
"indexId": "28:4563029809754152081",
|
||||
"relationTarget": "BasalProfile"
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
},
|
||||
{
|
||||
"id": "9:411177866700467286",
|
||||
"lastPropertyId": "16:7121997990741934484",
|
||||
"lastPropertyId": "17:7341439841011629937",
|
||||
"name": "LogMeal",
|
||||
"properties": [
|
||||
{
|
||||
@ -397,13 +464,18 @@
|
||||
"flags": 520,
|
||||
"indexId": "12:35287836658362611",
|
||||
"relationTarget": "Accuracy"
|
||||
},
|
||||
{
|
||||
"id": "17:7341439841011629937",
|
||||
"name": "deleted",
|
||||
"type": 1
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
},
|
||||
{
|
||||
"id": "10:382130101578692012",
|
||||
"lastPropertyId": "13:4890778480468380841",
|
||||
"lastPropertyId": "14:3567196286623536415",
|
||||
"name": "Meal",
|
||||
"properties": [
|
||||
{
|
||||
@ -486,13 +558,18 @@
|
||||
"flags": 520,
|
||||
"indexId": "17:9108886538013386415",
|
||||
"relationTarget": "Accuracy"
|
||||
},
|
||||
{
|
||||
"id": "14:3567196286623536415",
|
||||
"name": "deleted",
|
||||
"type": 1
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
},
|
||||
{
|
||||
"id": "11:3158200688796904913",
|
||||
"lastPropertyId": "3:3543757971350345683",
|
||||
"lastPropertyId": "4:824435977543069541",
|
||||
"name": "MealCategory",
|
||||
"properties": [
|
||||
{
|
||||
@ -510,13 +587,18 @@
|
||||
"id": "3:3543757971350345683",
|
||||
"name": "notes",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "4:824435977543069541",
|
||||
"name": "deleted",
|
||||
"type": 1
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
},
|
||||
{
|
||||
"id": "12:2111511899235985637",
|
||||
"lastPropertyId": "3:1950852666001613408",
|
||||
"lastPropertyId": "4:5680236937391945907",
|
||||
"name": "MealPortionType",
|
||||
"properties": [
|
||||
{
|
||||
@ -534,13 +616,18 @@
|
||||
"id": "3:1950852666001613408",
|
||||
"name": "notes",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "4:5680236937391945907",
|
||||
"name": "deleted",
|
||||
"type": 1
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
},
|
||||
{
|
||||
"id": "13:1283034494527412242",
|
||||
"lastPropertyId": "7:5852853174931678667",
|
||||
"lastPropertyId": "8:4547899751779962180",
|
||||
"name": "MealSource",
|
||||
"properties": [
|
||||
{
|
||||
@ -590,13 +677,18 @@
|
||||
"flags": 520,
|
||||
"indexId": "21:1931330716440762729",
|
||||
"relationTarget": "Accuracy"
|
||||
},
|
||||
{
|
||||
"id": "8:4547899751779962180",
|
||||
"name": "deleted",
|
||||
"type": 1
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
},
|
||||
{
|
||||
"id": "14:8033487006694871160",
|
||||
"lastPropertyId": "11:4818762109001810295",
|
||||
"lastPropertyId": "12:4765038304548427459",
|
||||
"name": "LogBolus",
|
||||
"properties": [
|
||||
{
|
||||
@ -663,13 +755,18 @@
|
||||
"flags": 520,
|
||||
"indexId": "24:4224983816051843140",
|
||||
"relationTarget": "LogMeal"
|
||||
},
|
||||
{
|
||||
"id": "12:4765038304548427459",
|
||||
"name": "deleted",
|
||||
"type": 1
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
},
|
||||
{
|
||||
"id": "15:291512798403320400",
|
||||
"lastPropertyId": "6:6625101003527710274",
|
||||
"lastPropertyId": "7:6675647182186603076",
|
||||
"name": "Accuracy",
|
||||
"properties": [
|
||||
{
|
||||
@ -702,13 +799,18 @@
|
||||
"id": "6:6625101003527710274",
|
||||
"name": "notes",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "7:6675647182186603076",
|
||||
"name": "deleted",
|
||||
"type": 1
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
}
|
||||
],
|
||||
"lastEntityId": "15:291512798403320400",
|
||||
"lastIndexId": "24:4224983816051843140",
|
||||
"lastIndexId": "28:4563029809754152081",
|
||||
"lastRelationId": "0:0",
|
||||
"lastSequenceId": "0:0",
|
||||
"modelVersion": 5,
|
||||
|
@ -30,7 +30,7 @@ final _entities = <ModelEntity>[
|
||||
ModelEntity(
|
||||
id: const IdUid(2, 1467758525778521891),
|
||||
name: 'Basal',
|
||||
lastPropertyId: const IdUid(5, 3908367275335317130),
|
||||
lastPropertyId: const IdUid(6, 3409466778841164684),
|
||||
flags: 0,
|
||||
properties: <ModelProperty>[
|
||||
ModelProperty(
|
||||
@ -59,14 +59,19 @@ final _entities = <ModelEntity>[
|
||||
type: 11,
|
||||
flags: 520,
|
||||
indexId: const IdUid(1, 8279975749291974737),
|
||||
relationTarget: 'BasalProfile')
|
||||
relationTarget: 'BasalProfile'),
|
||||
ModelProperty(
|
||||
id: const IdUid(6, 3409466778841164684),
|
||||
name: 'deleted',
|
||||
type: 1,
|
||||
flags: 0)
|
||||
],
|
||||
relations: <ModelRelation>[],
|
||||
backlinks: <ModelBacklink>[]),
|
||||
ModelEntity(
|
||||
id: const IdUid(3, 3613736032926903785),
|
||||
name: 'BasalProfile',
|
||||
lastPropertyId: const IdUid(4, 6719547342639071472),
|
||||
lastPropertyId: const IdUid(5, 8140071977687660397),
|
||||
flags: 0,
|
||||
properties: <ModelProperty>[
|
||||
ModelProperty(
|
||||
@ -88,6 +93,11 @@ final _entities = <ModelEntity>[
|
||||
id: const IdUid(4, 6719547342639071472),
|
||||
name: 'notes',
|
||||
type: 9,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(5, 8140071977687660397),
|
||||
name: 'deleted',
|
||||
type: 1,
|
||||
flags: 0)
|
||||
],
|
||||
relations: <ModelRelation>[],
|
||||
@ -95,7 +105,7 @@ final _entities = <ModelEntity>[
|
||||
ModelEntity(
|
||||
id: const IdUid(4, 3417770529060202389),
|
||||
name: 'Bolus',
|
||||
lastPropertyId: const IdUid(8, 7679622918986671917),
|
||||
lastPropertyId: const IdUid(9, 7440090146687096977),
|
||||
flags: 0,
|
||||
properties: <ModelProperty>[
|
||||
ModelProperty(
|
||||
@ -139,14 +149,19 @@ final _entities = <ModelEntity>[
|
||||
type: 11,
|
||||
flags: 520,
|
||||
indexId: const IdUid(2, 1936045997906240691),
|
||||
relationTarget: 'BolusProfile')
|
||||
relationTarget: 'BolusProfile'),
|
||||
ModelProperty(
|
||||
id: const IdUid(9, 7440090146687096977),
|
||||
name: 'deleted',
|
||||
type: 1,
|
||||
flags: 0)
|
||||
],
|
||||
relations: <ModelRelation>[],
|
||||
backlinks: <ModelBacklink>[]),
|
||||
ModelEntity(
|
||||
id: const IdUid(5, 8812452529027052317),
|
||||
name: 'BolusProfile',
|
||||
lastPropertyId: const IdUid(4, 3030493484602726372),
|
||||
lastPropertyId: const IdUid(5, 8082994824481464395),
|
||||
flags: 0,
|
||||
properties: <ModelProperty>[
|
||||
ModelProperty(
|
||||
@ -168,6 +183,11 @@ final _entities = <ModelEntity>[
|
||||
id: const IdUid(4, 3030493484602726372),
|
||||
name: 'notes',
|
||||
type: 9,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(5, 8082994824481464395),
|
||||
name: 'deleted',
|
||||
type: 1,
|
||||
flags: 0)
|
||||
],
|
||||
relations: <ModelRelation>[],
|
||||
@ -175,7 +195,7 @@ final _entities = <ModelEntity>[
|
||||
ModelEntity(
|
||||
id: const IdUid(6, 752131069307970560),
|
||||
name: 'LogEntry',
|
||||
lastPropertyId: const IdUid(8, 6492273995038150006),
|
||||
lastPropertyId: const IdUid(9, 1692732373071965573),
|
||||
flags: 0,
|
||||
properties: <ModelProperty>[
|
||||
ModelProperty(
|
||||
@ -217,24 +237,19 @@ final _entities = <ModelEntity>[
|
||||
id: const IdUid(8, 6492273995038150006),
|
||||
name: 'notes',
|
||||
type: 9,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(9, 1692732373071965573),
|
||||
name: 'deleted',
|
||||
type: 1,
|
||||
flags: 0)
|
||||
],
|
||||
relations: <ModelRelation>[],
|
||||
backlinks: <ModelBacklink>[
|
||||
ModelBacklink(
|
||||
name: 'events', srcEntity: 'LogEvent', srcField: 'logEntry'),
|
||||
ModelBacklink(
|
||||
name: 'endedEvents',
|
||||
srcEntity: 'LogEvent',
|
||||
srcField: 'endLogEntry'),
|
||||
ModelBacklink(
|
||||
name: 'meals', srcEntity: 'LogMeal', srcField: 'logEntry'),
|
||||
ModelBacklink(name: 'boli', srcEntity: 'LogBolus', srcField: 'logEntry')
|
||||
]),
|
||||
backlinks: <ModelBacklink>[]),
|
||||
ModelEntity(
|
||||
id: const IdUid(7, 4303325892753185970),
|
||||
name: 'LogEvent',
|
||||
lastPropertyId: const IdUid(8, 2514297323717317184),
|
||||
lastPropertyId: const IdUid(11, 2013538196800336796),
|
||||
flags: 0,
|
||||
properties: <ModelProperty>[
|
||||
ModelProperty(
|
||||
@ -282,14 +297,33 @@ final _entities = <ModelEntity>[
|
||||
type: 11,
|
||||
flags: 520,
|
||||
indexId: const IdUid(5, 1417691902662024007),
|
||||
relationTarget: 'LogEventType')
|
||||
relationTarget: 'LogEventType'),
|
||||
ModelProperty(
|
||||
id: const IdUid(9, 8477413048577624801),
|
||||
name: 'deleted',
|
||||
type: 1,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(10, 987218091728524211),
|
||||
name: 'bolusProfileId',
|
||||
type: 11,
|
||||
flags: 520,
|
||||
indexId: const IdUid(25, 2500612771974500993),
|
||||
relationTarget: 'BolusProfile'),
|
||||
ModelProperty(
|
||||
id: const IdUid(11, 2013538196800336796),
|
||||
name: 'basalProfileId',
|
||||
type: 11,
|
||||
flags: 520,
|
||||
indexId: const IdUid(26, 4562998391990896273),
|
||||
relationTarget: 'BasalProfile')
|
||||
],
|
||||
relations: <ModelRelation>[],
|
||||
backlinks: <ModelBacklink>[]),
|
||||
ModelEntity(
|
||||
id: const IdUid(8, 8362795406595606110),
|
||||
name: 'LogEventType',
|
||||
lastPropertyId: const IdUid(5, 7361377572496986196),
|
||||
lastPropertyId: const IdUid(8, 1869014400856897151),
|
||||
flags: 0,
|
||||
properties: <ModelProperty>[
|
||||
ModelProperty(
|
||||
@ -316,14 +350,33 @@ final _entities = <ModelEntity>[
|
||||
id: const IdUid(5, 7361377572496986196),
|
||||
name: 'notes',
|
||||
type: 9,
|
||||
flags: 0)
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(6, 5428344494256722438),
|
||||
name: 'deleted',
|
||||
type: 1,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(7, 9194648252717310397),
|
||||
name: 'bolusProfileId',
|
||||
type: 11,
|
||||
flags: 520,
|
||||
indexId: const IdUid(27, 758221514459743282),
|
||||
relationTarget: 'BolusProfile'),
|
||||
ModelProperty(
|
||||
id: const IdUid(8, 1869014400856897151),
|
||||
name: 'basalProfileId',
|
||||
type: 11,
|
||||
flags: 520,
|
||||
indexId: const IdUid(28, 4563029809754152081),
|
||||
relationTarget: 'BasalProfile')
|
||||
],
|
||||
relations: <ModelRelation>[],
|
||||
backlinks: <ModelBacklink>[]),
|
||||
ModelEntity(
|
||||
id: const IdUid(9, 411177866700467286),
|
||||
name: 'LogMeal',
|
||||
lastPropertyId: const IdUid(16, 7121997990741934484),
|
||||
lastPropertyId: const IdUid(17, 7341439841011629937),
|
||||
flags: 0,
|
||||
properties: <ModelProperty>[
|
||||
ModelProperty(
|
||||
@ -419,14 +472,19 @@ final _entities = <ModelEntity>[
|
||||
type: 11,
|
||||
flags: 520,
|
||||
indexId: const IdUid(12, 35287836658362611),
|
||||
relationTarget: 'Accuracy')
|
||||
relationTarget: 'Accuracy'),
|
||||
ModelProperty(
|
||||
id: const IdUid(17, 7341439841011629937),
|
||||
name: 'deleted',
|
||||
type: 1,
|
||||
flags: 0)
|
||||
],
|
||||
relations: <ModelRelation>[],
|
||||
backlinks: <ModelBacklink>[]),
|
||||
ModelEntity(
|
||||
id: const IdUid(10, 382130101578692012),
|
||||
name: 'Meal',
|
||||
lastPropertyId: const IdUid(13, 4890778480468380841),
|
||||
lastPropertyId: const IdUid(14, 3567196286623536415),
|
||||
flags: 0,
|
||||
properties: <ModelProperty>[
|
||||
ModelProperty(
|
||||
@ -503,14 +561,19 @@ final _entities = <ModelEntity>[
|
||||
type: 11,
|
||||
flags: 520,
|
||||
indexId: const IdUid(17, 9108886538013386415),
|
||||
relationTarget: 'Accuracy')
|
||||
relationTarget: 'Accuracy'),
|
||||
ModelProperty(
|
||||
id: const IdUid(14, 3567196286623536415),
|
||||
name: 'deleted',
|
||||
type: 1,
|
||||
flags: 0)
|
||||
],
|
||||
relations: <ModelRelation>[],
|
||||
backlinks: <ModelBacklink>[]),
|
||||
ModelEntity(
|
||||
id: const IdUid(11, 3158200688796904913),
|
||||
name: 'MealCategory',
|
||||
lastPropertyId: const IdUid(3, 3543757971350345683),
|
||||
lastPropertyId: const IdUid(4, 824435977543069541),
|
||||
flags: 0,
|
||||
properties: <ModelProperty>[
|
||||
ModelProperty(
|
||||
@ -527,6 +590,11 @@ final _entities = <ModelEntity>[
|
||||
id: const IdUid(3, 3543757971350345683),
|
||||
name: 'notes',
|
||||
type: 9,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(4, 824435977543069541),
|
||||
name: 'deleted',
|
||||
type: 1,
|
||||
flags: 0)
|
||||
],
|
||||
relations: <ModelRelation>[],
|
||||
@ -534,7 +602,7 @@ final _entities = <ModelEntity>[
|
||||
ModelEntity(
|
||||
id: const IdUid(12, 2111511899235985637),
|
||||
name: 'MealPortionType',
|
||||
lastPropertyId: const IdUid(3, 1950852666001613408),
|
||||
lastPropertyId: const IdUid(4, 5680236937391945907),
|
||||
flags: 0,
|
||||
properties: <ModelProperty>[
|
||||
ModelProperty(
|
||||
@ -551,6 +619,11 @@ final _entities = <ModelEntity>[
|
||||
id: const IdUid(3, 1950852666001613408),
|
||||
name: 'notes',
|
||||
type: 9,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(4, 5680236937391945907),
|
||||
name: 'deleted',
|
||||
type: 1,
|
||||
flags: 0)
|
||||
],
|
||||
relations: <ModelRelation>[],
|
||||
@ -558,7 +631,7 @@ final _entities = <ModelEntity>[
|
||||
ModelEntity(
|
||||
id: const IdUid(13, 1283034494527412242),
|
||||
name: 'MealSource',
|
||||
lastPropertyId: const IdUid(7, 5852853174931678667),
|
||||
lastPropertyId: const IdUid(8, 4547899751779962180),
|
||||
flags: 0,
|
||||
properties: <ModelProperty>[
|
||||
ModelProperty(
|
||||
@ -603,14 +676,19 @@ final _entities = <ModelEntity>[
|
||||
type: 11,
|
||||
flags: 520,
|
||||
indexId: const IdUid(21, 1931330716440762729),
|
||||
relationTarget: 'Accuracy')
|
||||
relationTarget: 'Accuracy'),
|
||||
ModelProperty(
|
||||
id: const IdUid(8, 4547899751779962180),
|
||||
name: 'deleted',
|
||||
type: 1,
|
||||
flags: 0)
|
||||
],
|
||||
relations: <ModelRelation>[],
|
||||
backlinks: <ModelBacklink>[]),
|
||||
ModelEntity(
|
||||
id: const IdUid(14, 8033487006694871160),
|
||||
name: 'LogBolus',
|
||||
lastPropertyId: const IdUid(11, 4818762109001810295),
|
||||
lastPropertyId: const IdUid(12, 4765038304548427459),
|
||||
flags: 0,
|
||||
properties: <ModelProperty>[
|
||||
ModelProperty(
|
||||
@ -673,14 +751,19 @@ final _entities = <ModelEntity>[
|
||||
type: 11,
|
||||
flags: 520,
|
||||
indexId: const IdUid(24, 4224983816051843140),
|
||||
relationTarget: 'LogMeal')
|
||||
relationTarget: 'LogMeal'),
|
||||
ModelProperty(
|
||||
id: const IdUid(12, 4765038304548427459),
|
||||
name: 'deleted',
|
||||
type: 1,
|
||||
flags: 0)
|
||||
],
|
||||
relations: <ModelRelation>[],
|
||||
backlinks: <ModelBacklink>[]),
|
||||
ModelEntity(
|
||||
id: const IdUid(15, 291512798403320400),
|
||||
name: 'Accuracy',
|
||||
lastPropertyId: const IdUid(6, 6625101003527710274),
|
||||
lastPropertyId: const IdUid(7, 6675647182186603076),
|
||||
flags: 0,
|
||||
properties: <ModelProperty>[
|
||||
ModelProperty(
|
||||
@ -712,6 +795,11 @@ final _entities = <ModelEntity>[
|
||||
id: const IdUid(6, 6625101003527710274),
|
||||
name: 'notes',
|
||||
type: 9,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(7, 6675647182186603076),
|
||||
name: 'deleted',
|
||||
type: 1,
|
||||
flags: 0)
|
||||
],
|
||||
relations: <ModelRelation>[],
|
||||
@ -739,7 +827,7 @@ ModelDefinition getObjectBoxModel() {
|
||||
final model = ModelInfo(
|
||||
entities: _entities,
|
||||
lastEntityId: const IdUid(15, 291512798403320400),
|
||||
lastIndexId: const IdUid(24, 4224983816051843140),
|
||||
lastIndexId: const IdUid(28, 4563029809754152081),
|
||||
lastRelationId: const IdUid(0, 0),
|
||||
lastSequenceId: const IdUid(0, 0),
|
||||
retiredEntityUids: const [3095978685310268382],
|
||||
@ -767,12 +855,13 @@ ModelDefinition getObjectBoxModel() {
|
||||
object.id = id;
|
||||
},
|
||||
objectToFB: (Basal object, fb.Builder fbb) {
|
||||
fbb.startTable(6);
|
||||
fbb.startTable(7);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addInt64(1, object.startTime.millisecondsSinceEpoch);
|
||||
fbb.addInt64(2, object.endTime.millisecondsSinceEpoch);
|
||||
fbb.addFloat64(3, object.units);
|
||||
fbb.addInt64(4, object.basalProfile.targetId);
|
||||
fbb.addBool(5, object.deleted);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
@ -782,6 +871,8 @@ ModelDefinition getObjectBoxModel() {
|
||||
|
||||
final object = Basal(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 14, false),
|
||||
startTime: DateTime.fromMillisecondsSinceEpoch(
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0)),
|
||||
endTime: DateTime.fromMillisecondsSinceEpoch(
|
||||
@ -805,11 +896,12 @@ ModelDefinition getObjectBoxModel() {
|
||||
final nameOffset = fbb.writeString(object.name);
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(5);
|
||||
fbb.startTable(6);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addOffset(1, nameOffset);
|
||||
fbb.addBool(2, object.active);
|
||||
fbb.addOffset(3, notesOffset);
|
||||
fbb.addBool(4, object.deleted);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
@ -819,6 +911,8 @@ ModelDefinition getObjectBoxModel() {
|
||||
|
||||
final object = BasalProfile(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 12, false),
|
||||
name:
|
||||
const fb.StringReader().vTableGet(buffer, rootOffset, 6, ''),
|
||||
active:
|
||||
@ -837,7 +931,7 @@ ModelDefinition getObjectBoxModel() {
|
||||
object.id = id;
|
||||
},
|
||||
objectToFB: (Bolus object, fb.Builder fbb) {
|
||||
fbb.startTable(9);
|
||||
fbb.startTable(10);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addInt64(1, object.startTime.millisecondsSinceEpoch);
|
||||
fbb.addInt64(2, object.endTime.millisecondsSinceEpoch);
|
||||
@ -846,6 +940,7 @@ ModelDefinition getObjectBoxModel() {
|
||||
fbb.addInt64(5, object.mgPerDl);
|
||||
fbb.addFloat64(6, object.mmolPerL);
|
||||
fbb.addInt64(7, object.bolusProfile.targetId);
|
||||
fbb.addBool(8, object.deleted);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
@ -855,6 +950,8 @@ ModelDefinition getObjectBoxModel() {
|
||||
|
||||
final object = Bolus(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 20, false),
|
||||
startTime: DateTime.fromMillisecondsSinceEpoch(
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0)),
|
||||
endTime: DateTime.fromMillisecondsSinceEpoch(
|
||||
@ -884,11 +981,12 @@ ModelDefinition getObjectBoxModel() {
|
||||
final nameOffset = fbb.writeString(object.name);
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(5);
|
||||
fbb.startTable(6);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addOffset(1, nameOffset);
|
||||
fbb.addBool(2, object.active);
|
||||
fbb.addOffset(3, notesOffset);
|
||||
fbb.addBool(4, object.deleted);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
@ -898,6 +996,8 @@ ModelDefinition getObjectBoxModel() {
|
||||
|
||||
final object = BolusProfile(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 12, false),
|
||||
name:
|
||||
const fb.StringReader().vTableGet(buffer, rootOffset, 6, ''),
|
||||
active:
|
||||
@ -910,20 +1010,7 @@ ModelDefinition getObjectBoxModel() {
|
||||
LogEntry: EntityDefinition<LogEntry>(
|
||||
model: _entities[4],
|
||||
toOneRelations: (LogEntry object) => [],
|
||||
toManyRelations: (LogEntry object) => {
|
||||
RelInfo<LogEvent>.toOneBacklink(
|
||||
6, object.id, (LogEvent srcObject) => srcObject.logEntry):
|
||||
object.events,
|
||||
RelInfo<LogEvent>.toOneBacklink(7, object.id,
|
||||
(LogEvent srcObject) => srcObject.endLogEntry):
|
||||
object.endedEvents,
|
||||
RelInfo<LogMeal>.toOneBacklink(
|
||||
10, object.id, (LogMeal srcObject) => srcObject.logEntry):
|
||||
object.meals,
|
||||
RelInfo<LogBolus>.toOneBacklink(
|
||||
9, object.id, (LogBolus srcObject) => srcObject.logEntry):
|
||||
object.boli
|
||||
},
|
||||
toManyRelations: (LogEntry object) => {},
|
||||
getId: (LogEntry object) => object.id,
|
||||
setId: (LogEntry object, int id) {
|
||||
object.id = id;
|
||||
@ -931,7 +1018,7 @@ ModelDefinition getObjectBoxModel() {
|
||||
objectToFB: (LogEntry object, fb.Builder fbb) {
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(9);
|
||||
fbb.startTable(10);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addInt64(1, object.time.millisecondsSinceEpoch);
|
||||
fbb.addInt64(2, object.mgPerDl);
|
||||
@ -940,6 +1027,7 @@ ModelDefinition getObjectBoxModel() {
|
||||
fbb.addInt64(5, object.delayedBolusDuration);
|
||||
fbb.addFloat64(6, object.delayedBolusRate);
|
||||
fbb.addOffset(7, notesOffset);
|
||||
fbb.addBool(8, object.deleted);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
@ -949,6 +1037,8 @@ ModelDefinition getObjectBoxModel() {
|
||||
|
||||
final object = LogEntry(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 20, false),
|
||||
time: DateTime.fromMillisecondsSinceEpoch(
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0)),
|
||||
mgPerDl: const fb.Int64Reader()
|
||||
@ -963,36 +1053,18 @@ ModelDefinition getObjectBoxModel() {
|
||||
.vTableGetNullable(buffer, rootOffset, 16),
|
||||
notes: const fb.StringReader()
|
||||
.vTableGetNullable(buffer, rootOffset, 18));
|
||||
InternalToManyAccess.setRelInfo(
|
||||
object.events,
|
||||
store,
|
||||
RelInfo<LogEvent>.toOneBacklink(
|
||||
6, object.id, (LogEvent srcObject) => srcObject.logEntry),
|
||||
store.box<LogEntry>());
|
||||
InternalToManyAccess.setRelInfo(
|
||||
object.endedEvents,
|
||||
store,
|
||||
RelInfo<LogEvent>.toOneBacklink(
|
||||
7, object.id, (LogEvent srcObject) => srcObject.endLogEntry),
|
||||
store.box<LogEntry>());
|
||||
InternalToManyAccess.setRelInfo(
|
||||
object.meals,
|
||||
store,
|
||||
RelInfo<LogMeal>.toOneBacklink(
|
||||
10, object.id, (LogMeal srcObject) => srcObject.logEntry),
|
||||
store.box<LogEntry>());
|
||||
InternalToManyAccess.setRelInfo(
|
||||
object.boli,
|
||||
store,
|
||||
RelInfo<LogBolus>.toOneBacklink(
|
||||
9, object.id, (LogBolus srcObject) => srcObject.logEntry),
|
||||
store.box<LogEntry>());
|
||||
|
||||
return object;
|
||||
}),
|
||||
LogEvent: EntityDefinition<LogEvent>(
|
||||
model: _entities[5],
|
||||
toOneRelations: (LogEvent object) =>
|
||||
[object.logEntry, object.endLogEntry, object.eventType],
|
||||
toOneRelations: (LogEvent object) => [
|
||||
object.logEntry,
|
||||
object.endLogEntry,
|
||||
object.eventType,
|
||||
object.bolusProfile,
|
||||
object.basalProfile
|
||||
],
|
||||
toManyRelations: (LogEvent object) => {},
|
||||
getId: (LogEvent object) => object.id,
|
||||
setId: (LogEvent object, int id) {
|
||||
@ -1001,7 +1073,7 @@ ModelDefinition getObjectBoxModel() {
|
||||
objectToFB: (LogEvent object, fb.Builder fbb) {
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(9);
|
||||
fbb.startTable(12);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addInt64(1, object.time.millisecondsSinceEpoch);
|
||||
fbb.addInt64(2, object.endTime?.millisecondsSinceEpoch);
|
||||
@ -1010,6 +1082,9 @@ ModelDefinition getObjectBoxModel() {
|
||||
fbb.addInt64(5, object.logEntry.targetId);
|
||||
fbb.addInt64(6, object.endLogEntry.targetId);
|
||||
fbb.addInt64(7, object.eventType.targetId);
|
||||
fbb.addBool(8, object.deleted);
|
||||
fbb.addInt64(9, object.bolusProfile.targetId);
|
||||
fbb.addInt64(10, object.basalProfile.targetId);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
@ -1020,6 +1095,8 @@ ModelDefinition getObjectBoxModel() {
|
||||
const fb.Int64Reader().vTableGetNullable(buffer, rootOffset, 8);
|
||||
final object = LogEvent(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 20, false),
|
||||
time: DateTime.fromMillisecondsSinceEpoch(
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0)),
|
||||
endTime: endTimeValue == null
|
||||
@ -1038,11 +1115,18 @@ ModelDefinition getObjectBoxModel() {
|
||||
object.eventType.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 18, 0);
|
||||
object.eventType.attach(store);
|
||||
object.bolusProfile.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 22, 0);
|
||||
object.bolusProfile.attach(store);
|
||||
object.basalProfile.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 24, 0);
|
||||
object.basalProfile.attach(store);
|
||||
return object;
|
||||
}),
|
||||
LogEventType: EntityDefinition<LogEventType>(
|
||||
model: _entities[6],
|
||||
toOneRelations: (LogEventType object) => [],
|
||||
toOneRelations: (LogEventType object) =>
|
||||
[object.bolusProfile, object.basalProfile],
|
||||
toManyRelations: (LogEventType object) => {},
|
||||
getId: (LogEventType object) => object.id,
|
||||
setId: (LogEventType object, int id) {
|
||||
@ -1052,12 +1136,15 @@ ModelDefinition getObjectBoxModel() {
|
||||
final valueOffset = fbb.writeString(object.value);
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(6);
|
||||
fbb.startTable(9);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addOffset(1, valueOffset);
|
||||
fbb.addBool(2, object.hasEndTime);
|
||||
fbb.addInt64(3, object.defaultReminderDuration);
|
||||
fbb.addOffset(4, notesOffset);
|
||||
fbb.addBool(5, object.deleted);
|
||||
fbb.addInt64(6, object.bolusProfile.targetId);
|
||||
fbb.addInt64(7, object.basalProfile.targetId);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
@ -1067,6 +1154,8 @@ ModelDefinition getObjectBoxModel() {
|
||||
|
||||
final object = LogEventType(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 14, false),
|
||||
value:
|
||||
const fb.StringReader().vTableGet(buffer, rootOffset, 6, ''),
|
||||
hasEndTime:
|
||||
@ -1075,7 +1164,12 @@ ModelDefinition getObjectBoxModel() {
|
||||
.vTableGetNullable(buffer, rootOffset, 10),
|
||||
notes: const fb.StringReader()
|
||||
.vTableGetNullable(buffer, rootOffset, 12));
|
||||
|
||||
object.bolusProfile.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 16, 0);
|
||||
object.bolusProfile.attach(store);
|
||||
object.basalProfile.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 18, 0);
|
||||
object.basalProfile.attach(store);
|
||||
return object;
|
||||
}),
|
||||
LogMeal: EntityDefinition<LogMeal>(
|
||||
@ -1098,7 +1192,7 @@ ModelDefinition getObjectBoxModel() {
|
||||
final valueOffset = fbb.writeString(object.value);
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(17);
|
||||
fbb.startTable(18);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addOffset(1, valueOffset);
|
||||
fbb.addFloat64(2, object.carbsRatio);
|
||||
@ -1115,6 +1209,7 @@ ModelDefinition getObjectBoxModel() {
|
||||
fbb.addInt64(13, object.mealPortionType.targetId);
|
||||
fbb.addInt64(14, object.portionSizeAccuracy.targetId);
|
||||
fbb.addInt64(15, object.carbsRatioAccuracy.targetId);
|
||||
fbb.addBool(16, object.deleted);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
@ -1124,6 +1219,8 @@ ModelDefinition getObjectBoxModel() {
|
||||
|
||||
final object = LogMeal(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 36, false),
|
||||
value:
|
||||
const fb.StringReader().vTableGet(buffer, rootOffset, 6, ''),
|
||||
carbsRatio: const fb.Float64Reader()
|
||||
@ -1181,7 +1278,7 @@ ModelDefinition getObjectBoxModel() {
|
||||
final valueOffset = fbb.writeString(object.value);
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(14);
|
||||
fbb.startTable(15);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addOffset(1, valueOffset);
|
||||
fbb.addFloat64(2, object.carbsRatio);
|
||||
@ -1195,6 +1292,7 @@ ModelDefinition getObjectBoxModel() {
|
||||
fbb.addInt64(10, object.mealPortionType.targetId);
|
||||
fbb.addInt64(11, object.portionSizeAccuracy.targetId);
|
||||
fbb.addInt64(12, object.carbsRatioAccuracy.targetId);
|
||||
fbb.addBool(13, object.deleted);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
@ -1204,6 +1302,8 @@ ModelDefinition getObjectBoxModel() {
|
||||
|
||||
final object = Meal(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 30, false),
|
||||
value:
|
||||
const fb.StringReader().vTableGet(buffer, rootOffset, 6, ''),
|
||||
carbsRatio: const fb.Float64Reader()
|
||||
@ -1247,10 +1347,11 @@ ModelDefinition getObjectBoxModel() {
|
||||
final valueOffset = fbb.writeString(object.value);
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(4);
|
||||
fbb.startTable(5);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addOffset(1, valueOffset);
|
||||
fbb.addOffset(2, notesOffset);
|
||||
fbb.addBool(3, object.deleted);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
@ -1260,6 +1361,8 @@ ModelDefinition getObjectBoxModel() {
|
||||
|
||||
final object = MealCategory(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 10, false),
|
||||
value:
|
||||
const fb.StringReader().vTableGet(buffer, rootOffset, 6, ''),
|
||||
notes: const fb.StringReader()
|
||||
@ -1279,10 +1382,11 @@ ModelDefinition getObjectBoxModel() {
|
||||
final valueOffset = fbb.writeString(object.value);
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(4);
|
||||
fbb.startTable(5);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addOffset(1, valueOffset);
|
||||
fbb.addOffset(2, notesOffset);
|
||||
fbb.addBool(3, object.deleted);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
@ -1292,6 +1396,8 @@ ModelDefinition getObjectBoxModel() {
|
||||
|
||||
final object = MealPortionType(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 10, false),
|
||||
value:
|
||||
const fb.StringReader().vTableGet(buffer, rootOffset, 6, ''),
|
||||
notes: const fb.StringReader()
|
||||
@ -1316,7 +1422,7 @@ ModelDefinition getObjectBoxModel() {
|
||||
final valueOffset = fbb.writeString(object.value);
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(8);
|
||||
fbb.startTable(9);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addOffset(1, valueOffset);
|
||||
fbb.addOffset(2, notesOffset);
|
||||
@ -1324,6 +1430,7 @@ ModelDefinition getObjectBoxModel() {
|
||||
fbb.addInt64(4, object.defaultMealPortionType.targetId);
|
||||
fbb.addInt64(5, object.defaultCarbsRatioAccuracy.targetId);
|
||||
fbb.addInt64(6, object.defaultPortionSizeAccuracy.targetId);
|
||||
fbb.addBool(7, object.deleted);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
@ -1333,6 +1440,8 @@ ModelDefinition getObjectBoxModel() {
|
||||
|
||||
final object = MealSource(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 18, false),
|
||||
value:
|
||||
const fb.StringReader().vTableGet(buffer, rootOffset, 6, ''),
|
||||
notes: const fb.StringReader()
|
||||
@ -1363,7 +1472,7 @@ ModelDefinition getObjectBoxModel() {
|
||||
objectToFB: (LogBolus object, fb.Builder fbb) {
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(12);
|
||||
fbb.startTable(13);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addFloat64(1, object.units);
|
||||
fbb.addFloat64(2, object.carbs);
|
||||
@ -1375,6 +1484,7 @@ ModelDefinition getObjectBoxModel() {
|
||||
fbb.addInt64(8, object.logEntry.targetId);
|
||||
fbb.addInt64(9, object.rate.targetId);
|
||||
fbb.addInt64(10, object.meal.targetId);
|
||||
fbb.addBool(11, object.deleted);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
@ -1384,6 +1494,8 @@ ModelDefinition getObjectBoxModel() {
|
||||
|
||||
final object = LogBolus(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 26, false),
|
||||
units:
|
||||
const fb.Float64Reader().vTableGet(buffer, rootOffset, 6, 0),
|
||||
carbs: const fb.Float64Reader()
|
||||
@ -1421,13 +1533,14 @@ ModelDefinition getObjectBoxModel() {
|
||||
final valueOffset = fbb.writeString(object.value);
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(7);
|
||||
fbb.startTable(8);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addOffset(1, valueOffset);
|
||||
fbb.addBool(2, object.forCarbsRatio);
|
||||
fbb.addBool(3, object.forPortionSize);
|
||||
fbb.addInt64(4, object.confidenceRating);
|
||||
fbb.addOffset(5, notesOffset);
|
||||
fbb.addBool(6, object.deleted);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
@ -1437,6 +1550,8 @@ ModelDefinition getObjectBoxModel() {
|
||||
|
||||
final object = Accuracy(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 16, false),
|
||||
value:
|
||||
const fb.StringReader().vTableGet(buffer, rootOffset, 6, ''),
|
||||
forCarbsRatio:
|
||||
@ -1474,6 +1589,10 @@ class Basal_ {
|
||||
/// see [Basal.basalProfile]
|
||||
static final basalProfile =
|
||||
QueryRelationToOne<Basal, BasalProfile>(_entities[0].properties[4]);
|
||||
|
||||
/// see [Basal.deleted]
|
||||
static final deleted =
|
||||
QueryBooleanProperty<Basal>(_entities[0].properties[5]);
|
||||
}
|
||||
|
||||
/// [BasalProfile] entity fields to define ObjectBox queries.
|
||||
@ -1493,6 +1612,10 @@ class BasalProfile_ {
|
||||
/// see [BasalProfile.notes]
|
||||
static final notes =
|
||||
QueryStringProperty<BasalProfile>(_entities[1].properties[3]);
|
||||
|
||||
/// see [BasalProfile.deleted]
|
||||
static final deleted =
|
||||
QueryBooleanProperty<BasalProfile>(_entities[1].properties[4]);
|
||||
}
|
||||
|
||||
/// [Bolus] entity fields to define ObjectBox queries.
|
||||
@ -1525,6 +1648,10 @@ class Bolus_ {
|
||||
/// see [Bolus.bolusProfile]
|
||||
static final bolusProfile =
|
||||
QueryRelationToOne<Bolus, BolusProfile>(_entities[2].properties[7]);
|
||||
|
||||
/// see [Bolus.deleted]
|
||||
static final deleted =
|
||||
QueryBooleanProperty<Bolus>(_entities[2].properties[8]);
|
||||
}
|
||||
|
||||
/// [BolusProfile] entity fields to define ObjectBox queries.
|
||||
@ -1544,6 +1671,10 @@ class BolusProfile_ {
|
||||
/// see [BolusProfile.notes]
|
||||
static final notes =
|
||||
QueryStringProperty<BolusProfile>(_entities[3].properties[3]);
|
||||
|
||||
/// see [BolusProfile.deleted]
|
||||
static final deleted =
|
||||
QueryBooleanProperty<BolusProfile>(_entities[3].properties[4]);
|
||||
}
|
||||
|
||||
/// [LogEntry] entity fields to define ObjectBox queries.
|
||||
@ -1578,6 +1709,10 @@ class LogEntry_ {
|
||||
/// see [LogEntry.notes]
|
||||
static final notes =
|
||||
QueryStringProperty<LogEntry>(_entities[4].properties[7]);
|
||||
|
||||
/// see [LogEntry.deleted]
|
||||
static final deleted =
|
||||
QueryBooleanProperty<LogEntry>(_entities[4].properties[8]);
|
||||
}
|
||||
|
||||
/// [LogEvent] entity fields to define ObjectBox queries.
|
||||
@ -1612,6 +1747,18 @@ class LogEvent_ {
|
||||
/// see [LogEvent.eventType]
|
||||
static final eventType =
|
||||
QueryRelationToOne<LogEvent, LogEventType>(_entities[5].properties[7]);
|
||||
|
||||
/// see [LogEvent.deleted]
|
||||
static final deleted =
|
||||
QueryBooleanProperty<LogEvent>(_entities[5].properties[8]);
|
||||
|
||||
/// see [LogEvent.bolusProfile]
|
||||
static final bolusProfile =
|
||||
QueryRelationToOne<LogEvent, BolusProfile>(_entities[5].properties[9]);
|
||||
|
||||
/// see [LogEvent.basalProfile]
|
||||
static final basalProfile =
|
||||
QueryRelationToOne<LogEvent, BasalProfile>(_entities[5].properties[10]);
|
||||
}
|
||||
|
||||
/// [LogEventType] entity fields to define ObjectBox queries.
|
||||
@ -1635,6 +1782,18 @@ class LogEventType_ {
|
||||
/// see [LogEventType.notes]
|
||||
static final notes =
|
||||
QueryStringProperty<LogEventType>(_entities[6].properties[4]);
|
||||
|
||||
/// see [LogEventType.deleted]
|
||||
static final deleted =
|
||||
QueryBooleanProperty<LogEventType>(_entities[6].properties[5]);
|
||||
|
||||
/// see [LogEventType.bolusProfile]
|
||||
static final bolusProfile = QueryRelationToOne<LogEventType, BolusProfile>(
|
||||
_entities[6].properties[6]);
|
||||
|
||||
/// see [LogEventType.basalProfile]
|
||||
static final basalProfile = QueryRelationToOne<LogEventType, BasalProfile>(
|
||||
_entities[6].properties[7]);
|
||||
}
|
||||
|
||||
/// [LogMeal] entity fields to define ObjectBox queries.
|
||||
@ -1698,6 +1857,10 @@ class LogMeal_ {
|
||||
/// see [LogMeal.carbsRatioAccuracy]
|
||||
static final carbsRatioAccuracy =
|
||||
QueryRelationToOne<LogMeal, Accuracy>(_entities[7].properties[15]);
|
||||
|
||||
/// see [LogMeal.deleted]
|
||||
static final deleted =
|
||||
QueryBooleanProperty<LogMeal>(_entities[7].properties[16]);
|
||||
}
|
||||
|
||||
/// [Meal] entity fields to define ObjectBox queries.
|
||||
@ -1750,6 +1913,10 @@ class Meal_ {
|
||||
/// see [Meal.carbsRatioAccuracy]
|
||||
static final carbsRatioAccuracy =
|
||||
QueryRelationToOne<Meal, Accuracy>(_entities[8].properties[12]);
|
||||
|
||||
/// see [Meal.deleted]
|
||||
static final deleted =
|
||||
QueryBooleanProperty<Meal>(_entities[8].properties[13]);
|
||||
}
|
||||
|
||||
/// [MealCategory] entity fields to define ObjectBox queries.
|
||||
@ -1765,6 +1932,10 @@ class MealCategory_ {
|
||||
/// see [MealCategory.notes]
|
||||
static final notes =
|
||||
QueryStringProperty<MealCategory>(_entities[9].properties[2]);
|
||||
|
||||
/// see [MealCategory.deleted]
|
||||
static final deleted =
|
||||
QueryBooleanProperty<MealCategory>(_entities[9].properties[3]);
|
||||
}
|
||||
|
||||
/// [MealPortionType] entity fields to define ObjectBox queries.
|
||||
@ -1780,6 +1951,10 @@ class MealPortionType_ {
|
||||
/// see [MealPortionType.notes]
|
||||
static final notes =
|
||||
QueryStringProperty<MealPortionType>(_entities[10].properties[2]);
|
||||
|
||||
/// see [MealPortionType.deleted]
|
||||
static final deleted =
|
||||
QueryBooleanProperty<MealPortionType>(_entities[10].properties[3]);
|
||||
}
|
||||
|
||||
/// [MealSource] entity fields to define ObjectBox queries.
|
||||
@ -1812,6 +1987,10 @@ class MealSource_ {
|
||||
/// see [MealSource.defaultPortionSizeAccuracy]
|
||||
static final defaultPortionSizeAccuracy =
|
||||
QueryRelationToOne<MealSource, Accuracy>(_entities[11].properties[6]);
|
||||
|
||||
/// see [MealSource.deleted]
|
||||
static final deleted =
|
||||
QueryBooleanProperty<MealSource>(_entities[11].properties[7]);
|
||||
}
|
||||
|
||||
/// [LogBolus] entity fields to define ObjectBox queries.
|
||||
@ -1858,6 +2037,10 @@ class LogBolus_ {
|
||||
/// see [LogBolus.meal]
|
||||
static final meal =
|
||||
QueryRelationToOne<LogBolus, LogMeal>(_entities[12].properties[10]);
|
||||
|
||||
/// see [LogBolus.deleted]
|
||||
static final deleted =
|
||||
QueryBooleanProperty<LogBolus>(_entities[12].properties[11]);
|
||||
}
|
||||
|
||||
/// [Accuracy] entity fields to define ObjectBox queries.
|
||||
@ -1884,4 +2067,8 @@ class Accuracy_ {
|
||||
/// see [Accuracy.notes]
|
||||
static final notes =
|
||||
QueryStringProperty<Accuracy>(_entities[13].properties[5]);
|
||||
|
||||
/// see [Accuracy.deleted]
|
||||
static final deleted =
|
||||
QueryBooleanProperty<Accuracy>(_entities[13].properties[6]);
|
||||
}
|
||||
|
@ -19,10 +19,10 @@ class _AccuracyListScreenState extends State<AccuracyListScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
refresh();
|
||||
reload();
|
||||
}
|
||||
|
||||
void refresh({String? message}) {
|
||||
void reload({String? message}) {
|
||||
setState(() {
|
||||
_accuracies = Accuracy.getAll();
|
||||
});
|
||||
@ -42,7 +42,7 @@ class _AccuracyListScreenState extends State<AccuracyListScreen> {
|
||||
|
||||
void onDelete(Accuracy accuracy) {
|
||||
Accuracy.remove(accuracy.id);
|
||||
refresh();
|
||||
reload();
|
||||
}
|
||||
|
||||
void handleDeleteAction(Accuracy accuracy) async {
|
||||
@ -60,13 +60,13 @@ class _AccuracyListScreenState extends State<AccuracyListScreen> {
|
||||
void handleToggleForPortionSizeAction(Accuracy accuracy) async {
|
||||
accuracy.forPortionSize = !accuracy.forPortionSize;
|
||||
Accuracy.put(accuracy);
|
||||
refresh();
|
||||
reload();
|
||||
}
|
||||
|
||||
void handleToggleForCarbsRatioAction(Accuracy accuracy) async {
|
||||
accuracy.forCarbsRatio = !accuracy.forCarbsRatio;
|
||||
Accuracy.put(accuracy);
|
||||
refresh();
|
||||
reload();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -75,7 +75,7 @@ class _AccuracyListScreenState extends State<AccuracyListScreen> {
|
||||
appBar: AppBar(
|
||||
title: const Text('Accuracies'),
|
||||
actions: <Widget>[
|
||||
IconButton(onPressed: refresh, icon: const Icon(Icons.refresh))
|
||||
IconButton(onPressed: reload, icon: const Icon(Icons.refresh))
|
||||
],
|
||||
),
|
||||
drawer: const Navigation(currentLocation: AccuracyListScreen.routeName),
|
||||
@ -96,7 +96,7 @@ class _AccuracyListScreenState extends State<AccuracyListScreen> {
|
||||
builder: (context) =>
|
||||
AccuracyDetailScreen(id: accuracy.id),
|
||||
),
|
||||
).then((message) => refresh(message: message));
|
||||
).then((message) => reload(message: message));
|
||||
},
|
||||
title: Text(accuracy.value),
|
||||
leading: Row(
|
||||
@ -154,7 +154,7 @@ class _AccuracyListScreenState extends State<AccuracyListScreen> {
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const AccuracyDetailScreen(),
|
||||
),
|
||||
).then((message) => refresh(message: message));
|
||||
).then((message) => reload(message: message));
|
||||
},
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
|
@ -108,10 +108,10 @@ class _BasalListScreenState extends State<BasalListScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
return widget.basalRates.isNotEmpty ? SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
widget.basalRates.isNotEmpty ? ListView.builder(
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: widget.basalRates.length,
|
||||
itemBuilder: (context, index) {
|
||||
@ -149,11 +149,11 @@ class _BasalListScreenState extends State<BasalListScreen> {
|
||||
),
|
||||
);
|
||||
},
|
||||
) : const Center(
|
||||
child: Text('You have not created any Basal Rates yet!'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
): const Center(
|
||||
child: Text('You have not created any Basal Rates yet!'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -105,11 +105,11 @@ class _BolusListScreenState extends State<BolusListScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
return widget.bolusRates.isNotEmpty ? SingleChildScrollView(
|
||||
padding: const EdgeInsets.only(top: 10.0),
|
||||
child: Column(
|
||||
children: [
|
||||
widget.bolusRates.isNotEmpty ? ListView.builder(
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: widget.bolusRates.length,
|
||||
itemBuilder: (context, index) {
|
||||
@ -148,11 +148,11 @@ class _BolusListScreenState extends State<BolusListScreen> {
|
||||
),
|
||||
);
|
||||
},
|
||||
) : const Center(
|
||||
child: Text('You have not created any Bolus Rates yet!'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
) : const Center(
|
||||
child: Text('You have not created any Bolus Rates yet!'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -2,26 +2,23 @@ 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/screens/log/log_entry/log_event_detail.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:diameter/navigation.dart';
|
||||
|
||||
class ActiveLogEventListScreen extends StatefulWidget {
|
||||
class ActiveEventListScreen extends StatefulWidget {
|
||||
static const String routeName = '/active-log-events';
|
||||
|
||||
final int endLogEntryId;
|
||||
final Function()? onSetEndTime;
|
||||
|
||||
const ActiveLogEventListScreen(
|
||||
{Key? key, this.endLogEntryId = 0, this.onSetEndTime})
|
||||
: super(key: key);
|
||||
const ActiveEventListScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ActiveLogEventListScreenState createState() =>
|
||||
_ActiveLogEventListScreenState();
|
||||
_ActiveEventListScreenState createState() => _ActiveEventListScreenState();
|
||||
}
|
||||
|
||||
class _ActiveLogEventListScreenState extends State<ActiveLogEventListScreen> {
|
||||
List<LogEvent> _activeLogEvents = [];
|
||||
|
||||
class _ActiveEventListScreenState extends State<ActiveEventListScreen> {
|
||||
List<LogEvent> _activeEvents = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -31,7 +28,7 @@ class _ActiveLogEventListScreenState extends State<ActiveLogEventListScreen> {
|
||||
|
||||
void reload({String? message}) {
|
||||
setState(() {
|
||||
_activeLogEvents = LogEvent.getAllOngoing();
|
||||
_activeEvents = LogEvent.getAllActiveForTime(DateTime.now());
|
||||
});
|
||||
|
||||
setState(() {
|
||||
@ -47,104 +44,35 @@ class _ActiveLogEventListScreenState extends State<ActiveLogEventListScreen> {
|
||||
});
|
||||
}
|
||||
|
||||
void onStop(LogEvent event) async {
|
||||
event.endTime = DateTime.now();
|
||||
event.endLogEntry.target =
|
||||
LogEntry.get(widget.endLogEntryId) ?? LogEntry(time: DateTime.now());
|
||||
LogEvent.put(event);
|
||||
reload();
|
||||
if (widget.onSetEndTime != null) {
|
||||
widget.onSetEndTime!();
|
||||
}
|
||||
}
|
||||
|
||||
void handleStopAction(LogEvent event) async {
|
||||
if (showConfirmationDialogOnStopEvent) {
|
||||
Dialogs.showConfirmationDialog(
|
||||
context: context,
|
||||
onConfirm: () => onStop(event),
|
||||
message: 'Are you sure you want to end this Event?',
|
||||
);
|
||||
} else {
|
||||
onStop(event);
|
||||
}
|
||||
}
|
||||
|
||||
void onDelete(LogEvent event) {
|
||||
LogEvent.remove(event.id);
|
||||
reload(message: 'Event deleted');
|
||||
}
|
||||
|
||||
void handleDeleteAction(LogEvent event) async {
|
||||
if (showConfirmationDialogOnDelete) {
|
||||
Dialogs.showConfirmationDialog(
|
||||
context: context,
|
||||
onConfirm: () => onDelete(event),
|
||||
message: 'Are you sure you want to delete this Event?',
|
||||
);
|
||||
} else {
|
||||
onDelete(event);
|
||||
}
|
||||
void handleAddNewEvent() async {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return const LogEventDetailScreen();
|
||||
},
|
||||
),
|
||||
).then((message) => reload(message: message));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.only(top: 10.0),
|
||||
child: Column(
|
||||
children: [
|
||||
AppBar(
|
||||
title: const Text('Active Events'),
|
||||
primary: false,
|
||||
automaticallyImplyLeading: false,
|
||||
actions: [
|
||||
IconButton(icon: const Icon(Icons.refresh), onPressed: reload),
|
||||
],
|
||||
),
|
||||
_activeLogEvents.isNotEmpty ?
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: _activeLogEvents.length,
|
||||
itemBuilder: (context, index) {
|
||||
final event = _activeLogEvents[index];
|
||||
return ListTile(
|
||||
title: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(event.eventType.target?.value ?? ''),
|
||||
),
|
||||
],
|
||||
),
|
||||
subtitle: Text(
|
||||
'${DateTimeUtils.displayDateTime(event.time)}${event.hasEndTime ? ' - ${DateTimeUtils.displayDateTime(event.endTime)}' : ''}'),
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(
|
||||
Icons.delete,
|
||||
color: Colors.blue,
|
||||
),
|
||||
onPressed: () => handleStopAction(event),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(
|
||||
Icons.delete,
|
||||
color: Colors.blue,
|
||||
),
|
||||
onPressed: () => handleDeleteAction(event),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
) : const Center(
|
||||
child: Text('There are no currently ongoing events!'),
|
||||
),
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Active Events'),
|
||||
actions: <Widget>[
|
||||
IconButton(onPressed: reload, icon: const Icon(Icons.refresh))
|
||||
],
|
||||
),
|
||||
drawer:
|
||||
const Navigation(currentLocation: ActiveEventListScreen.routeName),
|
||||
body: LogEventListScreen(activeEvents: _activeEvents),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: handleAddNewEvent,
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class _LogBolusDetailScreenState extends State<LogBolusDetailScreen> {
|
||||
reload();
|
||||
|
||||
_logEntry = LogEntry.get(widget.logEntryId);
|
||||
_logMeals = _logEntry?.meals ?? [];
|
||||
_logMeals = LogMeal.getAllForEntry(widget.logEntryId);
|
||||
|
||||
if (widget.id != 0) {
|
||||
_unitsController.text = _logBolus!.units.toString();
|
||||
@ -91,9 +91,9 @@ class _LogBolusDetailScreenState extends State<LogBolusDetailScreen> {
|
||||
void onChangeCarbs() {
|
||||
setState(() {
|
||||
if (_rate != null && !_setManually) {
|
||||
_unitsController.text =
|
||||
((double.tryParse(_carbsController.text) ?? 0) / (_rate!.carbs / _rate!.units))
|
||||
.toString();
|
||||
_unitsController.text = ((double.tryParse(_carbsController.text) ?? 0) /
|
||||
(_rate!.carbs / _rate!.units))
|
||||
.toString();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -196,7 +196,6 @@ class _LogBolusDetailScreenState extends State<LogBolusDetailScreen> {
|
||||
selectedItem: _meal,
|
||||
label: 'Meal',
|
||||
items: _logMeals,
|
||||
renderItem: (item) => item.value,
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
onSelectMeal(value);
|
||||
|
@ -23,7 +23,7 @@ class LogBolusListScreen extends StatefulWidget {
|
||||
_LogBolusListScreenState createState() => _LogBolusListScreenState();
|
||||
}
|
||||
|
||||
class _LogBolusListScreenState extends State<LogBolusListScreen> {
|
||||
class _LogBolusListScreenState extends State<LogBolusListScreen> {
|
||||
void reload({String? message}) {
|
||||
widget.reload();
|
||||
|
||||
@ -69,7 +69,7 @@ class _LogBolusListScreenState extends State<LogBolusListScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
void handleEditMealAction(int mealId) {
|
||||
void handleEditMealAction(int mealId) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
@ -86,23 +86,25 @@ class _LogBolusListScreenState extends State<LogBolusListScreen> {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: widget.logEntry.boli.isNotEmpty
|
||||
child: widget.logBoli.isNotEmpty
|
||||
? ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: widget.logEntry.boli.length,
|
||||
itemCount: widget.logBoli.length,
|
||||
itemBuilder: (context, index) {
|
||||
final bolus = widget.logEntry.boli[index];
|
||||
final bolus = widget.logBoli[index];
|
||||
return ListTile(
|
||||
onTap: () => handleEditAction(bolus),
|
||||
title:
|
||||
Text(
|
||||
title: Text(
|
||||
'${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'}'),
|
||||
trailing: Row(
|
||||
children: [
|
||||
bolus.meal.target != null ? IconButton(
|
||||
icon: const Icon(Icons.restaurant),
|
||||
onPressed: () => handleEditMealAction(bolus.meal.targetId),
|
||||
) : Container(),
|
||||
bolus.meal.target != null
|
||||
? IconButton(
|
||||
icon: const Icon(Icons.restaurant),
|
||||
onPressed: () =>
|
||||
handleEditMealAction(bolus.meal.targetId),
|
||||
)
|
||||
: Container(),
|
||||
const SizedBox(width: 24),
|
||||
IconButton(
|
||||
icon: const Icon(
|
||||
|
@ -32,6 +32,7 @@ class _LogEntryScreenState extends State<LogEntryScreen> {
|
||||
LogEntry? _logEntry;
|
||||
List<LogMeal> _logMeals = [];
|
||||
List<LogEvent> _logEvents = [];
|
||||
List<LogEvent> _activeEvents = [];
|
||||
List<LogBolus> _logBoli = [];
|
||||
bool _isNew = true;
|
||||
bool _isSaving = false;
|
||||
@ -119,9 +120,10 @@ class _LogEntryScreenState extends State<LogEntryScreen> {
|
||||
if (widget.id != 0) {
|
||||
setState(() {
|
||||
_logEntry = LogEntry.get(widget.id);
|
||||
_logMeals = _logEntry?.meals ?? [];
|
||||
_logEvents = _logEntry?.events ?? [];
|
||||
_logBoli = _logEntry?.boli ?? [];
|
||||
_logMeals = LogMeal.getAllForEntry(widget.id);
|
||||
_logEvents = LogEvent.getAllForEntry(widget.id);
|
||||
_activeEvents = LogEvent.getAllActiveForTime(_logEntry?.time).where((event) => !_logEvents.any((logEvent) => logEvent.id == event.id)).toList();
|
||||
_logBoli = LogBolus.getAllForEntry(widget.id);
|
||||
});
|
||||
_isNew = _logEntry == null;
|
||||
}
|
||||
@ -490,7 +492,10 @@ class _LogEntryScreenState extends State<LogEntryScreen> {
|
||||
tabs.add(LogBolusListScreen(
|
||||
logEntry: _logEntry!, logBoli: _logBoli, reload: reload));
|
||||
tabs.add(LogEventListScreen(
|
||||
logEntry: _logEntry!, logEvents: _logEvents, reload: reload));
|
||||
logEntry: _logEntry!,
|
||||
logEvents: _logEvents,
|
||||
activeEvents: _activeEvents,
|
||||
reload: reload));
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
|
@ -3,6 +3,8 @@ import 'package:diameter/components/dialogs.dart';
|
||||
import 'package:diameter/components/dropdown.dart';
|
||||
import 'package:diameter/components/forms.dart';
|
||||
import 'package:diameter/config.dart';
|
||||
import 'package:diameter/models/basal_profile.dart';
|
||||
import 'package:diameter/models/bolus_profile.dart';
|
||||
import 'package:diameter/models/log_entry.dart';
|
||||
import 'package:diameter/models/log_event.dart';
|
||||
import 'package:diameter/models/log_event_type.dart';
|
||||
@ -29,23 +31,37 @@ class _LogEventDetailScreenState extends State<LogEventDetailScreen> {
|
||||
bool _isNew = true;
|
||||
bool _isSaving = false;
|
||||
|
||||
List<BolusProfile> _bolusProfiles = [];
|
||||
List<BasalProfile> _basalProfiles = [];
|
||||
|
||||
final GlobalKey<FormState> _logEventForm = GlobalKey<FormState>();
|
||||
|
||||
final _reminderDurationController = TextEditingController(text: '');
|
||||
final _notesController = TextEditingController(text: '');
|
||||
LogEventType? _eventType;
|
||||
bool _hasEndTime = false;
|
||||
final _notesController = TextEditingController(text: '');
|
||||
BolusProfile? _bolusProfile;
|
||||
BasalProfile? _basalProfile;
|
||||
|
||||
List<LogEventType> _logEventTypes = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
reload();
|
||||
|
||||
_bolusProfiles = BolusProfile.getAll();
|
||||
_basalProfiles = BasalProfile.getAll();
|
||||
|
||||
if (_logEvent != null) {
|
||||
_reminderDurationController.text =
|
||||
(_logEvent!.reminderDuration ?? '').toString();
|
||||
_hasEndTime = _logEvent!.hasEndTime;
|
||||
_notesController.text = _logEvent!.notes ?? '';
|
||||
_eventType = _logEvent!.eventType.target;
|
||||
_hasEndTime = _logEvent!.hasEndTime;
|
||||
_basalProfile = _logEvent!.basalProfile.target;
|
||||
_bolusProfile = _logEvent!.bolusProfile.target;
|
||||
}
|
||||
|
||||
_logEventTypes = LogEventType.getAll();
|
||||
@ -60,6 +76,23 @@ class _LogEventDetailScreenState extends State<LogEventDetailScreen> {
|
||||
_isNew = _logEvent == null;
|
||||
}
|
||||
|
||||
void onSelectEventType(LogEventType eventType) {
|
||||
setState(() {
|
||||
_eventType = eventType;
|
||||
_hasEndTime = eventType.hasEndTime;
|
||||
if (eventType.basalProfile.target != null) {
|
||||
_basalProfile = eventType.basalProfile.target;
|
||||
}
|
||||
if (eventType.bolusProfile.target != null) {
|
||||
_bolusProfile = eventType.bolusProfile.target;
|
||||
}
|
||||
if (eventType.defaultReminderDuration != null) {
|
||||
_reminderDurationController.text =
|
||||
eventType.defaultReminderDuration.toString();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void handleSaveAction() async {
|
||||
setState(() {
|
||||
_isSaving = true;
|
||||
@ -67,12 +100,19 @@ class _LogEventDetailScreenState extends State<LogEventDetailScreen> {
|
||||
if (_logEventForm.currentState!.validate()) {
|
||||
LogEvent event = LogEvent(
|
||||
id: widget.id,
|
||||
time: LogEntry.get(widget.logEntryId)!.time,
|
||||
time: LogEntry.get(widget.logEntryId)?.time ?? DateTime.now(),
|
||||
hasEndTime: _hasEndTime,
|
||||
reminderDuration: int.tryParse(_reminderDurationController.text),
|
||||
notes: _notesController.text,
|
||||
);
|
||||
event.logEntry.targetId = widget.logEntryId;
|
||||
if (widget.logEntryId != 0) {
|
||||
event.logEntry.targetId = widget.logEntryId;
|
||||
} else {
|
||||
event.logEntry.target = LogEntry(time: DateTime.now());
|
||||
}
|
||||
event.eventType.target = _eventType;
|
||||
event.basalProfile.target = _basalProfile;
|
||||
event.bolusProfile.target = _bolusProfile;
|
||||
LogEvent.put(event);
|
||||
Navigator.pop(context, '${_isNew ? 'New' : ''} Event Saved');
|
||||
}
|
||||
@ -119,11 +159,10 @@ class _LogEventDetailScreenState extends State<LogEventDetailScreen> {
|
||||
selectedItem: _eventType,
|
||||
label: 'Event Type',
|
||||
items: _logEventTypes,
|
||||
renderItem: (item) => item.value,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_eventType = value;
|
||||
});
|
||||
if (value != null) {
|
||||
onSelectEventType(value);
|
||||
}
|
||||
},
|
||||
),
|
||||
BooleanFormField(
|
||||
@ -135,6 +174,38 @@ class _LogEventDetailScreenState extends State<LogEventDetailScreen> {
|
||||
},
|
||||
label: 'has end time',
|
||||
),
|
||||
Column(
|
||||
children: _hasEndTime ? [
|
||||
TextFormField(
|
||||
controller: _reminderDurationController,
|
||||
keyboardType: const TextInputType.numberWithOptions(),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Default Reminder Duration',
|
||||
suffixText: ' min',
|
||||
enabled: _hasEndTime,
|
||||
),
|
||||
),
|
||||
AutoCompleteDropdownButton<BolusProfile>(
|
||||
selectedItem: _bolusProfile,
|
||||
label: 'Bolus Profile',
|
||||
items: _bolusProfiles,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_bolusProfile = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
AutoCompleteDropdownButton<BasalProfile>(
|
||||
selectedItem: _basalProfile,
|
||||
label: 'Basal Profile',
|
||||
items: _basalProfiles,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_basalProfile = value;
|
||||
});
|
||||
},
|
||||
)
|
||||
] : []),
|
||||
TextFormField(
|
||||
controller: _notesController,
|
||||
decoration: const InputDecoration(
|
||||
|
@ -7,12 +7,13 @@ import 'package:diameter/utils/date_time_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LogEventListScreen extends StatefulWidget {
|
||||
final LogEntry logEntry;
|
||||
final LogEntry? logEntry;
|
||||
final List<LogEvent> logEvents;
|
||||
final Function() reload;
|
||||
final List<LogEvent> activeEvents;
|
||||
final Function()? reload;
|
||||
|
||||
const LogEventListScreen(
|
||||
{Key? key, required this.logEntry, this.logEvents = const [], required this.reload})
|
||||
{Key? key, this.logEntry, this.logEvents = const [], this.activeEvents = const [], this.reload})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
@ -21,7 +22,9 @@ class LogEventListScreen extends StatefulWidget {
|
||||
|
||||
class _LogEventListScreenState extends State<LogEventListScreen> {
|
||||
void reload({String? message}) {
|
||||
widget.reload();
|
||||
if (widget.reload != null) {
|
||||
widget.reload!();
|
||||
}
|
||||
|
||||
setState(() {
|
||||
if (message != null) {
|
||||
@ -41,7 +44,7 @@ class _LogEventListScreenState extends State<LogEventListScreen> {
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => LogEventDetailScreen(
|
||||
logEntryId: widget.logEntry.id,
|
||||
logEntryId: widget.logEntry?.id ?? 0,
|
||||
id: event.id,
|
||||
),
|
||||
),
|
||||
@ -65,21 +68,42 @@ class _LogEventListScreenState extends State<LogEventListScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
void onStop(LogEvent event) async {
|
||||
event.endTime = DateTime.now();
|
||||
event.endLogEntry.target =
|
||||
LogEntry.get(widget.logEntry?.id ?? 0) ?? LogEntry(time: DateTime.now());
|
||||
LogEvent.put(event);
|
||||
reload(message: 'Event ended');
|
||||
}
|
||||
|
||||
void handleStopAction(LogEvent event) async {
|
||||
if (showConfirmationDialogOnStopEvent) {
|
||||
Dialogs.showConfirmationDialog(
|
||||
context: context,
|
||||
onConfirm: () => onStop(event),
|
||||
message: 'Are you sure you want to end this Event?',
|
||||
confirmationLabel: 'END EVENT',
|
||||
);
|
||||
} else {
|
||||
onStop(event);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: (widget.logEntry.events.isNotEmpty ||
|
||||
widget.logEntry.endedEvents.isNotEmpty)
|
||||
child: (widget.logEvents.isNotEmpty ||
|
||||
widget.activeEvents.isNotEmpty)
|
||||
? ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: widget.logEntry.events.length +
|
||||
widget.logEntry.endedEvents.length,
|
||||
itemCount: widget.logEvents.length +
|
||||
widget.activeEvents.length,
|
||||
itemBuilder: (context, index) {
|
||||
final event = (widget.logEntry.events +
|
||||
widget.logEntry.endedEvents)[index];
|
||||
final event = (widget.logEvents +
|
||||
widget.activeEvents)[index];
|
||||
return ListTile(
|
||||
onTap: () {
|
||||
handleEditAction(event);
|
||||
@ -96,6 +120,14 @@ class _LogEventListScreenState extends State<LogEventListScreen> {
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
event.hasEndTime && event.endTime == null ? IconButton(
|
||||
icon: const Icon(
|
||||
Icons.stop,
|
||||
color: Colors.blue,
|
||||
),
|
||||
onPressed: () => handleStopAction(event),
|
||||
) : Container(),
|
||||
const SizedBox(width: 24),
|
||||
IconButton(
|
||||
icon: const Icon(
|
||||
Icons.delete,
|
||||
@ -107,9 +139,9 @@ class _LogEventListScreenState extends State<LogEventListScreen> {
|
||||
),
|
||||
);
|
||||
})
|
||||
: const Center(
|
||||
child: Text(
|
||||
'You have not added any Events to this Log Entry yet!'),
|
||||
: Center(
|
||||
child: Text(widget.logEntry == null ? 'There are no active Events!'
|
||||
: 'You have not added any Events to this Log Entry yet!'),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -286,7 +286,6 @@ class _LogMealDetailScreenState extends State<LogMealDetailScreen> {
|
||||
selectedItem: _meal,
|
||||
label: 'Meal',
|
||||
items: _meals,
|
||||
renderItem: (item) => item.value,
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
onSelectMeal(value);
|
||||
@ -297,7 +296,6 @@ class _LogMealDetailScreenState extends State<LogMealDetailScreen> {
|
||||
selectedItem: _mealSource,
|
||||
label: 'Meal Source',
|
||||
items: _mealSources,
|
||||
renderItem: (item) => item.value,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_mealSource = value;
|
||||
@ -308,7 +306,6 @@ class _LogMealDetailScreenState extends State<LogMealDetailScreen> {
|
||||
selectedItem: _mealCategory,
|
||||
label: 'Meal Category',
|
||||
items: _mealCategories,
|
||||
renderItem: (item) => item.value,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_mealCategory = value;
|
||||
@ -319,7 +316,6 @@ class _LogMealDetailScreenState extends State<LogMealDetailScreen> {
|
||||
selectedItem: _mealPortionType,
|
||||
label: 'Meal Portion Type',
|
||||
items: _mealPortionTypes,
|
||||
renderItem: (item) => item.value,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_mealPortionType = value;
|
||||
@ -386,8 +382,6 @@ class _LogMealDetailScreenState extends State<LogMealDetailScreen> {
|
||||
selectedItem: _portionSizeAccuracy,
|
||||
label: 'Portion Size Accuracy',
|
||||
items: _portionSizeAccuracies,
|
||||
// getItemValue: (item) => item.objectId,
|
||||
renderItem: (item) => item.value,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_portionSizeAccuracy = value;
|
||||
@ -428,7 +422,6 @@ class _LogMealDetailScreenState extends State<LogMealDetailScreen> {
|
||||
selectedItem: _carbsRatioAccuracy,
|
||||
label: 'Carbs Ratio Accuracy',
|
||||
items: _carbsRatioAccuracies,
|
||||
renderItem: (item) => item.value,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_carbsRatioAccuracy = value;
|
||||
|
@ -69,12 +69,12 @@ class _LogMealListScreenState extends State<LogMealListScreen> {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: widget.logEntry.meals.isNotEmpty
|
||||
child: widget.logMeals.isNotEmpty
|
||||
? ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: widget.logEntry.meals.length,
|
||||
itemCount: widget.logMeals.length,
|
||||
itemBuilder: (context, index) {
|
||||
final meal = widget.logEntry.meals[index];
|
||||
final meal = widget.logMeals[index];
|
||||
return ListTile(
|
||||
onTap: () => handleEditAction(meal),
|
||||
title: Row(
|
||||
|
@ -1,7 +1,10 @@
|
||||
import 'package:diameter/components/detail.dart';
|
||||
import 'package:diameter/components/dialogs.dart';
|
||||
import 'package:diameter/components/dropdown.dart';
|
||||
import 'package:diameter/components/forms.dart';
|
||||
import 'package:diameter/config.dart';
|
||||
import 'package:diameter/models/basal_profile.dart';
|
||||
import 'package:diameter/models/bolus_profile.dart';
|
||||
import 'package:diameter/models/log_event_type.dart';
|
||||
import 'package:diameter/navigation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -21,12 +24,17 @@ class _LogEventTypeDetailScreenState extends State<LogEventTypeDetailScreen> {
|
||||
bool _isNew = true;
|
||||
bool _isSaving = false;
|
||||
|
||||
List<BolusProfile> _bolusProfiles = [];
|
||||
List<BasalProfile> _basalProfiles = [];
|
||||
|
||||
final GlobalKey<FormState> _logEventTypeForm = GlobalKey<FormState>();
|
||||
|
||||
final _valueController = TextEditingController(text: '');
|
||||
final _defaultReminderDurationController = TextEditingController(text: '');
|
||||
final _notesController = TextEditingController(text: '');
|
||||
bool _hasEndTime = false;
|
||||
BolusProfile? _bolusProfile;
|
||||
BasalProfile? _basalProfile;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -34,12 +42,17 @@ class _LogEventTypeDetailScreenState extends State<LogEventTypeDetailScreen> {
|
||||
|
||||
reload();
|
||||
|
||||
_bolusProfiles = BolusProfile.getAll();
|
||||
_basalProfiles = BasalProfile.getAll();
|
||||
|
||||
if (_logEventType != null) {
|
||||
_valueController.text = _logEventType!.value;
|
||||
_defaultReminderDurationController.text =
|
||||
(_logEventType!.defaultReminderDuration ?? '').toString();
|
||||
_notesController.text = _logEventType!.notes ?? '';
|
||||
_hasEndTime = _logEventType!.hasEndTime;
|
||||
_notesController.text = _logEventType!.notes ?? '';
|
||||
_basalProfile = _logEventType!.basalProfile.target;
|
||||
_bolusProfile = _logEventType!.bolusProfile.target;
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,16 +70,18 @@ class _LogEventTypeDetailScreenState extends State<LogEventTypeDetailScreen> {
|
||||
_isSaving = true;
|
||||
});
|
||||
if (_logEventTypeForm.currentState!.validate()) {
|
||||
bool isNew = _logEventType == null;
|
||||
LogEventType.put(LogEventType(
|
||||
LogEventType eventType = LogEventType(
|
||||
id: widget.id,
|
||||
value: _valueController.text,
|
||||
notes: _notesController.text,
|
||||
defaultReminderDuration:
|
||||
int.tryParse(_defaultReminderDurationController.text),
|
||||
hasEndTime: _hasEndTime,
|
||||
));
|
||||
Navigator.pop(context, '${isNew ? 'New' : ''} Log Event Type Saved');
|
||||
);
|
||||
eventType.basalProfile.target = _basalProfile;
|
||||
eventType.bolusProfile.target = _bolusProfile;
|
||||
LogEventType.put(eventType);
|
||||
Navigator.pop(context, '${_isNew ? 'New' : ''} Log Event Type Saved');
|
||||
}
|
||||
setState(() {
|
||||
_isSaving = false;
|
||||
@ -135,15 +150,38 @@ class _LogEventTypeDetailScreenState extends State<LogEventTypeDetailScreen> {
|
||||
});
|
||||
},
|
||||
),
|
||||
TextFormField(
|
||||
controller: _defaultReminderDurationController,
|
||||
keyboardType: const TextInputType.numberWithOptions(),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Default Reminder Duration',
|
||||
suffixText: ' min',
|
||||
enabled: _hasEndTime,
|
||||
),
|
||||
Column(
|
||||
children: _hasEndTime ? [
|
||||
TextFormField(
|
||||
controller: _defaultReminderDurationController,
|
||||
keyboardType: const TextInputType.numberWithOptions(),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Default Reminder Duration',
|
||||
suffixText: ' min',
|
||||
enabled: _hasEndTime,
|
||||
),
|
||||
),
|
||||
AutoCompleteDropdownButton<BolusProfile>(
|
||||
selectedItem: _bolusProfile,
|
||||
label: 'Bolus Profile',
|
||||
items: _bolusProfiles,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_bolusProfile = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
AutoCompleteDropdownButton<BasalProfile>(
|
||||
selectedItem: _basalProfile,
|
||||
label: 'Basal Profile',
|
||||
items: _basalProfiles,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_basalProfile = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
] : []),
|
||||
TextFormField(
|
||||
controller: _notesController,
|
||||
decoration: const InputDecoration(
|
||||
@ -152,7 +190,7 @@ class _LogEventTypeDetailScreenState extends State<LogEventTypeDetailScreen> {
|
||||
),
|
||||
keyboardType: TextInputType.multiline,
|
||||
),
|
||||
],
|
||||
]
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -255,7 +255,6 @@ class _MealDetailScreenState extends State<MealDetailScreen> {
|
||||
selectedItem: _mealSource,
|
||||
label: 'Meal Source',
|
||||
items: _mealSources,
|
||||
renderItem: (item) => item.value,
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
onSelectMealSource(value);
|
||||
@ -266,7 +265,6 @@ class _MealDetailScreenState extends State<MealDetailScreen> {
|
||||
selectedItem: _mealCategory,
|
||||
label: 'Meal Category',
|
||||
items: _mealCategories,
|
||||
renderItem: (item) => item.value,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_mealCategory = value;
|
||||
@ -277,7 +275,6 @@ class _MealDetailScreenState extends State<MealDetailScreen> {
|
||||
selectedItem: _mealPortionType,
|
||||
label: 'Meal Portion Type',
|
||||
items: _mealPortionTypes,
|
||||
renderItem: (item) => item.value,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_mealPortionType = value;
|
||||
@ -344,7 +341,6 @@ class _MealDetailScreenState extends State<MealDetailScreen> {
|
||||
selectedItem: _portionSizeAccuracy,
|
||||
label: 'Portion Size Accuracy',
|
||||
items: _portionSizeAccuracies,
|
||||
renderItem: (item) => item.value,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_portionSizeAccuracy = value;
|
||||
@ -385,7 +381,6 @@ class _MealDetailScreenState extends State<MealDetailScreen> {
|
||||
selectedItem: _carbsRatioAccuracy,
|
||||
label: 'Carbs Ratio Accuracy',
|
||||
items: _carbsRatioAccuracies,
|
||||
renderItem: (item) => item.value,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_carbsRatioAccuracy = value;
|
||||
|
@ -151,7 +151,6 @@ class _MealSourceDetailScreenState extends State<MealSourceDetailScreen> {
|
||||
selectedItem: _defaultCarbsRatioAccuracy,
|
||||
label: 'Default Carbs Ratio Accuracy',
|
||||
items: _carbsRatioAccuracies,
|
||||
renderItem: (item) => item.value,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_defaultCarbsRatioAccuracy = value;
|
||||
@ -162,7 +161,6 @@ class _MealSourceDetailScreenState extends State<MealSourceDetailScreen> {
|
||||
selectedItem: _defaultPortionSizeAccuracy,
|
||||
label: 'Default Portion Size Accuracy',
|
||||
items: _portionSizeAccuracies,
|
||||
renderItem: (item) => item.value,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_defaultPortionSizeAccuracy = value;
|
||||
@ -173,7 +171,6 @@ class _MealSourceDetailScreenState extends State<MealSourceDetailScreen> {
|
||||
selectedItem: _defaultMealCategory,
|
||||
label: 'Default Meal Category',
|
||||
items: _mealCategories,
|
||||
renderItem: (item) => item.value,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_defaultMealCategory = value;
|
||||
@ -184,7 +181,6 @@ class _MealSourceDetailScreenState extends State<MealSourceDetailScreen> {
|
||||
selectedItem: _defaultMealPortionType,
|
||||
label: 'Default Meal Portion Type',
|
||||
items: _mealPortionTypes,
|
||||
renderItem: (item) => item.value,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_defaultMealPortionType = value;
|
||||
|
@ -135,7 +135,6 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
selectedItem: nutritionMeasurement,
|
||||
label: 'Preferred Nutrition Measurement',
|
||||
items: NutritionMeasurement.values,
|
||||
renderItem: (item) => item.toString().split('.')[1],
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
Settings.setNutritionMeasurement(value);
|
||||
@ -149,7 +148,6 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
selectedItem: glucoseMeasurement,
|
||||
label: 'Preferred Glucose Measurement',
|
||||
items: GlucoseMeasurement.values,
|
||||
renderItem: (item) => item.toString().split('.')[1],
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
Settings.setGlucoseMeasurement(value);
|
||||
|
Loading…
Reference in New Issue
Block a user