更新日历样式
This commit is contained in:
@@ -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,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user