更新日历样式

This commit is contained in:
czz
2025-07-10 11:16:26 +08:00
parent ceb228b256
commit 30027f40c2
10 changed files with 502 additions and 480 deletions

View File

@@ -1328,28 +1328,49 @@ void showProgressDialog(
void showSleepCalendarBottomSheet({
required BuildContext context,
int? timestamp,
int? type = 1, // 新增参数默认值为1
int? type = 1,
String? mac,
required void Function(DateTime selectedDate) onDateSelected,
}) {
showModalBottomSheet(
showGeneralDialog(
context: context,
isScrollControlled: false,
backgroundColor: Colors.transparent,
builder: (context) {
return Container(
decoration: BoxDecoration(
color: const Color(0xFF242835),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20.rpx),
topRight: Radius.circular(20.rpx),
barrierDismissible: true,
barrierLabel: 'Dismiss',
barrierColor: Colors.black.withOpacity(0.4), // 移到这里,替代 Scaffold 背景
transitionDuration: const Duration(milliseconds: 300),
pageBuilder: (context, animation, secondaryAnimation) {
return GestureDetector(
onTap: () {
Navigator.of(context).pop(); // 点击空白关闭
},
child: Material(
type: MaterialType.transparency,
child: Align(
alignment: Alignment.bottomCenter,
child: GestureDetector(
onTap: () {}, // 阻止点击透传到外部(避免误关)
child: FractionallySizedBox(
widthFactor: 1.0,
heightFactor: 0.55,
child: Container(
decoration: BoxDecoration(
color: const Color(0xFF242835),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20.rpx),
topRight: Radius.circular(20.rpx),
),
),
child: SleepCalendarWidget(
timestamp: timestamp,
type: type,
mac: mac,
onDateSelected: onDateSelected,
),
),
),
),
),
),
child: SleepCalendarWidget(
timestamp: timestamp,
type: type, // 传递类型给子组件
onDateSelected: onDateSelected,
// highlightColor: Colors.green,
),
);
},
);