Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/src/config/login_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
12 changes: 9 additions & 3 deletions lib/src/widgets/email_password_login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,15 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
),
);

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,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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

Expand Down