ATL-2026-036engineering_noteexploratory

A Checkmark on the Home Screen: When the App Doesn’t Need to Open

How a native widget handles a tap and saves a task before syncing.

Published
November 23, 2026
Verified
November 23, 2026

A Checkmark on the Home Screen: When the App Doesn’t Need to Open

“Pick up the parcel” is still on the to-do list. The parcel is already in hand. A tap on the home-screen widget marks the task complete, and the phone goes back into a pocket. That evening, the same task is still open on the computer.

The phone might have been offline. Or the checkmark might have appeared before the phone saved the change. Those failures call for different answers: in one case the phone can send the change later; in the other it has nothing to send. If the widget looks the same in both cases, the user won't find out until that evening.

A shortcut to the task saves time too. But when it opens the task, the user can see there is still something to do. A Complete button makes a stronger promise: tap it and move on. That promise is worth settling before anyone chooses between Swift and Kotlin.

Why the checkmark gets there first

A home-screen widget is not a miniature Flutter screen. The operating system renders it and routes a tap to a handler. The handler cannot assume the app screen is open or that its in-memory state is still there.

On iOS 17 and later, WidgetKit can run a button or toggle action without opening the app UI. An AppIntent defines the action and perform() runs it. A plain intent normally runs in the widget extension's process. Apple notes that a Toggle changes its appearance immediately, before the action finishes. When perform() returns, WidgetKit reloads the timeline. Finish the write that the new timeline depends on before returning. If it failed, the next render should show the actual state, not preserve the optimistic checkmark. WidgetKit interactivity

On Android, Jetpack Glance can route a tap to an ActionCallback. The handler can save the result and request an update for the widget. Google recommends moving longer work out of the handler, for example into a WorkManager job. A tap, a write, and a refresh are separate steps here too. Calling update() renders fresh data; it does not make a failed write succeed. Glance actions · Updating a Glance widget

So what does the filled circle mean? “Accepted on this phone” and “confirmed by the server” are two different events. Give them the same mark with no other clue, and the user has no way to tell why the two lists disagree.

What to save before leaving the pickup counter

A personal list can treat a task as complete on the phone before the server replies. But the phone has to save the action first. One option is to save the completed status and the operation to send later in the same transaction. Otherwise the phone can stop between the two writes and leave a completed task with nothing to send on the next run.

What the database kept after a failed write

In a local SQLite test, the task status was saved first in a separate write. The insert into the outgoing queue was then deliberately rejected. A fresh connection found a completed task and an empty queue. With the same failure inside a single transaction that stopped on error, the task stayed open. When both writes succeeded, the task was complete and the queue held one operation.

The UPDATE also checks that the task belongs to the account currently in use. changes() counts the rows changed by that statement. If nothing changed, there is nothing to enqueue.

BEGIN IMMEDIATE;
UPDATE tasks SET done=1
WHERE account='alice' AND id='pickup'
  AND done=0 AND account=(SELECT account FROM session);
INSERT INTO outbox (operation, account, task_id)
SELECT 'attempt1', 'alice', 'pickup' WHERE changes()=1;
COMMIT;

COMMIT must run only if the insert succeeds. In SQLite, a failed ordinary insert can roll back that statement while leaving the transaction open. Catch the error and commit anyway, and the single transaction has bought you nothing. The test stops on error; closing the connection rolls back the unfinished transaction. SQLite conflict handling

A widget can say “Done on this device” or “Waiting to sync.” If there is no space, a link to the task list can take the user to the details. But a failed local write cannot be described as waiting to sync. Nothing was saved to send.

The meaning of a second tap matters too. Complete should mean “set this task to complete,” not “flip its state.” The user may tap twice before the old view refreshes. The second tap should not reopen the task. If completion also creates a history entry or sends a notification, use a stable operation ID so the server can recognize a retry rather than producing the effect twice.

If another device has already completed the task, the requested state may already hold. A deleted task is different: a stale widget does not get to recreate it. If the user changed accounts since the widget rendered, the action must not change the new account's list. Pass a task ID and an account ID, not a row number from an old view.

Shared work can call for a different rule. If marking a task complete tells a colleague to collect a shipment, a local save means only that the phone accepted the request. The widget cannot say the colleague got the signal before the server confirms the relevant state. Opening the task may be simpler than squeezing a rejection and its next step into two lines of widget UI.

Where the tap actually goes

