feat:更新历史记录模块

This commit is contained in:
2025-12-02 20:00:34 +08:00
parent 62108248aa
commit b3bb3378c3
6 changed files with 50 additions and 66 deletions

View File

@@ -1,11 +1,10 @@
import 'package:fitnote/models/health.dart';
import 'package:flutter/material.dart';
import 'package:flutter_common/flutter_common.dart';
class HealthProvider with ChangeNotifier {
late HealthRecord formItem;
HealthRecord formItem = HealthRecord.getEmpty(DateTime.now());
HealthRecord currentRecord = HealthRecord.getEmpty(DateTime.now());
DateTime selectedDate = DateTime.now();
DateTime focusedDate = DateTime.now();
RecordType type = RecordType.weight;
bool isEditing = false;
@@ -18,6 +17,16 @@ class HealthProvider with ChangeNotifier {
notifyListeners();
}
void updateRecord(HealthRecord record) {
currentRecord = record;
notifyListeners();
}
void updateSelectDate(DateTime date) {
selectedDate = date;
notifyListeners();
}
void updateWeight(num weight) {
formItem.weight = weight;
notifyListeners();