Skip to content

Commit 34a6813

Browse files
authored
[local_auth] Add Android theme compatibility documentation (flutter#6875)
Add documentation to README.md file from local_auth package: - Compatibility of Android theme for Android 8 and below.
1 parent 132d9c7 commit 34a6813

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

packages/local_auth/local_auth/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
## NEXT
1+
## 2.1.4
22

33
* Updates minimum Flutter version to 3.0.
4+
* Updates documentation for Android version 8 and below theme compatibility.
45

56
## 2.1.3
67

packages/local_auth/local_auth/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,42 @@ types (such as face scanning) and you want to support SDKs lower than Q,
252252
_do not_ call `getAvailableBiometrics`. Simply call `authenticate` with `biometricOnly: true`.
253253
This will return an error if there was no hardware available.
254254
255+
#### Android theme
256+
257+
Your `LaunchTheme`'s parent must be a valid `Theme.AppCompat` theme to prevent
258+
crashes on Android 8 and below. For example, use `Theme.AppCompat.DayNight` to
259+
enable light/dark modes for the biometric dialog. To do that go to
260+
`android/app/src/main/res/values/styles.xml` and look for the style with name
261+
`LaunchTheme`. Then change the parent for that style as follows:
262+
263+
```xml
264+
...
265+
<resources>
266+
<style name="LaunchTheme" parent="Theme.AppCompat.DayNight">
267+
...
268+
</style>
269+
...
270+
</resources>
271+
...
272+
```
273+
274+
If you don't have a `styles.xml` file for your Android project you can set up
275+
the Android theme directly in `android/app/src/main/AndroidManifest.xml`:
276+
277+
```xml
278+
...
279+
<application
280+
...
281+
<activity
282+
...
283+
android:theme="@style/Theme.AppCompat.DayNight"
284+
...
285+
>
286+
</activity>
287+
</application>
288+
...
289+
```
290+
255291
## Sticky Auth
256292

257293
You can set the `stickyAuth` option on the plugin to true so that plugin does not

packages/local_auth/local_auth/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Flutter plugin for Android and iOS devices to allow local
33
authentication via fingerprint, touch ID, face ID, passcode, pin, or pattern.
44
repository: https://github.com/flutter/plugins/tree/main/packages/local_auth/local_auth
55
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+local_auth%22
6-
version: 2.1.3
6+
version: 2.1.4
77

88
environment:
99
sdk: ">=2.14.0 <3.0.0"

0 commit comments

Comments
 (0)