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
|
## 5.1.3
|
||||||
* Added title spacer
|
* Added title spacer
|
||||||
|
|
||||||
|
|
|
@ -58,8 +58,8 @@ class LoginScreen extends StatelessWidget {
|
||||||
body: EmailPasswordLoginForm(
|
body: EmailPasswordLoginForm(
|
||||||
options: loginOptions,
|
options: loginOptions,
|
||||||
onLogin: (email, password) => print('$email:$password'),
|
onLogin: (email, password) => print('$email:$password'),
|
||||||
onRegister: (email, password) => print('Register!'),
|
onRegister: (email, password, ctx) => print('Register!'),
|
||||||
onForgotPassword: (email) {
|
onForgotPassword: (email, ctx) {
|
||||||
Navigator.of(context).push(
|
Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
|
|
|
@ -13,8 +13,12 @@ class EmailPasswordLoginForm extends StatefulWidget {
|
||||||
});
|
});
|
||||||
|
|
||||||
final LoginOptions options;
|
final LoginOptions options;
|
||||||
final void Function(String email)? onForgotPassword;
|
final void Function(String email, BuildContext ctx)? onForgotPassword;
|
||||||
final FutureOr<void> Function(String email, String password)? onRegister;
|
final FutureOr<void> Function(
|
||||||
|
String email,
|
||||||
|
String password,
|
||||||
|
BuildContext context,
|
||||||
|
)? onRegister;
|
||||||
final FutureOr<void> Function(String email, String password) onLogin;
|
final FutureOr<void> Function(String email, String password) onLogin;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -181,7 +185,8 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
|
||||||
child: options.forgotPasswordButtonBuilder(
|
child: options.forgotPasswordButtonBuilder(
|
||||||
context,
|
context,
|
||||||
() {
|
() {
|
||||||
widget.onForgotPassword?.call(_currentEmail);
|
widget.onForgotPassword
|
||||||
|
?.call(_currentEmail, context);
|
||||||
},
|
},
|
||||||
false,
|
false,
|
||||||
() {},
|
() {},
|
||||||
|
@ -211,6 +216,7 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
|
||||||
widget.onRegister?.call(
|
widget.onRegister?.call(
|
||||||
_currentEmail,
|
_currentEmail,
|
||||||
_currentPassword,
|
_currentPassword,
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
false,
|
false,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: flutter_login
|
name: flutter_login
|
||||||
description: Flutter Login Component
|
description: Flutter Login Component
|
||||||
version: 5.1.3
|
version: 5.1.4
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.18.1 <3.0.0"
|
sdk: ">=2.18.1 <3.0.0"
|
||||||
|
|
Loading…
Reference in a new issue