{"id":27488286,"url":"https://github.com/mk590901/idle_timeout","last_synced_at":"2025-07-23T06:33:08.975Z","repository":{"id":287825082,"uuid":"959753829","full_name":"mk590901/idle_timeout","owner":"mk590901","description":"The repository contains a demo application implements blocking itself by timeout.","archived":false,"fork":false,"pushed_at":"2025-04-15T04:58:54.000Z","size":100,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-15T02:11:18.609Z","etag":null,"topics":["bloc","blocking","dart","flutter"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mk590901.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-03T09:48:52.000Z","updated_at":"2025-04-15T04:58:58.000Z","dependencies_parsed_at":"2025-04-16T20:03:19.274Z","dependency_job_id":null,"html_url":"https://github.com/mk590901/idle_timeout","commit_stats":null,"previous_names":["mk590901/idle_timeout"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mk590901/idle_timeout","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mk590901%2Fidle_timeout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mk590901%2Fidle_timeout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mk590901%2Fidle_timeout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mk590901%2Fidle_timeout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mk590901","download_url":"https://codeload.github.com/mk590901/idle_timeout/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mk590901%2Fidle_timeout/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266631348,"owners_count":23959419,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bloc","blocking","dart","flutter"],"created_at":"2025-04-16T19:55:56.763Z","updated_at":"2025-07-23T06:33:08.950Z","avatar_url":"https://github.com/mk590901.png","language":"Dart","readme":"# Idle-Timeout-Flutter \n\nThe application locks itself if there is no touch in the drawing area for a specified time. In this case, the icon of the lock appears on the canvas. By clicking on it, the user unlocks the application and can continue drawing.\n\n## Inside Application\n\nThe main widget is __IdleTimeoutWrapper__ will track application activity. It's a stateless widget that is driven by __BLoC__ events and keeps track of itself internal states.\n\n### Main Points\n\n\u003e __BLoC__\n  * __Events__ defined: __ResetTimer__, __LockApp__, __UnlockApp__, __AddPoint__ and __ClearPoints__\n  * __IdleState__ it's a class with two fields: __isLocked__ and __points__\n  * __IdleBloc__ manages the timer logic and states\n     \n\u003e __StatelessWidget__\n  * __IdleTimeoutWrapper__ is stateless\n  * Uses __BlocProvider__ to create __BLoC__\n  * __BlocBuilder__ rebuilds UI when state changes\n     \n\u003e __Logic__\n  * _Timer_ is managed in __BLoC__\n  * _Events_ are sent via _context.read\u003cIdleBloc\u003e().add()_\n  * __UI__ only reacts to the current state\n\n\u003e __DrawingPainter__\n  * Created __CustomPainter__ for drawing lines\n  * Take a list of points and draw lines between them\n  * Uses orange color with line width 2.0\n    \n\u003e ___DrawingCanvas__\n  * StatelessWidget for managing drawing state\n  * Stores a list of points _points\n  * Handles drawing gestures only in unlocked state\n  * Creates a __ValueNotifier\u003cbool\u003e__ to pass to __AnimatedLock__\n  * Resets __isTappedNotifier__ to false after unlocking\n    \n\u003e __Drawing logic__\n  * __onPanStart__: starts a new line\n  * __onPanUpdate__: adds points when moving\n  * __onPanEnd__: adds null to break line\n\n\u003e __AnimatedLock__\n * Full StatelessWidget\n * Accepts a __ValueNotifier\u003cbool\u003e__ to control the icon state\n * Uses a __ValueListenableBuilder__ to listen for changes to __isTappedNotifier__\n\n\u003e __Integration__\n  * __CustomPaint__ added to _Stack_ in any case\n  * Drawing is active only when the app is __unlocked__\n  * __Timer__ resets on all interactions\n  * __AnimatedLock__ added to _Stack_ only when the app is locked\n\n\u003e __How it works__\n* Initially, a closed lock is shown (__Icons.lock__)\n* When pressed, the icon immediately changes to an open lock (__Icons.lock_open__)\n* After 0.5 seconds, the application is unlocked and the icon state is reset\n\n## Movie\n\nhttps://github.com/user-attachments/assets/12512087-abc5-4aab-bc20-7118a6689d6d\n\n## Additions\nAnother change has been made to the application, which solves the problem of screen orientation. I prefer that the application runs exclusively in __portrait__ mode on the __phone__, and in __landscape__ on the __tablet__.\n\nAs know, starting with __Android 14__, the __android:screenOrientation__ attribute in the __application manifest__ is considered obsolete and now the orientation must be set manually in the application. By the way, this solution seems quite reasonable, since setting the orientation in the manifest is too strict a restriction.\n\nAnother element has been added to the application: __OrientationBlob__, which determines the device type and sets the orientation of the application according to my above mentioned preference.\n\nTo determine the device type, the dart package __Sizer__ is used.\n\nBelow is another movie illustrating the launch of the application on a tablet __Android 14__.\n\n## Movie II\n\nhttps://github.com/user-attachments/assets/77b75d80-df6e-4a1c-9b4a-78866bf2c08c\n\n\n  \n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmk590901%2Fidle_timeout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmk590901%2Fidle_timeout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmk590901%2Fidle_timeout/lists"}