cpd_2022_zi/lib/models/sleep.dart

30 lines
765 B
Dart

import 'package:flutter/material.dart';
import 'package:smoke_cess_app/interface/db_record.dart';
class Sleep implements DatabaseRecord {
final double _sleepQualityValue;
final String _comment;
final DateTime _date;
final TimeOfDay _sleepedAt;
final TimeOfDay _wokeUpAt;
Sleep(this._sleepQualityValue, this._comment, this._date, this._sleepedAt,
this._wokeUpAt);
@override
String toCSV() {
return "${_date.toIso8601String()}, ${_sleepQualityValue.round().toString()}, $_sleepedAt, $_wokeUpAt, $_comment";
}
@override
Map<String, dynamic> toMap() {
return {
'sleepQualityValue': _sleepQualityValue,
'comment': _comment,
'date': _date,
'sleepedAt': _sleepedAt,
'wokeUpAt': _wokeUpAt,
};
}
}