fix: invalidate project tasks on return from task edit screen
This commit is contained in:
@@ -48,6 +48,12 @@ class _ProjectTasksScreenState extends ConsumerState<ProjectTasksScreen> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _openTask(int taskId) {
|
||||||
|
context
|
||||||
|
.push(Routes.taskEdit.replaceFirst(':id', '$taskId'))
|
||||||
|
.then((_) => ref.invalidate(projectTasksProvider(widget.projectId)));
|
||||||
|
}
|
||||||
|
|
||||||
Color _parseColor(String? hex) {
|
Color _parseColor(String? hex) {
|
||||||
if (hex == null || hex.isEmpty) return const Color(0xFF6366F1);
|
if (hex == null || hex.isEmpty) return const Color(0xFF6366F1);
|
||||||
try {
|
try {
|
||||||
@@ -171,6 +177,7 @@ class _ProjectTasksScreenState extends ConsumerState<ProjectTasksScreen> {
|
|||||||
task: task,
|
task: task,
|
||||||
effectiveStatus: _effectiveStatus(task),
|
effectiveStatus: _effectiveStatus(task),
|
||||||
onStatusTap: () => _cycleStatus(task),
|
onStatusTap: () => _cycleStatus(task),
|
||||||
|
onTap: () => _openTask(task.id),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -198,6 +205,7 @@ class _ProjectTasksScreenState extends ConsumerState<ProjectTasksScreen> {
|
|||||||
task: task,
|
task: task,
|
||||||
effectiveStatus: _effectiveStatus(task),
|
effectiveStatus: _effectiveStatus(task),
|
||||||
onStatusTap: () => _cycleStatus(task),
|
onStatusTap: () => _cycleStatus(task),
|
||||||
|
onTap: () => _openTask(task.id),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -282,11 +290,13 @@ class _TaskRow extends StatelessWidget {
|
|||||||
final Task task;
|
final Task task;
|
||||||
final TaskStatus effectiveStatus;
|
final TaskStatus effectiveStatus;
|
||||||
final VoidCallback onStatusTap;
|
final VoidCallback onStatusTap;
|
||||||
|
final VoidCallback onTap;
|
||||||
|
|
||||||
const _TaskRow({
|
const _TaskRow({
|
||||||
required this.task,
|
required this.task,
|
||||||
required this.effectiveStatus,
|
required this.effectiveStatus,
|
||||||
required this.onStatusTap,
|
required this.onStatusTap,
|
||||||
|
required this.onTap,
|
||||||
});
|
});
|
||||||
|
|
||||||
IconData get _statusIcon => switch (effectiveStatus) {
|
IconData get _statusIcon => switch (effectiveStatus) {
|
||||||
@@ -317,8 +327,7 @@ class _TaskRow extends StatelessWidget {
|
|||||||
return Card(
|
return Card(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 3),
|
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 3),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => context
|
onTap: onTap,
|
||||||
.push(Routes.taskEdit.replaceFirst(':id', '${task.id}')),
|
|
||||||
borderRadius: BorderRadius.circular(14),
|
borderRadius: BorderRadius.circular(14),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(4, 6, 14, 6),
|
padding: const EdgeInsets.fromLTRB(4, 6, 14, 6),
|
||||||
|
|||||||
Reference in New Issue
Block a user