- Created CMakeLists.txt for Flutter and runner components. - Implemented resource script (Runner.rc) for application metadata. - Developed main entry point (main.cpp) for the Windows application. - Added FlutterWindow class to manage the Flutter view within a Win32 window. - Implemented utility functions for console management and command line argument parsing. - Established Win32Window class for high DPI-aware window handling. - Included application icon and manifest for proper Windows integration. - Set up build configurations and dependencies for the Flutter application on Windows.
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;
|
|
}
|
|
}
|