Both examples start with a rendered task row. The button passes its task and account IDs and asks to complete the task. It is a one-way action. completeLocally belongs to the app's store, not the operating system. It checks the account and finishes the local transaction before returning. On failure it leaves the status unchanged so the widget can read it again. Storage and database setup are omitted.

On iOS, the IDs are bound to the button when the widget is built:

struct CompleteTaskIntent: AppIntent {
    static var title: LocalizedStringResource = "Complete task"

    @Parameter(title: "Task") var taskID: String
    @Parameter(title: "Account") var accountID: String

    init() {}

    init(taskID: String, accountID: String) {
        self.taskID = taskID
        self.accountID = accountID
    }

    func perform() async throws -> some IntentResult {
        await WidgetTaskStore.shared.completeLocally(
            taskID: taskID, accountID: accountID
        )
        return .result()
    }
}

// In the WidgetKit view on iOS 17+:
Button(intent: CompleteTaskIntent(taskID: task.id, accountID: task.accountID)) {
    Label("Complete", systemImage: "checkmark")
}

The await keeps perform() from returning before the local write finishes. It is not waiting for the server. WidgetKit then asks for a new timeline. .result() ends the intent call; the next view gets the task's actual status from the widget's data provider. WidgetKit buttons and intents

Glance passes the IDs as action parameters. The handler asks for a refresh explicitly:

private val TaskId = ActionParameters.Key<String>("taskId")
private val AccountId = ActionParameters.Key<String>("accountId")

@Composable
fun CompleteTaskButton(taskId: String, accountId: String) {
    Button(
        text = "Complete",
        onClick = actionRunCallback<CompleteTaskAction>(
            actionParametersOf(TaskId to taskId, AccountId to accountId)
        )
    )
}

class CompleteTaskAction : ActionCallback {
    override suspend fun onAction(
        context: Context, glanceId: GlanceId, parameters: ActionParameters
    ) {
        val taskId = parameters[TaskId] ?: return
        val accountId = parameters[AccountId] ?: return
        WidgetTaskStore.from(context).completeLocally(taskId, accountId)
        TasksWidget().update(context, glanceId)
    }
}

The last line refreshes the instance where the button was pressed. If several instances show the same task, plan how the others refresh too. On either platform the native button can run without a Flutter screen. What counts as complete remains a rule of the app and its store. Glance actions · Glance widget updates

What stays in Flutter

If all the user needs is a faster route to the task, use a widget link and leave completion in the screen that already handles it. This is a good starting point when people need to review details or undo an action.

For completion without opening the screen, agree on where the app and handler read and write. On iOS, App Groups give the extension and host app access to a shared container. Sharing it does not coordinate writes or migrations for you. Android's Glance documentation distinguishes app data from widget state. An instance's display settings should not become a second task database. App Groups · Glance widget state

A plugin can cut down on native code. For example, home_widget documents how a native widget calls a registered Dart callback. Layout and action wiring still need platform setup. The completion rule can stay in Dart if its dependencies work in the background. A MethodChannel alone does not start that environment; it carries messages to and from an already configured Flutter side. If the plugin fails in a release build without an open screen, try a native handler for this one operation before rewriting the task list twice. Interactive home_widget widgets · Flutter platform channels

How to test the checkmark

“Tapped and saw a checkmark” tests the display. For the personal list, start offline with the app UI closed, tap twice, then open the app. The task should be complete locally with one pending operation. Bring the connection back and check the same task on another device. Separately, tap a stale widget after deleting the task and after switching accounts. Neither a deleted task nor someone else's list should change.

The SQLite test covered only the local write: sequential repeats left one queued operation, the deleted task did not come back, and neither list changed after the account switch. The Swift and Kotlin fragments show the integration points described in the platform docs. They are not built apps. Widget behavior on devices and delivery to a server were outside the experiment.

Start with one question: can the user put the phone away after the tap? If so, the action may earn its place in the widget. If there is still a decision to wait for, a detail to check, or an error to fix, a shortcut to the task can save more time than a checkmark the user has to keep watching.


ArkTelos Lab · Lab website · Official ArkTelos website

Telegram · ArkTelos Lab EN · ArkTelos Lab RU · ArkTelos EN · ArkTelos RU

Result boundaries

  • The experiment used local SQLite. Widgets were not run on devices.

Telegram edition

Read in ArkTelos Lab

Read in ArkTelos Lab ↗

ARKTELOS CHANNELS

News and engineering material, without mixing languages.

The main channels cover ArkTelos development. ArkTelos Lab publishes architecture analysis, experiments, and reproducible research.