mirror of
https://github.com/Iconica-Development/flutter_login_widget.git
synced 2025-05-18 21:23:44 +02:00
feat: expanded translations
This commit is contained in:
parent
098feec337
commit
bc39a1ebfa
8 changed files with 28 additions and 42 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -19,7 +19,7 @@ migrate_working_dir/
|
|||
# The .vscode folder contains launch configuration and tasks you configure in
|
||||
# VS Code which you may wish to be included in version control, so this line
|
||||
# is commented out by default.
|
||||
#.vscode/
|
||||
.vscode/
|
||||
|
||||
# Flutter/Dart/Pub related
|
||||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
## 2.0.2
|
||||
* Added more translatable options
|
||||
|
||||
## 2.0.1
|
||||
|
||||
* Fixed email regex
|
||||
|
|
|
@ -16,6 +16,7 @@ final loginOptions = LoginOptions(
|
|||
onPressed,
|
||||
isDisabled,
|
||||
onDisabledPress,
|
||||
translations,
|
||||
) {
|
||||
return Opacity(
|
||||
opacity: isDisabled ? 0.5 : 1.0,
|
||||
|
|
|
@ -61,7 +61,7 @@ packages:
|
|||
path: ".."
|
||||
relative: true
|
||||
source: path
|
||||
version: "2.0.1"
|
||||
version: "2.0.2"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
|
|
|
@ -60,11 +60,19 @@ class LoginTranslations {
|
|||
this.emailEmpty = 'Email is required',
|
||||
this.passwordEmpty = 'Password is required',
|
||||
this.emailInvalid = 'Enter a valid email address',
|
||||
this.loginButton = 'Login',
|
||||
this.forgotPasswordButton = 'Forgot password?',
|
||||
this.requestForgotPasswordButton = 'Send request',
|
||||
this.registrationButton = 'Create Account',
|
||||
});
|
||||
|
||||
final String emailInvalid;
|
||||
final String emailEmpty;
|
||||
final String passwordEmpty;
|
||||
final String loginButton;
|
||||
final String forgotPasswordButton;
|
||||
final String requestForgotPasswordButton;
|
||||
final String registrationButton;
|
||||
}
|
||||
|
||||
Widget _createEmailInputContainer(Widget child) => child;
|
||||
|
@ -76,12 +84,13 @@ Widget _createLoginButton(
|
|||
OptionalAsyncCallback onPressed,
|
||||
bool disabled,
|
||||
OptionalAsyncCallback onDisabledPress,
|
||||
LoginTranslations translations,
|
||||
) {
|
||||
return Opacity(
|
||||
opacity: disabled ? 0.5 : 1.0,
|
||||
child: ElevatedButton(
|
||||
onPressed: !disabled ? onPressed : onDisabledPress,
|
||||
child: const Text('Login'),
|
||||
child: Text(translations.loginButton),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -91,12 +100,13 @@ Widget _createForgotPasswordButton(
|
|||
OptionalAsyncCallback onPressed,
|
||||
bool disabled,
|
||||
OptionalAsyncCallback onDisabledPress,
|
||||
LoginTranslations translations,
|
||||
) {
|
||||
return Opacity(
|
||||
opacity: disabled ? 0.5 : 1.0,
|
||||
child: ElevatedButton(
|
||||
onPressed: !disabled ? onPressed : onDisabledPress,
|
||||
child: const Text('Forgot password?'),
|
||||
child: Text(translations.forgotPasswordButton),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -106,12 +116,13 @@ Widget _createRequestForgotPasswordButton(
|
|||
OptionalAsyncCallback onPressed,
|
||||
bool disabled,
|
||||
OptionalAsyncCallback onDisabledPress,
|
||||
LoginTranslations translations,
|
||||
) {
|
||||
return Opacity(
|
||||
opacity: disabled ? 0.5 : 1.0,
|
||||
child: ElevatedButton(
|
||||
onPressed: !disabled ? onPressed : onDisabledPress,
|
||||
child: const Text('Send request'),
|
||||
child: Text(translations.requestForgotPasswordButton),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -121,12 +132,13 @@ Widget _createRegisterButton(
|
|||
OptionalAsyncCallback onPressed,
|
||||
bool disabled,
|
||||
OptionalAsyncCallback onDisabledPress,
|
||||
LoginTranslations translations,
|
||||
) {
|
||||
return Opacity(
|
||||
opacity: disabled ? 0.5 : 1.0,
|
||||
child: ElevatedButton(
|
||||
onPressed: !disabled ? onPressed : onDisabledPress,
|
||||
child: const Text('Create Account'),
|
||||
child: Text(translations.registrationButton),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -136,6 +148,7 @@ typedef ButtonBuilder = Widget Function(
|
|||
OptionalAsyncCallback onPressed,
|
||||
bool isDisabled,
|
||||
OptionalAsyncCallback onDisabledPress,
|
||||
LoginTranslations options,
|
||||
);
|
||||
|
||||
typedef InputContainerBuilder = Widget Function(
|
||||
|
|
|
@ -162,6 +162,7 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
|
|||
},
|
||||
false,
|
||||
() {},
|
||||
options.translations,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -176,6 +177,7 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
|
|||
() {
|
||||
_formKey.currentState?.validate();
|
||||
},
|
||||
options.translations,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
@ -190,6 +192,7 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
|
|||
},
|
||||
false,
|
||||
() {},
|
||||
options.translations,
|
||||
),
|
||||
]
|
||||
],
|
||||
|
|
|
@ -133,6 +133,7 @@ class _ForgotPasswordFormState extends State<ForgotPasswordForm> {
|
|||
() {
|
||||
_formKey.currentState?.validate();
|
||||
},
|
||||
options.translations,
|
||||
),
|
||||
);
|
||||
},
|
||||
|
|
37
pubspec.yaml
37
pubspec.yaml
|
@ -1,6 +1,6 @@
|
|||
name: flutter_login
|
||||
description: A new Flutter package project.
|
||||
version: 2.0.1
|
||||
version: 2.0.2
|
||||
|
||||
environment:
|
||||
sdk: ">=2.18.1 <3.0.0"
|
||||
|
@ -15,39 +15,4 @@ dev_dependencies:
|
|||
sdk: flutter
|
||||
flutter_lints: ^2.0.0
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
# The following section is specific to Flutter packages.
|
||||
flutter:
|
||||
|
||||
# To add assets to your package, add an assets section, like this:
|
||||
# assets:
|
||||
# - images/a_dot_burr.jpeg
|
||||
# - images/a_dot_ham.jpeg
|
||||
#
|
||||
# For details regarding assets in packages, see
|
||||
# https://flutter.dev/assets-and-images/#from-packages
|
||||
#
|
||||
# An image asset can refer to one or more resolution-specific "variants", see
|
||||
# https://flutter.dev/assets-and-images/#resolution-aware
|
||||
|
||||
# To add custom fonts to your package, add a fonts section here,
|
||||
# in this "flutter" section. Each entry in this list should have a
|
||||
# "family" key with the font family name, and a "fonts" key with a
|
||||
# list giving the asset and other descriptors for the font. For
|
||||
# example:
|
||||
# fonts:
|
||||
# - family: Schyler
|
||||
# fonts:
|
||||
# - asset: fonts/Schyler-Regular.ttf
|
||||
# - asset: fonts/Schyler-Italic.ttf
|
||||
# style: italic
|
||||
# - family: Trajan Pro
|
||||
# fonts:
|
||||
# - asset: fonts/TrajanPro.ttf
|
||||
# - asset: fonts/TrajanPro_Bold.ttf
|
||||
# weight: 700
|
||||
#
|
||||
# For details regarding fonts in packages, see
|
||||
# https://flutter.dev/custom-fonts/#from-packages
|
||||
|
|
Loading…
Reference in a new issue