feat:增加提醒事项
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import 'package:flisp_app/models/todo.dart';
|
||||
import 'package:flisp_app/utils/date_utils.dart';
|
||||
import 'package:flisp_app/widgets/common.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:toggle_switch/toggle_switch.dart';
|
||||
|
||||
// 统计卡片
|
||||
@@ -119,6 +119,7 @@ Widget _buildTodoTitle(Todo todo) {
|
||||
style: TextStyle(
|
||||
decoration: todo.isCompleted ? TextDecoration.lineThrough : null,
|
||||
color: todo.isCompleted ? Colors.grey : null,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
);
|
||||
@@ -128,31 +129,45 @@ Widget _buildTodoTitle(Todo todo) {
|
||||
Widget? _buildTodoSubtitle(Todo todo) {
|
||||
final isOverdue =
|
||||
todo.dueDate != null &&
|
||||
todo.dueDate!.isBefore(DateTime.now()) &&
|
||||
!todo.isCompleted;
|
||||
todo.dueDate!.isBefore(DateTime.now()) &&
|
||||
!todo.isCompleted;
|
||||
|
||||
final hasContent = todo.content.isNotEmpty == true || todo.dueDate != null;
|
||||
|
||||
if (!hasContent) return null;
|
||||
|
||||
return Wrap(
|
||||
direction: Axis.vertical,
|
||||
spacing: 5,
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 4),
|
||||
if (todo.content.isNotEmpty == true)
|
||||
Text(
|
||||
todo.content,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 12, color: Colors.grey.shade600),
|
||||
),
|
||||
if (todo.dueDate != null)
|
||||
Text(
|
||||
'截止: ${formatDate(todo.dueDate!)}',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: isOverdue ? Colors.red : Colors.grey,
|
||||
fontWeight: isOverdue ? FontWeight.bold : FontWeight.normal,
|
||||
fontSize: 14,
|
||||
color: Colors.grey[700],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
if (todo.dueDate != null)
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: isOverdue ? Colors.red[50] : Colors.grey[50],
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
border: Border.all(
|
||||
color: isOverdue ? Colors.red[100]! : Colors.grey[300]!,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'截止: ${DateFormat("yyyy-MM-dd").format(todo.dueDate!)}',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: isOverdue ? Colors.red[600] : Colors.grey[600],
|
||||
fontWeight: isOverdue ? FontWeight.w600 : FontWeight.normal,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user