{"id":22795822,"url":"https://github.com/naoki0719/flutter_screen_lock","last_synced_at":"2025-04-04T07:04:31.664Z","repository":{"id":38026983,"uuid":"239138927","full_name":"naoki0719/flutter_screen_lock","owner":"naoki0719","description":"Provides the ability to lock the screen on ios and android. Biometric authentication can be used in addition to passcode.","archived":false,"fork":false,"pushed_at":"2025-01-19T02:14:06.000Z","size":1918,"stargazers_count":105,"open_issues_count":8,"forks_count":51,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T06:03:53.708Z","etag":null,"topics":["biometrics","dart","flutter","flutter-package","passcode","screen-lock","ui","unlock","widget"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/flutter_screen_lock","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/naoki0719.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2020-02-08T13:45:22.000Z","updated_at":"2025-02-27T01:17:56.000Z","dependencies_parsed_at":"2023-12-29T10:28:26.878Z","dependency_job_id":"cba4469b-c976-44d8-9cbd-3b03f0e38ddb","html_url":"https://github.com/naoki0719/flutter_screen_lock","commit_stats":{"total_commits":209,"total_committers":7,"mean_commits":"29.857142857142858","dds":"0.23444976076555024","last_synced_commit":"60e547a795131518b417c166792ad02f2e24225b"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naoki0719%2Fflutter_screen_lock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naoki0719%2Fflutter_screen_lock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naoki0719%2Fflutter_screen_lock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naoki0719%2Fflutter_screen_lock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/naoki0719","download_url":"https://codeload.github.com/naoki0719/flutter_screen_lock/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247135141,"owners_count":20889420,"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","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":["biometrics","dart","flutter","flutter-package","passcode","screen-lock","ui","unlock","widget"],"created_at":"2024-12-12T05:08:48.714Z","updated_at":"2025-04-04T07:04:31.644Z","avatar_url":"https://github.com/naoki0719.png","language":"Dart","readme":"# Flutter Screen Lock\n\nThis Flutter plugin provides an feature for screen lock.\nEnter your passcode to unlock the screen.\nYou can also use biometric authentication as an option.\n\n\u003cimg src=\"https://raw.githubusercontent.com/naoki0719/flutter_screen_lock/master/resources/flutter_screen_lock_v3.gif\" /\u003e\n\n## Landscape view\n\n\u003cimg src=\"https://raw.githubusercontent.com/naoki0719/flutter_screen_lock/master/resources/landscape.png\" /\u003e\n\n## Features\n\n- By the length of the character count\n- You can change `Cancel` and `Delete` widget\n- Optimizes the UI for device size and orientation\n- You can disable cancellation\n- You can use biometrics (local_auth plugin)\n- Biometrics can be displayed on first launch\n- Unlocked callback\n- You can specify a mismatch event.\n- Limit the maximum number of retries\n\n## Usage\n\nYou can easily lock the screen with the following code.  \nTo unlock, enter correctString.\n\n### Simple\n\nIf you give the same input as correctString, it will automatically close the screen.\n\n```dart\nimport 'package:flutter_screen_lock/flutter_screen_lock.dart';\n\nscreenLock(\n  context: context,\n  correctString: '1234',\n);\n```\n\n### Block user\n\nProvides a screen lock that cannot be cancelled.\n\n```dart\nimport 'package:flutter_screen_lock/flutter_screen_lock.dart';\n\nscreenLock(\n  context: context,\n  correctString: '1234',\n  canCancel: false,\n);\n```\n\n### Passcode creation\n\nYou can have users create a new passcode with confirmation\n\n```dart\nimport 'package:flutter_screen_lock/flutter_screen_lock.dart';\n\nscreenLockCreate(\n  context: context,\n  onConfirmed: (value) =\u003e print(value), // store new passcode somewhere here\n);\n```\n\n### Control the creation state\n\n```dart\nimport 'package:flutter_screen_lock/flutter_screen_lock.dart';\n\nfinal inputController = InputController();\n\nscreenLockCreate(\n  context: context,\n  inputController: inputController,\n);\n\n// Somewhere else...\ninputController.unsetConfirmed(); // reset first and confirm input\n```\n\n### Use local_auth\n\nAdd the [local_auth](https://pub.dev/packages/local_auth) package to pubspec.yml.\n\nIt includes an example that calls biometrics as soon as screenLock is displayed in `didOpened`.\n\n```dart\nimport 'package:flutter_screen_lock/flutter_screen_lock.dart';\nimport 'package:local_auth/local_auth.dart';\nimport 'package:flutter/material.dart';\n\nFuture\u003cvoid\u003e localAuth(BuildContext context) async {\n  final localAuth = LocalAuthentication();\n  final didAuthenticate = await localAuth.authenticateWithBiometrics(\n      localizedReason: 'Please authenticate');\n  if (didAuthenticate) {\n    Navigator.pop(context);\n  }\n}\n\nscreenLock(\n  context: context,\n  correctString: '1234',\n  customizedButtonChild: Icon(Icons.fingerprint),\n  customizedButtonTap: () async =\u003e await localAuth(context),\n  didOpened: () async =\u003e await localAuth(context),\n);\n```\n\n### Fully customize\n\nYou can customize every aspect of the screenlock.\nHere is an example:\n\n```dart\nimport 'package:flutter/material.dart';\nimport 'package:flutter_screen_lock/flutter_screen_lock.dart';\n\nscreenLockCreate(\n  context: context,\n  title: const Text('change title'),\n  confirmTitle: const Text('change confirm title'),\n  onConfirmed: (value) =\u003e Navigator.of(context).pop(),\n  config: const ScreenLockConfig(\n    backgroundColor: Colors.deepOrange,\n  ),\n  secretsConfig: SecretsConfig(\n    spacing: 15, // or spacingRatio\n    padding: const EdgeInsets.all(40),\n    secretConfig: SecretConfig(\n      borderColor: Colors.amber,\n      borderSize: 2.0,\n      disabledColor: Colors.black,\n      enabledColor: Colors.amber,\n      height: 15,\n      width: 15,\n      build: (context,\n              {required config, required enabled}) =\u003e\n          Container(\n        decoration: BoxDecoration(\n          shape: BoxShape.rectangle,\n          color: enabled\n              ? config.enabledColor\n              : config.disabledColor,\n          border: Border.all(\n            width: config.borderSize,\n            color: config.borderColor,\n          ),\n        ),\n        padding: const EdgeInsets.all(10),\n        width: config.width,\n        height: config.height,\n      ),\n    ),\n  ),\n  keyPadConfig: KeyPadConfig(\n    buttonConfig: StyledInputConfig(\n      textStyle:\n          StyledInputConfig.getDefaultTextStyle(context)\n              .copyWith(\n        color: Colors.orange,\n        fontWeight: FontWeight.bold,\n      ),\n      buttonStyle: OutlinedButton.styleFrom(\n        shape: const RoundedRectangleBorder(),\n        backgroundColor: Colors.deepOrange,\n      ),\n    ),\n    displayStrings: [\n      '零',\n      '壱',\n      '弐',\n      '参',\n      '肆',\n      '伍',\n      '陸',\n      '質',\n      '捌',\n      '玖'\n    ],\n  ),\n  cancelButton: const Icon(Icons.close),\n  deleteButton: const Icon(Icons.delete),\n);\n```\n\n\u003cimg src=\"https://raw.githubusercontent.com/naoki0719/flutter_screen_lock/master/resources/customize_styles_v3.png\" /\u003e\n\n## Version migration\n\n### 8.x to 9 migration\n\n- Change `screenLockConfig` parameter to `config`\n- Change `keyPadConfig` parameter to `config`\n\n### 7.x to 8 migration\n\n- Change all callback names from `didSomething` to `onSomething`\n- Change `screenLock` with `confirm: true` to `screenLockCreate`\n- Change `ScreenLock` with `confirm: true` to `ScreenLock.create`\n- Replace `StyledInputConfig` with `KeyPadButtonConfig`\n- Replace `spacingRatio` with fixed value `spacing` in `Secrets` \n\n### 6.x to 7 migration\n\n- Requires dart \u003e= 2.17 and Flutter 3.0\n- Replace `InputButtonConfig` with `KeyPadConfig`.\n- Change `delayChild` to `delayBuilder`.  \n  `delayBuilder` is no longer displayed in a new screen. Instead, it is now located above the `Secrets`.\n- Accept `BuildContext` in `secretsBuilder`.\n\n### 5.x to 6 migration\n\n- `ScreenLock` does not use `Navigator.pop` internally anymore.   \n  The developer should now pop by themselves when desired.   \n  `screenLock` call will pop automatically if `onUnlocked` is `null`.\n\n### 4.x to 5 migration\n\nImport name has changed from:\n\n```dart\nimport 'package:flutter_screen_lock/functions.dart';\n```\n\nto\n\n```dart\nimport 'package:flutter_screen_lock/flutter_screen_lock.dart';\n```\n\n## Apps that use this library\n\n### TimeKey\n\n- [iOS](https://apps.apple.com/us/app/timekey-authenticator/id1506129753)\n\n- [Android](https://play.google.com/store/apps/details?id=net.incrementleaf.TimeKey)\n\n## Support me!\n\n\u003ca href=\"https://www.buymeacoffee.com/noa.nao\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" width=\"30%\" \u003e\u003c/a\u003e\n","funding_links":["https://www.buymeacoffee.com/noa.nao"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaoki0719%2Fflutter_screen_lock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaoki0719%2Fflutter_screen_lock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaoki0719%2Fflutter_screen_lock/lists"}