簡體   English   中英

自定義 Flutter 應用程序中的 Native Alert 對話框,用於 iOS 或 Android 以實現 Face Id

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM