![](/img/trans.png)
[英]How to do face id authentication for both android and iOS in flutter
[英]Customize The Native Alert dialog in flutter applicaton for iOS or Android for Face Id implementation
下面是成功實現的 Flutter 應用程序中對生物特征訪問進行身份驗證的方法。 如果發生錯誤,它會顯示一個警報對話框,如 iOS 應用程序中的圖像所示,我想自定義此警報對話框,我該怎么做?
此警報對話框僅在useErrorDialogs
設置為true
時顯示,如下面的代碼所示。
這是從Flutter 中的 Face Id Lock 實現中引用的
Future<void> _authenticateUser() async {
bool isAuthenticated = false;
try {
isAuthenticated = await _localAuthentication.authenticateWithBiometrics(
localizedReason:
"Please authenticate to view your transaction overview",
useErrorDialogs: true,
stickyAuth: true,
);
} on PlatformException catch (e) {
print(e);
}
if (!mounted) return;
isAuthenticated
? print('User is authenticated!')
: print('User is not authenticated.');
if (isAuthenticated) {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => TransactionScreen(),
),
);
}
}
你不能改變它。 出於安全原因,整個生物識別身份驗證過程由 iOS 在您的應用程序之外處理。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.