51 lines
1.1 KiB
Dart
51 lines
1.1 KiB
Dart
import 'package:konectar_events/utils/constants.dart';
|
|
|
|
class FieldValidation {
|
|
static String validateEmail(String email) {
|
|
if (email.isEmpty) {
|
|
return 'Please enter email';
|
|
} else if (!email.isValidEmail()) {
|
|
return 'Please enter valid email';
|
|
} else {
|
|
return '';
|
|
}
|
|
}
|
|
|
|
static String validateMeetingId(String meetingId) {
|
|
if (meetingId.isEmpty) {
|
|
return 'Please enter meeting id or url';
|
|
} else {
|
|
return '';
|
|
}
|
|
}
|
|
|
|
static String validateName(String name) {
|
|
if (name.isEmpty) {
|
|
return 'Please enter name';
|
|
} else {
|
|
return '';
|
|
}
|
|
}
|
|
|
|
static String validateSecretKey(String domain) {
|
|
if (domain.isEmpty) {
|
|
return 'Please enter secret key';
|
|
} else {
|
|
return '';
|
|
}
|
|
}
|
|
|
|
static String validateUrl(String url) {
|
|
if (url.isEmpty) {
|
|
return 'Please enter application url';
|
|
} else {
|
|
bool isURLValid = Uri.parse(url).host.isNotEmpty;
|
|
if (isURLValid) {
|
|
return '';
|
|
} else {
|
|
return 'Please enter valid application url';
|
|
}
|
|
}
|
|
}
|
|
}
|