mirror of
https://github.com/Iconica-Development/flutter_login_widget.git
synced 2025-05-19 13:43:44 +02:00
Merge pull request #27 from Iconica-Development/5.1.4
fix: added context to callbacks
This commit is contained in:
commit
3ee3cc9461
4 changed files with 16 additions and 6 deletions
|
@ -1,3 +1,7 @@
|
|||
## 5.1.4
|
||||
|
||||
* Added BuildContext to the `onForgotPassword` and `onRegister`.
|
||||
|
||||
## 5.1.3
|
||||
* Added title spacer
|
||||
|
||||
|
|
|
@ -58,8 +58,8 @@ class LoginScreen extends StatelessWidget {
|
|||
body: EmailPasswordLoginForm(
|
||||
options: loginOptions,
|
||||
onLogin: (email, password) => print('$email:$password'),
|
||||
onRegister: (email, password) => print('Register!'),
|
||||
onForgotPassword: (email) {
|
||||
onRegister: (email, password, ctx) => print('Register!'),
|
||||
onForgotPassword: (email, ctx) {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) {
|
||||
|
|
|
@ -13,8 +13,12 @@ class EmailPasswordLoginForm extends StatefulWidget {
|
|||
});
|
||||
|
||||
final LoginOptions options;
|
||||
final void Function(String email)? onForgotPassword;
|
||||
final FutureOr<void> Function(String email, String password)? onRegister;
|
||||
final void Function(String email, BuildContext ctx)? onForgotPassword;
|
||||
final FutureOr<void> Function(
|
||||
String email,
|
||||
String password,
|
||||
BuildContext context,
|
||||
)? onRegister;
|
||||
final FutureOr<void> Function(String email, String password) onLogin;
|
||||
|
||||
@override
|
||||
|
@ -181,7 +185,8 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
|
|||
child: options.forgotPasswordButtonBuilder(
|
||||
context,
|
||||
() {
|
||||
widget.onForgotPassword?.call(_currentEmail);
|
||||
widget.onForgotPassword
|
||||
?.call(_currentEmail, context);
|
||||
},
|
||||
false,
|
||||
() {},
|
||||
|
@ -211,6 +216,7 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
|
|||
widget.onRegister?.call(
|
||||
_currentEmail,
|
||||
_currentPassword,
|
||||
context,
|
||||
);
|
||||
},
|
||||
false,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: flutter_login
|
||||
description: Flutter Login Component
|
||||
version: 5.1.3
|
||||
version: 5.1.4
|
||||
|
||||
environment:
|
||||
sdk: ">=2.18.1 <3.0.0"
|
||||
|
|
Loading…
Reference in a new issue