Skip to content

Commit

Permalink
Const from sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
vik4114 committed Apr 21, 2022
1 parent d176245 commit c8bfdeb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/smooth_app/lib/helpers/user_management_helper.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/widgets.dart';
import 'package:openfoodfacts/openfoodfacts.dart';

class UserManagementHelper {
UserManagementHelper._();
Expand All @@ -21,7 +22,7 @@ class UserManagementHelper {
username.isNotEmpty && _userRegex.hasMatch(username);

static bool isUsernameLengthValid(final String username) =>
username.length <= 20;
username.length <= OpenFoodAPIClient.USER_NAME_MAX_LENGTH;

static bool isPasswordValid(final String password) => password.length >= 6;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ class _SignUpPageState extends State<SignUpPage> {
}
if (!UserManagementHelper.isUsernameLengthValid(
_userController.trimmedText)) {
return 'Username must be less than 20 characters'; // TODO(vik4114): localization
const int maxLength = OpenFoodAPIClient.USER_NAME_MAX_LENGTH;
return 'Username must be less than $maxLength characters'; // TODO(vik4114): localization and translation
}
return null;
},
Expand Down

0 comments on commit c8bfdeb

Please sign in to comment.