feat:增加主题色
This commit is contained in:
@@ -23,7 +23,9 @@ class _ScheduleDialogState extends State<ScheduleDialog> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_titleController = TextEditingController(text: widget.schedule?.title ?? '');
|
||||
_titleController = TextEditingController(
|
||||
text: widget.schedule?.title ?? '',
|
||||
);
|
||||
_selectedStartTime = widget.schedule?.startTime;
|
||||
_selectedEndTime = widget.schedule?.endTime;
|
||||
_selectedScheduleDate = widget.schedule?.scheduleDate;
|
||||
@@ -35,34 +37,43 @@ class _ScheduleDialogState extends State<ScheduleDialog> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void onConfirmClick()async {
|
||||
void onConfirmClick() async {
|
||||
if (_selectedStartTime == null) {
|
||||
await displayInfoBar(context, builder: (context, close) {
|
||||
return InfoBar(
|
||||
title: const Text('请选择开始时间'),
|
||||
severity: InfoBarSeverity.error,
|
||||
);
|
||||
});
|
||||
await displayInfoBar(
|
||||
context,
|
||||
builder: (context, close) {
|
||||
return InfoBar(
|
||||
title: const Text('请选择开始时间'),
|
||||
severity: InfoBarSeverity.error,
|
||||
);
|
||||
},
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_selectedEndTime == null) {
|
||||
await displayInfoBar(context, builder: (context, close) {
|
||||
return InfoBar(
|
||||
title: const Text('请选择结束时间'),
|
||||
severity: InfoBarSeverity.error,
|
||||
);
|
||||
});
|
||||
await displayInfoBar(
|
||||
context,
|
||||
builder: (context, close) {
|
||||
return InfoBar(
|
||||
title: const Text('请选择结束时间'),
|
||||
severity: InfoBarSeverity.error,
|
||||
);
|
||||
},
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_selectedEndTime!.isAfter(_selectedStartTime!)) {
|
||||
await displayInfoBar(context, builder: (context, close) {
|
||||
return InfoBar(
|
||||
title: const Text('结束时间必须晚于开始时间'),
|
||||
severity: InfoBarSeverity.error,
|
||||
);
|
||||
});
|
||||
await displayInfoBar(
|
||||
context,
|
||||
builder: (context, close) {
|
||||
return InfoBar(
|
||||
title: const Text('结束时间必须晚于开始时间'),
|
||||
severity: InfoBarSeverity.error,
|
||||
);
|
||||
},
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -82,7 +93,7 @@ class _ScheduleDialogState extends State<ScheduleDialog> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ContentDialog(
|
||||
title: Text(widget.schedule == null ? '添加日程' : '编辑日程'),
|
||||
title: Center(child: Text(widget.schedule == null ? '添加日程' : '编辑日程')),
|
||||
content: _buildForm(),
|
||||
actions: [
|
||||
Button(
|
||||
|
||||
@@ -57,7 +57,7 @@ class _TaskDialogState extends State<TaskDialog> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ContentDialog(
|
||||
title: Text(widget.task == null ? '添加任务' : '编辑任务'),
|
||||
title: Center(child: Text(widget.task == null ? '添加任务' : '编辑任务')),
|
||||
content: _buildForm(),
|
||||
actions: [
|
||||
Button(
|
||||
|
||||
@@ -36,12 +36,12 @@ class TaskItem extends StatelessWidget {
|
||||
children: [
|
||||
_buildPriorityIndicator(task.priority),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(child: _buildTitle()),
|
||||
Expanded(child: _buildTitle(context)),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
const SizedBox(height: 4),
|
||||
if (task.desc != null && task.desc!.isNotEmpty) _buildDesc(),
|
||||
const SizedBox(height: 2),
|
||||
const SizedBox(height: 4),
|
||||
if (task.dueDate != null || task.scheduleDate != null)
|
||||
_buildDate(),
|
||||
],
|
||||
@@ -62,14 +62,14 @@ class TaskItem extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTitle() {
|
||||
Widget _buildTitle(BuildContext context) {
|
||||
return Text(
|
||||
task.title,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontWeight: FontWeight.bold,
|
||||
decoration: task.isCompleted ? TextDecoration.lineThrough : null,
|
||||
color: task.isCompleted ? Colors.grey : Colors.red,
|
||||
color: task.isCompleted ? Colors.grey[100] : FluentTheme.of(context).accentColor,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -78,7 +78,7 @@ class TaskItem extends StatelessWidget {
|
||||
return Text(
|
||||
task.desc!,
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
color: Colors.grey[150],
|
||||
fontSize: 14,
|
||||
decoration: task.isCompleted ? TextDecoration.lineThrough : null,
|
||||
),
|
||||
@@ -89,20 +89,20 @@ class TaskItem extends StatelessWidget {
|
||||
return Row(
|
||||
children: [
|
||||
if (task.dueDate != null) ...[
|
||||
const Icon(FluentIcons.calendar, size: 12, color: Colors.grey),
|
||||
Icon(FluentIcons.calendar, size: 12, color: Colors.grey),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'截止日期: ${_formatDate(task.dueDate!)}',
|
||||
style: const TextStyle(color: Colors.grey, fontSize: 12),
|
||||
style: TextStyle(color: Colors.grey, fontSize: 12),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
],
|
||||
if (task.scheduleDate != null) ...[
|
||||
const Icon(FluentIcons.clock, size: 12, color: Colors.grey),
|
||||
Icon(FluentIcons.clock, size: 12, color: Colors.grey),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'提醒日期: ${_formatDate(task.scheduleDate!)}',
|
||||
style: const TextStyle(color: Colors.grey, fontSize: 12),
|
||||
style: TextStyle(color: Colors.grey, fontSize: 12),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user