fix: change to options instead of translations

This commit is contained in:
Freek van de Ven 2022-11-08 09:56:05 +01:00
parent afe9b299ff
commit 34ba6cffa2
6 changed files with 17 additions and 17 deletions

View file

@ -1,5 +1,5 @@
## 2.0.2 ## 3.0.0
* Added more translatable options * Added login options to loginbuilders for more customization
## 2.0.1 ## 2.0.1

View file

@ -61,7 +61,7 @@ packages:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "2.0.2" version: "3.0.0"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter

View file

@ -84,13 +84,13 @@ Widget _createLoginButton(
OptionalAsyncCallback onPressed, OptionalAsyncCallback onPressed,
bool disabled, bool disabled,
OptionalAsyncCallback onDisabledPress, OptionalAsyncCallback onDisabledPress,
LoginTranslations translations, LoginOptions options,
) { ) {
return Opacity( return Opacity(
opacity: disabled ? 0.5 : 1.0, opacity: disabled ? 0.5 : 1.0,
child: ElevatedButton( child: ElevatedButton(
onPressed: !disabled ? onPressed : onDisabledPress, onPressed: !disabled ? onPressed : onDisabledPress,
child: Text(translations.loginButton), child: Text(options.translations.loginButton),
), ),
); );
} }
@ -100,13 +100,13 @@ Widget _createForgotPasswordButton(
OptionalAsyncCallback onPressed, OptionalAsyncCallback onPressed,
bool disabled, bool disabled,
OptionalAsyncCallback onDisabledPress, OptionalAsyncCallback onDisabledPress,
LoginTranslations translations, LoginOptions options,
) { ) {
return Opacity( return Opacity(
opacity: disabled ? 0.5 : 1.0, opacity: disabled ? 0.5 : 1.0,
child: ElevatedButton( child: ElevatedButton(
onPressed: !disabled ? onPressed : onDisabledPress, onPressed: !disabled ? onPressed : onDisabledPress,
child: Text(translations.forgotPasswordButton), child: Text(options.translations.forgotPasswordButton),
), ),
); );
} }
@ -116,13 +116,13 @@ Widget _createRequestForgotPasswordButton(
OptionalAsyncCallback onPressed, OptionalAsyncCallback onPressed,
bool disabled, bool disabled,
OptionalAsyncCallback onDisabledPress, OptionalAsyncCallback onDisabledPress,
LoginTranslations translations, LoginOptions options,
) { ) {
return Opacity( return Opacity(
opacity: disabled ? 0.5 : 1.0, opacity: disabled ? 0.5 : 1.0,
child: ElevatedButton( child: ElevatedButton(
onPressed: !disabled ? onPressed : onDisabledPress, onPressed: !disabled ? onPressed : onDisabledPress,
child: Text(translations.requestForgotPasswordButton), child: Text(options.translations.requestForgotPasswordButton),
), ),
); );
} }
@ -132,13 +132,13 @@ Widget _createRegisterButton(
OptionalAsyncCallback onPressed, OptionalAsyncCallback onPressed,
bool disabled, bool disabled,
OptionalAsyncCallback onDisabledPress, OptionalAsyncCallback onDisabledPress,
LoginTranslations translations, LoginOptions options,
) { ) {
return Opacity( return Opacity(
opacity: disabled ? 0.5 : 1.0, opacity: disabled ? 0.5 : 1.0,
child: ElevatedButton( child: ElevatedButton(
onPressed: !disabled ? onPressed : onDisabledPress, onPressed: !disabled ? onPressed : onDisabledPress,
child: Text(translations.registrationButton), child: Text(options.translations.registrationButton),
), ),
); );
} }
@ -148,7 +148,7 @@ typedef ButtonBuilder = Widget Function(
OptionalAsyncCallback onPressed, OptionalAsyncCallback onPressed,
bool isDisabled, bool isDisabled,
OptionalAsyncCallback onDisabledPress, OptionalAsyncCallback onDisabledPress,
LoginTranslations options, LoginOptions options,
); );
typedef InputContainerBuilder = Widget Function( typedef InputContainerBuilder = Widget Function(

View file

@ -162,7 +162,7 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
}, },
false, false,
() {}, () {},
options.translations, options,
), ),
), ),
], ],
@ -177,7 +177,7 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
() { () {
_formKey.currentState?.validate(); _formKey.currentState?.validate();
}, },
options.translations, options,
); );
}, },
), ),
@ -192,7 +192,7 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
}, },
false, false,
() {}, () {},
options.translations, options,
), ),
] ]
], ],

View file

@ -133,7 +133,7 @@ class _ForgotPasswordFormState extends State<ForgotPasswordForm> {
() { () {
_formKey.currentState?.validate(); _formKey.currentState?.validate();
}, },
options.translations, options,
), ),
); );
}, },

View file

@ -1,6 +1,6 @@
name: flutter_login name: flutter_login
description: A new Flutter package project. description: A new Flutter package project.
version: 2.0.2 version: 3.0.0
environment: environment:
sdk: ">=2.18.1 <3.0.0" sdk: ">=2.18.1 <3.0.0"