Skip to content

Commit

Permalink
minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
felangel committed Jul 26, 2024
1 parent 3486c54 commit fda9c2a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 25 deletions.
2 changes: 1 addition & 1 deletion examples/flutter_login/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
8 changes: 4 additions & 4 deletions examples/flutter_login/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
331C8080294A63A400263BE5 = {
Expand Down Expand Up @@ -344,7 +344,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -471,7 +471,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -520,7 +520,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
5 changes: 1 addition & 4 deletions examples/flutter_login/lib/home/view/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ class HomePage extends StatelessWidget {
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
_UserId(),
_LogoutButton(),
],
children: [_UserId(), _LogoutButton()],
),
),
);
Expand Down
28 changes: 13 additions & 15 deletions examples/flutter_login/lib/login/view/login_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,18 @@ class LoginForm extends StatelessWidget {
class _UsernameInput extends StatelessWidget {
@override
Widget build(BuildContext context) {
final usernameDisplayError = context.select(
final displayError = context.select(
(LoginBloc bloc) => bloc.state.username.displayError,
);

return TextField(
key: const Key('loginForm_usernameInput_textField'),
onChanged: (username) =>
context.read<LoginBloc>().add(LoginUsernameChanged(username)),
onChanged: (username) {
context.read<LoginBloc>().add(LoginUsernameChanged(username));
},
decoration: InputDecoration(
labelText: 'username',
errorText: usernameDisplayError != null ? 'invalid username' : null,
errorText: displayError != null ? 'invalid username' : null,
),
);
}
Expand All @@ -57,18 +58,19 @@ class _UsernameInput extends StatelessWidget {
class _PasswordInput extends StatelessWidget {
@override
Widget build(BuildContext context) {
final passwordDisplayError = context.select(
final displayError = context.select(
(LoginBloc bloc) => bloc.state.password.displayError,
);

return TextField(
key: const Key('loginForm_passwordInput_textField'),
onChanged: (password) =>
context.read<LoginBloc>().add(LoginPasswordChanged(password)),
onChanged: (password) {
context.read<LoginBloc>().add(LoginPasswordChanged(password));
},
obscureText: true,
decoration: InputDecoration(
labelText: 'password',
errorText: passwordDisplayError != null ? 'invalid password' : null,
errorText: displayError != null ? 'invalid password' : null,
),
);
}
Expand All @@ -81,18 +83,14 @@ class _LoginButton extends StatelessWidget {
(LoginBloc bloc) => bloc.state.status.isInProgress,
);

final isValid = context.select(
(LoginBloc bloc) => bloc.state.isValid,
);

if (isInProgress) return const CircularProgressIndicator();

final isValid = context.select((LoginBloc bloc) => bloc.state.isValid);

return ElevatedButton(
key: const Key('loginForm_continue_raisedButton'),
onPressed: isValid
? () {
context.read<LoginBloc>().add(const LoginSubmitted());
}
? () => context.read<LoginBloc>().add(const LoginSubmitted())
: null,
child: const Text('Login'),
);
Expand Down

0 comments on commit fda9c2a

Please sign in to comment.