mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-17 22:14:28 +01:00
Integrate UriUtility in LeaderboardSubmissionDialog for URL Validation
This commit integrates the newly created UriUtility class into the LeaderboardSubmissionDialog. The isURL method from UriUtility is used to add an additional layer of validation for the GitHub repository URL input field. It ensures that users enter a valid URL format before submitting their leaderboard entries. Changes made: - Integrated UriUtility’s isURL method in the _validateAndSubmit function of the LeaderboardSubmissionDialog. - Added a specific error message "Invalid URL format" to inform users when the entered URL does not meet the validation criteria. - Updated the state management to reflect the URL validation status and re-render the dialog with appropriate error messages when necessary. With this integration, the application now provides real-time feedback on the validity of the entered URL, enhancing user experience and data integrity by ensuring that only valid URLs are submitted to the leaderboard.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:auto_gpt_flutter_client/constants/app_colors.dart';
|
||||
import 'package:auto_gpt_flutter_client/utils/uri_utility.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
@@ -56,6 +57,9 @@ class _LeaderboardSubmissionDialogState
|
||||
if (_repoUrlController.text.isEmpty) {
|
||||
isValid = false;
|
||||
_repoUrlError = 'Repo URL is required';
|
||||
} else if (!UriUtility.isURL(_repoUrlController.text)) {
|
||||
isValid = false;
|
||||
_repoUrlError = 'Invalid URL format';
|
||||
} else {
|
||||
_repoUrlError = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user