import 'package:fitnote/widget/record/goal_progress.dart'; import 'package:fitnote/widget/record/record_daily.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 createState() => _RecordPageState(); } class _RecordPageState extends State { // 格式化当前日期 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), RecordDaily()], ), ); } // 顶部导航栏 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, ), ), ), ), ], ), ], ), ); } }