addForm static method
Implementation
static void addForm({
List<String>? fields,
String? featureName,
String? formName,
}) {
if (featureName == null) {
stdout.write("${ColorsText.blue}Enter feature name: ${ColorsText.reset}");
featureName = stdin.readLineSync();
}
if (formName == null) {
stdout.write("${ColorsText.blue}Enter form name: ${ColorsText.reset}");
formName = stdin.readLineSync();
}
if (fields == null) {
stdout.write(
"${ColorsText.blue}Enter form fields (comma-separated): ${ColorsText.reset}");
fields = stdin.readLineSync()?.split(',');
}
CreatorUtil.createDirectory('$path/features/$featureName/forms');
CreatorUtil.createFileWithContent(
'$path/features/$featureName/forms/${formName}_form.dart',
formSample(formName ?? 'A', fields ?? []));
}