Files
tuiche/lib/component/base/SleepdateWidget.dart
2025-06-24 17:14:46 +08:00

56 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
class SleepdateWidget extends StatelessWidget {
final DateTime date;
final bool isSelected;
final VoidCallback onTap;
final Color highlightColor; // 新增
const SleepdateWidget({
super.key,
required this.date,
required this.isSelected,
required this.onTap,
this.highlightColor = Colors.black, // 默认值黑色
});
@override
Widget build(BuildContext context) {
return ClickableContainer(
onTap: onTap,
backgroundColor: Colors.transparent,
highlightColor: Colors.transparent,
padding: EdgeInsets.all(4.rpx),
child: Container(
width: 90.rpx,
height: 90.rpx,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30.rpx),
color: isSelected ? highlightColor : Colors.transparent, // 使用传入的颜色
),
child: Padding(
padding:
EdgeInsetsDirectional.fromSTEB(10.rpx, 10.rpx, 10.rpx, 10.rpx),
child: Container(
decoration: BoxDecoration(
color: Color(0xFF757575),
shape: BoxShape.circle,
),
alignment: Alignment.center,
child: Text(
'${date.day}',
style: TextStyle(
color: Colors.white,
fontSize: 26.rpx,
letterSpacing: 0.0,
),
),
),
),
),
);
}
}