refactor: 重构提醒通知系统
This commit is contained in:
@@ -718,32 +718,57 @@ class _CalendarDayWeekScreenState extends State<CalendarDayWeekScreen>
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
border: Border.all(color: eventColor, width: 1),
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: 6,
|
||||
height: 6,
|
||||
decoration: BoxDecoration(
|
||||
color: eventColor,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
if (!isCompact) const SizedBox(width: 4),
|
||||
if (!isCompact)
|
||||
Expanded(
|
||||
child: Text(
|
||||
layout.event.title,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: eventColor,
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
const markerSize = 6.0;
|
||||
const markerTitleGap = 4.0;
|
||||
final canShowMarker = constraints.maxWidth >= markerSize;
|
||||
final canShowTitle =
|
||||
!isCompact &&
|
||||
constraints.maxWidth >= markerSize + markerTitleGap + 8;
|
||||
|
||||
if (!canShowMarker) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
return Stack(
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: SizedBox(
|
||||
width: markerSize,
|
||||
height: markerSize,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: eventColor,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
if (canShowTitle)
|
||||
Positioned(
|
||||
left: markerSize + markerTitleGap,
|
||||
right: 0,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
layout.event.title,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: eventColor,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user