Flutter Screen Lock 是一個跨平台套件,可在 Android、iOS 及其他支援平台實現螢幕鎖定。它支援密碼與生物辨識驗證(如 Face ID 或指紋),以保護應用介面。適合需要增強安全性之應用,例如銀行或私人資料存取,可與 Flutter 生態系統無縫整合。此套件利用原生平台功能實現可靠驗證,確保跨裝置提供一致的使用者體驗。
適用情境
安全應用存取
保護敏感數據
生物辨識登入
密碼保護
應用鎖功能
注重隱私的應用程式
主要特色
跨平台支援
生物識別認證
密碼備用
原生整合
簡易設定
可自定義的使用者介面
適合對象
需要高安全性應用
金融或健康應用
私人資料儲存
使用者隱私工具
開發人員建構應用鎖
使用建議
需要平台特定權限
某些平台的自訂功能有限
Web 支援可能有限制
取決於設備生物識別功能的可用性
不適用於非互動式螢幕
可能需要為網頁進行額外設定
原始 README
以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。
Flutter Screen Lock
This Flutter plugin provides an feature for screen lock.
Enter your passcode to unlock the screen.
You can also use biometric authentication as an option.
Landscape view
Features
By the length of the character count
You can change Cancel and Delete widget
Optimizes the UI for device size and orientation
You can disable cancellation
You can use biometrics (local_auth plugin)
Biometrics can be displayed on first launch
Unlocked callback
You can specify a mismatch event.
Limit the maximum number of retries
Keyboard input support for devices with physical keyboards
Number keys (0-9) and numpad input
Backspace key for deletion
Enter key for confirmation
Escape key for cancellation
Usage
You can easily lock the screen with the following code.
To unlock, enter correctString.
Simple
If you give the same input as correctString, it will automatically close the screen.
You can have users create a new passcode with confirmation
import'package:flutter_screen_lock/flutter_screen_lock.dart';
screenLockCreate(
context: context,
onConfirmed: (value) => print(value), // store new passcode somewhere here
);
Control the creation state
import'package:flutter_screen_lock/flutter_screen_lock.dart';
final inputController = InputController();
screenLockCreate(
context: context,
inputController: inputController,
);
// Somewhere else...
inputController.unsetConfirmed(); // reset first and confirm input
Change all callback names from didSomething to onSomething
Change screenLock with confirm: true to screenLockCreate
Change ScreenLock with confirm: true to ScreenLock.create
Replace StyledInputConfig with KeyPadButtonConfig
Replace spacingRatio with fixed value spacing in Secrets
6.x to 7 migration
Requires dart >= 2.17 and Flutter 3.0
Replace InputButtonConfig with KeyPadConfig.
Change delayChild to delayBuilder. delayBuilder is no longer displayed in a new screen. Instead, it is now located above the Secrets.
Accept BuildContext in secretsBuilder.
5.x to 6 migration
ScreenLock does not use Navigator.pop internally anymore.
The developer should now pop by themselves when desired. screenLock call will pop automatically if onUnlocked is null.