Note that local_auth plugin requires the use of a FragmentActivity as opposed to Activity. This can be easily done by switching to use FlutterFragmentActivity as opposed to FlutterActivity in your manifest (or your own Activity class if you are extending the base class).
- Open
android>app>src>main>AndroidManifest.xml
- Add the permission
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.[your.package]">
<uses-permission android:name="android.permission.USE_FINGERPRINT"/>
<application...
...
...
...
<manifest>
If you receive this error:
Exception has occurred. PlatformException (PlatformException(no_fragment_activity, local_auth plugin requires activity to be a FragmentActivity., null))
Then you need to do this step. Change FlutterActivity
to FlutterFragmentActivity
in MainActivity.kt
.
package com.[your.package]
import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterFragmentActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant
class MainActivity: FlutterFragmentActivity() {
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
}
If you receive this error:
Exception has occurred. PlatformException (PlatformException(error, You need to use a Theme.AppCompat theme (or descendant) with this activity., null))
Then you need to do this:
- Go to
android>app>src>main>res>values>style.xml
- Change the
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
to<style name="LaunchTheme" parent="Theme.AppCompat.Light.NoActionBar">
ps: The local auth would not working if you update the Android Gradle Plugin.
Glad that it helps!
I've never customised bottom area before, only status bar. I'm not so sure about doing it dynamically but this is what i did to change the status bar brightness that works for both iOS and Android.
In
main.dart
, I added this inmain()
:To change the status bar in specific screen that have
AppBar
, I use thisbrightness:
to change the status bar brightness. To make it dynamic depends on backgroundColor, I usecomputeLuminance
.For screen without
AppBar
, I useAnnotatedRegion
:This is my work around for the time being. I hope this helps. Let me know if you have cooler ways to do this.