- Created generated_plugin_registrant.cc and generated_plugin_registrant.h to manage plugin registration. - Added generated_plugins.cmake for plugin configuration in CMake. - Implemented CMakeLists.txt for the Windows runner, defining build settings and dependencies. - Created Runner.rc for application resources including versioning and icons. - Developed flutter_window.cpp and flutter_window.h to manage the Flutter window lifecycle. - Implemented main.cpp as the entry point for the Windows application. - Added resource.h for resource definitions. - Included app icon in resources. - Created runner.exe.manifest for application settings. - Developed utils.cpp and utils.h for console management and command line argument handling. - Implemented win32_window.cpp and win32_window.h for high DPI-aware window management.
79 lines
2.0 KiB
Dart
79 lines
2.0 KiB
Dart
import 'package:marco/helpers/utils/my_string_utils.dart';
|
|
import 'package:marco/helpers/widgets/my_field_validator.dart';
|
|
|
|
class MyEmailValidator extends MyFieldValidatorRule<String> {
|
|
@override
|
|
String? validate(String? value, bool required, Map<String, dynamic> data) {
|
|
if (!required) {
|
|
if (value == null) {
|
|
return null;
|
|
}
|
|
} else if (value != null &&
|
|
value.isNotEmpty &&
|
|
!MyStringUtils.isEmail(value)) {
|
|
return "Please enter valid email";
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
|
|
class MyLengthValidator implements MyFieldValidatorRule<String> {
|
|
final bool short, required;
|
|
final int? min, max, exact;
|
|
|
|
MyLengthValidator(
|
|
{this.required = true,
|
|
this.exact,
|
|
this.min,
|
|
this.max,
|
|
this.short = false});
|
|
|
|
@override
|
|
String? validate(String? value, bool required, Map<String, dynamic> data) {
|
|
if (value != null) {
|
|
if (!required && value.isEmpty) {
|
|
return null;
|
|
}
|
|
if (exact != null && value.length != exact!) {
|
|
return short
|
|
? "Need $exact characters"
|
|
: "Need exact $exact characters";
|
|
}
|
|
if (min != null && value.length < min!) {
|
|
return short ? "Need $min characters" : "Longer than $min characters";
|
|
}
|
|
if (max != null && value.length > max!) {
|
|
return short ? "Only $max characters" : "Lesser than $max characters";
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
|
|
class MyNameValidator implements MyFieldValidatorRule<String> {
|
|
final bool required;
|
|
final int? min, max;
|
|
|
|
MyNameValidator({
|
|
this.required = true,
|
|
this.min,
|
|
this.max,
|
|
});
|
|
|
|
@override
|
|
String? validate(String? value, bool required, Map<String, dynamic> data) {
|
|
if (value != null) {
|
|
if (!required && value.isEmpty) {
|
|
return null;
|
|
}
|
|
if (min != null && value.length < min!) {
|
|
return "Name should be at least $min characters long";
|
|
}
|
|
if (max != null && value.length > max!) {
|
|
return "Name should be at most $max characters long";
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
}
|