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

111
lib/pages/record_page.dart Normal file
View File

@@ -0,0 +1,111 @@
import 'package:fitnote/widget/record/goal_progress.dart';
import 'package:fitnote/widget/record/today_record.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:intl/intl.dart';
class RecordPage extends StatefulWidget {
const RecordPage({super.key});
@override
State<RecordPage> createState() => _RecordPageState();
}
class _RecordPageState extends State<RecordPage> {
// 格式化当前日期
String _formatCurrentDate() {
final now = DateTime.now();
// 格式2025年11月28日周五
return "${DateFormat('yyyy年MM月dd日').format(now)}${_getWeekday(now.weekday)}";
}
// 数字星期转中文
String _getWeekday(int weekday) {
const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
return weekdays[weekday - 1];
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
children: [GoalProgress(), const SizedBox(height: 24), TodayRecord()],
),
);
}
// 顶部导航栏
Widget _buildHeader() {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
color: Colors.white,
// boxShadow: const [
// BoxShadow(
// color: Color(0x0A000000),
// blurRadius: 4,
// offset: Offset(0, 2),
// ),
// ],
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'早上好,用户',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Color(0xFF1E293B),
),
),
const SizedBox(height: 4),
Text(
'今天是 ${_formatCurrentDate()}',
style: const TextStyle(fontSize: 12, color: Color(0xFF64748B)),
),
],
),
Row(
children: [
// 通知按钮
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: const Color(0xFFF1F5F9),
borderRadius: BorderRadius.circular(20),
),
child: Icon(
FontAwesomeIcons.bell,
color: const Color(0xFF64748B),
size: 18,
),
),
// 用户头像
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: const Color(0xFFE0F2FE), // 主色浅背景
borderRadius: BorderRadius.circular(20),
),
child: const Center(
child: Text(
'U',
style: TextStyle(
color: Color(0xFF38BDF8),
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
),
),
],
),
],
),
);
}
}