import 'package:diameter/main.dart'; import 'package:objectbox/objectbox.dart'; enum GlucoseDisplayMode { activeOnly, bothForList, bothForDetail, both } List glucoseDisplayModeLabels = [ 'activeOnly', 'bothForList', 'bothForDetail', 'both', ]; enum GlucoseMeasurement { mgPerDl, mmolPerL, } List glucoseMeasurementSuffixes = [ 'mg/dl', 'mmol/l', ]; List glucoseMeasurementLabels = [ 'mgPerDl', 'mmolPerL', ]; enum NutritionMeasurement { grams, ounces, lbs, } List nutritionMeasurementSuffixes = [ 'g', 'oz', 'lbs', ]; List nutritionMeasurementLabels = [ 'grams', 'ounces', 'lbs', ]; @Entity(uid: 3989341091218179227) class Settings { static final Box box = objectBox.store.box(); // properties int id; NutritionMeasurement nutritionMeasurement; GlucoseDisplayMode glucoseDisplayMode; GlucoseMeasurement glucoseMeasurement; String dateFormat; String? longDateFormat; String timeFormat; String? longTimeFormat; bool showConfirmationDialogOnCancel; bool showConfirmationDialogOnDelete; bool showConfirmationDialogOnStopEvent; int lowGlucoseMgPerDl; int moderateGlucoseMgPerDl; int highGlucoseMgPerDl; double lowGlucoseMmolPerL; double moderateGlucoseMmolPerL; double highGlucoseMmolPerDl; // constructor Settings({ this.id = 0, this.nutritionMeasurement = NutritionMeasurement.grams, this.glucoseDisplayMode = GlucoseDisplayMode.bothForList, this.glucoseMeasurement = GlucoseMeasurement.mgPerDl, this.dateFormat = 'MM/dd/yy', this.longDateFormat = 'MMMM dd, yyyy', this.timeFormat = 'HH:mm', this.longTimeFormat = 'HH:mm:ss', this.showConfirmationDialogOnCancel = true, this.showConfirmationDialogOnDelete = true, this.showConfirmationDialogOnStopEvent = true, this.lowGlucoseMgPerDl = 80, this.moderateGlucoseMgPerDl = 140, this.highGlucoseMgPerDl = 240, this.lowGlucoseMmolPerL = 4.44, this.moderateGlucoseMmolPerL = 7.77, this.highGlucoseMmolPerDl = 13.32, }); // methods static Settings get() => box.getAll().single; static void put(Settings settings) => box.put(settings); static void reset() { box.removeAll(); box.put(Settings()); } }