Skip to content

Commit 6c5b752

Browse files
committed
small fixes final commit
1 parent f40b6b7 commit 6c5b752

File tree

2 files changed

+42
-33
lines changed

2 files changed

+42
-33
lines changed

ios/TaskWarriorWidgets/TaskWarriorWidgets.swift

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ struct TaskWidgetEntryView: View {
196196
VStack(spacing: 4) { // Compact spacing
197197
ForEach(Array(sortedTasks.prefix(2))) { task in
198198
taskRow(task: task)
199-
.widgetURL(URL(string: "taskwarrior://cardclicked?uuid=\(task.uuid)"))
200199
}
201200

202201
if sortedTasks.count > 2 {
@@ -214,7 +213,7 @@ struct TaskWidgetEntryView: View {
214213
VStack(spacing: 7) {
215214
ForEach(Array(sortedTasks.prefix(6))) { task in
216215
taskRow(task: task)
217-
.widgetURL(URL(string: "taskwarrior://cardclicked?uuid=\(task.uuid)"))
216+
218217
}
219218

220219
if sortedTasks.count > 6 {
@@ -227,32 +226,42 @@ struct TaskWidgetEntryView: View {
227226
}
228227
}
229228

230-
// -- Row Designs --
231-
232-
// Unified Row Design (Clean, Single Line)
233-
func taskRow(task: Task) -> some View {
234-
HStack(spacing: 10) {
235-
// Colored Bar
236-
Capsule()
237-
.fill(task.priorityColor)
238-
.frame(width: 10, height: 10) // Smaller height since text is single line
239-
240-
// Description (Single line, centered vertically)
241-
Text(task.description)
242-
.font(.subheadline)
243-
.fontWeight(.medium)
244-
.lineLimit(1)
245-
.foregroundColor(.primary)
246-
247-
Spacer()
229+
func taskRow(task: Task) -> some View {
230+
let isRealTask = task.uuid != "NO_TASK"
231+
232+
return Link(destination: URL(string: "taskwarrior://cardclicked?uuid=\(task.uuid)")!) {
233+
HStack(spacing: 10) {
234+
235+
// 1. Center alignment for status messages
236+
if !isRealTask {
237+
Spacer()
238+
}
239+
240+
// 2. Priority Dot (Real tasks only)
241+
if isRealTask {
242+
Capsule()
243+
.fill(task.priorityColor)
244+
.frame(width: 10, height: 10)
245+
}
246+
247+
// 3. Task Description
248+
Text(task.description)
249+
.font(.subheadline)
250+
.fontWeight(.medium)
251+
.lineLimit(1)
252+
.foregroundColor(isRealTask ? .primary : .secondary)
253+
254+
// 4. Trailing Spacer
255+
Spacer()
256+
}
257+
.padding(.vertical, 8)
258+
.padding(.horizontal, 12)
259+
.background(
260+
RoundedRectangle(cornerRadius: 12)
261+
// 5. Hide background if it's not a real task
262+
.fill(isRealTask ? Color(UIColor.secondarySystemBackground) : Color.clear)
263+
)
248264
}
249-
// Compact Padding to fit more items
250-
.padding(.vertical, 8)
251-
.padding(.horizontal, 12)
252-
.background(
253-
RoundedRectangle(cornerRadius: 12)
254-
.fill(Color(UIColor.secondarySystemBackground))
255-
)
256265
.fixedSize(horizontal: false, vertical: true)
257266
}
258267
}

lib/app/modules/home/views/add_task_bottom_sheet_new.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -363,12 +363,6 @@ class AddTaskBottomSheet extends StatelessWidget {
363363
}
364364

365365
void onSaveButtonClicked(BuildContext context) async {
366-
if (Platform.isAndroid || Platform.isIOS) {
367-
WidgetController widgetController = Get.put(WidgetController());
368-
widgetController.fetchAllData();
369-
370-
widgetController.update();
371-
}
372366
if (homeController.formKey.currentState!.validate()) {
373367
try {
374368
var task = taskParser(homeController.namecontroller.text)
@@ -429,6 +423,12 @@ class AddTaskBottomSheet extends StatelessWidget {
429423
if (value) {
430424
storageWidget.synchronize(context, true);
431425
}
426+
if (Platform.isAndroid || Platform.isIOS) {
427+
WidgetController widgetController = Get.put(WidgetController());
428+
widgetController.fetchAllData();
429+
430+
widgetController.update();
431+
}
432432
} on FormatException catch (e) {
433433
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
434434
content: Text(

0 commit comments

Comments
 (0)