From 702ba8e293b90ddc64208dd357a99ccbaeb843cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?wang=5Fzhipeng=E2=80=99?= Date: Mon, 23 Sep 2024 20:31:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9A=82=E5=81=9C?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wang_zhipeng’ --- .../local_auth/local_auth_ohos/example/lib/main.dart | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/local_auth/local_auth_ohos/example/lib/main.dart b/packages/local_auth/local_auth_ohos/example/lib/main.dart index f9bab12b9..8d5b41296 100644 --- a/packages/local_auth/local_auth_ohos/example/lib/main.dart +++ b/packages/local_auth/local_auth_ohos/example/lib/main.dart @@ -147,8 +147,13 @@ class _MyAppState extends State { } Future _cancelAuthentication() async { - await LocalAuthPlatform.instance.stopAuthentication(); - setState(() => _isAuthenticating = false); + bool result = await LocalAuthPlatform.instance.stopAuthentication(); + print('ddddddd result = $result'); + setState(() { + _isAuthenticating = !result; + _authorized = result ? 'Not Authorized' : 'Authorized'; + }); + } @override @@ -185,7 +190,7 @@ class _MyAppState extends State { ), const Divider(height: 100), Text('Current State: $_authorized\n'), - if (_isAuthenticating) + if (_authorized == 'Authorized') ElevatedButton( onPressed: _cancelAuthentication, // TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later. -- Gitee From 18d312d35565278b462cd1788b10e92c576168a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=99=BA=E9=B9=8F?= Date: Tue, 24 Sep 2024 01:30:19 +0000 Subject: [PATCH 2/2] =?UTF-8?q?update=20packages/local=5Fauth/local=5Fauth?= =?UTF-8?q?=5Fohos/example/lib/main.dart.=20=E5=88=A0=E9=99=A4=E8=BE=93?= =?UTF-8?q?=E5=87=BA=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王智鹏 --- packages/local_auth/local_auth_ohos/example/lib/main.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/local_auth/local_auth_ohos/example/lib/main.dart b/packages/local_auth/local_auth_ohos/example/lib/main.dart index 8d5b41296..23abdda0e 100644 --- a/packages/local_auth/local_auth_ohos/example/lib/main.dart +++ b/packages/local_auth/local_auth_ohos/example/lib/main.dart @@ -148,7 +148,6 @@ class _MyAppState extends State { Future _cancelAuthentication() async { bool result = await LocalAuthPlatform.instance.stopAuthentication(); - print('ddddddd result = $result'); setState(() { _isAuthenticating = !result; _authorized = result ? 'Not Authorized' : 'Authorized'; -- Gitee