feat:增加记录对话框内容

This commit is contained in:
2025-12-01 19:59:25 +08:00
parent 49502295e3
commit eb14cf1957
28 changed files with 1596 additions and 620 deletions

View File

@@ -1,7 +1,9 @@
import 'package:flutter/cupertino.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:json_annotation/json_annotation.dart';
@JsonSerializable()
class Health {
class HealthRecord {
@JsonKey(name: 'id')
int? id;
@@ -9,10 +11,10 @@ class Health {
String? sportProject;
@JsonKey(name: 'sportDuration')
int? sportDuration;
num? sportDuration;
@JsonKey(name: 'weight')
int? weight;
num? weight;
@JsonKey(name: 'sleepStartTime')
String? sleepStartTime;
@@ -21,12 +23,12 @@ class Health {
String? sleepEndTime;
@JsonKey(name: 'sleepDuration')
int? sleepDuration;
num? sleepDuration;
@JsonKey(name: 'date')
String date;
Health({
HealthRecord({
this.id,
this.sportProject,
this.sportDuration,
@@ -34,10 +36,22 @@ class Health {
this.sleepStartTime,
this.sleepEndTime,
this.sleepDuration,
required this.date
required this.date,
});
// factory Health.fromJson(Map<String, dynamic> json) => _$HealthFromJson(json);
//
// Map<String, dynamic> toJson() => _$HealthToJson(this);
}
}
enum RecordType {
weight('体重', FontAwesomeIcons.weightScale, Color(0xFFF59E0B)),
sport('运动', FontAwesomeIcons.personRunning, Color(0xFF38BDF8)),
sleep('睡眠', FontAwesomeIcons.moon, Color(0xFF10B981));
final String title;
final IconData icon;
final Color color;
const RecordType(this.title, this.icon, this.color);
}

27
lib/modesl/menu.dart Normal file
View File

@@ -0,0 +1,27 @@
import 'package:fitnote/pages/history_page.dart';
import 'package:fitnote/pages/record_page.dart';
import 'package:fitnote/pages/setting_page.dart';
import 'package:fitnote/pages/stats_page.dart';
import 'package:flutter/material.dart';
class PageInfo {
final String title;
final IconData icon;
final Widget page;
const PageInfo({required this.title, required this.icon, required this.page});
}
final List<PageInfo> pages = [
PageInfo(title: '记录', icon: Icons.article, page: RecordPage()),
PageInfo(title: '历史', icon: Icons.history, page: HistoryPage()),
PageInfo(title: '统计', icon: Icons.insert_chart, page: StatsPage()),
PageInfo(title: '设置', icon: Icons.settings, page: SettingPage()),
];
final List<Widget> pageWidgets = pages.map((item) => item.page).toList();
final List<BottomNavigationBarItem> bottomNavItems =
pages.map((page) {
return BottomNavigationBarItem(icon: Icon(page.icon), label: page.title);
}).toList();