This commit is contained in:
wyf
2025-05-20 14:00:44 +08:00
parent 75ddfca402
commit 0a8cffa4c6
48 changed files with 5221 additions and 1733 deletions

View File

@@ -6,12 +6,14 @@ class SleepdateWidget extends StatelessWidget {
final DateTime date;
final bool isSelected;
final VoidCallback onTap;
final Color highlightColor; // 新增
const SleepdateWidget({
super.key,
super.key,
required this.date,
required this.isSelected,
required this.onTap,
this.highlightColor = Colors.black, // 默认值黑色
});
@override
@@ -25,8 +27,8 @@ class SleepdateWidget extends StatelessWidget {
width: 90.rpx,
height: 90.rpx,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30.rpx),
color: isSelected ? Colors.black : Colors.transparent,
borderRadius: BorderRadius.circular(30.rpx),
color: isSelected ? highlightColor : Colors.transparent, // 使用传入的颜色
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(10.rpx, 10.rpx, 10.rpx, 10.rpx),
@@ -35,15 +37,13 @@ class SleepdateWidget extends StatelessWidget {
color: Color(0xFFDC1C1C),
shape: BoxShape.circle,
),
child: Align(
alignment: AlignmentDirectional(0, 0),
child: Text(
'${date.day}',
style: TextStyle(
color: Colors.white,
fontSize: 26.rpx,
letterSpacing: 0.0,
),
alignment: Alignment.center,
child: Text(
'${date.day}',
style: TextStyle(
color: Colors.white,
fontSize: 26.rpx,
letterSpacing: 0.0,
),
),
),