diff --git a/lib/src/config/login_options.dart b/lib/src/config/login_options.dart index 984f998..39ca5b9 100644 --- a/lib/src/config/login_options.dart +++ b/lib/src/config/login_options.dart @@ -178,6 +178,7 @@ class LoginBiometricsOptions { this.onBiometricsSuccess, this.onBiometricsError, this.onBiometricsFail, + this.biometricsIconBuilder, }); /// Ask the user to login with biometrics instead of email and password. @@ -200,6 +201,14 @@ class LoginBiometricsOptions { /// The callback function to be called when the biometrics login errors. final OptionalAsyncCallback? onBiometricsError; + + /// Function to provide the icon to be displayed + /// as the biometrics login button. + /// If null, a default icon will be used based on the platform. + /// + /// The function provides the onPressed callback and the size of the button + final Widget Function(VoidCallback onPressed, Size size)? + biometricsIconBuilder; } /// Translations for all the texts in the component diff --git a/lib/src/widgets/email_password_login.dart b/lib/src/widgets/email_password_login.dart index c1a5421..dabdb85 100644 --- a/lib/src/widgets/email_password_login.dart +++ b/lib/src/widgets/email_password_login.dart @@ -206,9 +206,15 @@ class _EmailPasswordLoginFormState extends State { ), ); - var biometricsButton = BiometricsButton( - onPressed: () async => LocalAuthService().authenticate(options), - ); + var biometricsButton = + widget.options.biometricsOptions.biometricsIconBuilder != null + ? widget.options.biometricsOptions.biometricsIconBuilder!( + () async => _localAuthService.authenticate(options), + BiometricsButton.buttonSize, + ) + : BiometricsButton( + onPressed: () async => LocalAuthService().authenticate(options), + ); return Scaffold( backgroundColor: options.loginBackgroundColor, diff --git a/pubspec.yaml b/pubspec.yaml index 50d9308..8778b1c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_login description: Flutter Login Component -version: 7.3.0 +version: 7.4.0 publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub