@@ -318,58 +318,6 @@ final Map<Type, BaseController> controllers = {$match
318318 );
319319 }
320320
321- /// Adds a Theme to your config/theme.dart file.
322- static Future <void > addToTheme (String className) async {
323- String name = className.replaceAll (RegExp (r'(_?theme)' ), "" );
324- ReCase nameReCase = ReCase (name);
325-
326- String classesToAdd =
327- """import '/resources/themes/styles/${nameReCase .snakeCase }_theme_colors.dart';
328- import '/resources/themes/${nameReCase .snakeCase }_theme.dart';""" ;
329-
330- String template =
331- """BaseThemeConfig<ColorStyles>(
332- id: '${nameReCase .snakeCase }_theme',
333- description: "${nameReCase .titleCase } theme",
334- theme: ${nameReCase .paramCase }Theme,
335- colors: ${nameReCase .pascalCase }ThemeColors(),
336- ),""" ;
337-
338- String filePath = "lib/config/theme.dart" ;
339- String originalFile = await loadAsset (filePath);
340-
341- // create new file
342- if (originalFile.contains (template)) {
343- return ;
344- }
345-
346- RegExp reg = RegExp (
347- r'final List<BaseThemeConfig<ColorStyles>> appThemes = \[([^}]*)\];' ,
348- );
349- final match = _getFirstRegexMatch (reg, originalFile);
350- if (match == null ) {
351- return ;
352- }
353-
354- String temp =
355- """final List<BaseThemeConfig<ColorStyles>> appThemes = [$match $template
356- ];""" ;
357-
358- String newFile = originalFile.replaceFirst (
359- RegExp (
360- r'final List<BaseThemeConfig<ColorStyles>> appThemes = \[([^}]*)\];' ,
361- ),
362- temp,
363- );
364-
365- // Add import
366- newFile = "$classesToAdd \n $newFile " ;
367-
368- // save new file
369- final File file = File (filePath);
370- await file.writeAsString (newFile);
371- }
372-
373321 /// Runs a process
374322 static Future <int > runProcess (String command) async {
375323 List <String > commands = command.split (" " );
@@ -772,30 +720,6 @@ final Map<Type, dynamic> modelDecoders = {$match
772720 );
773721 }
774722
775- /// Creates a new Theme.
776- static Future <void > makeTheme (
777- String className,
778- String value, {
779- String folderPath = themesFolder,
780- bool forceCreate = false ,
781- }) async {
782- String name = className.replaceAll (RegExp (r'(_?theme)' ), "" );
783-
784- String filePath = '$folderPath /${name .snakeCase }_theme.dart' ;
785-
786- await _makeDirectory (folderPath);
787- await _checkIfFileExists (filePath, shouldForceCreate: forceCreate);
788- await _createNewFile (
789- filePath,
790- value,
791- onSuccess: () {
792- final linkText = '${name .snakeCase }_theme' ;
793- final link = MetroConsole .hyperlink (linkText, filePath);
794- MetroConsole .writeInGreen ('[Theme] $link created 🎉' );
795- },
796- );
797- }
798-
799723 /// Creates a new Provider.
800724 static Future <void > makeProvider (
801725 String className,
@@ -1063,29 +987,6 @@ final Map<Type, NyApiService> apiDecoders = {$match
1063987 );
1064988 }
1065989
1066- /// Creates a new Theme Colors file.
1067- static Future <void > makeThemeColors (
1068- String className,
1069- String value, {
1070- String folderPath = themeColorsFolder,
1071- bool forceCreate = false ,
1072- }) async {
1073- String filePath =
1074- '$folderPath /${className .toLowerCase ()}_theme_colors.dart' ;
1075-
1076- await _makeDirectory (folderPath);
1077- await _checkIfFileExists (filePath, shouldForceCreate: forceCreate);
1078- await _createNewFile (
1079- filePath,
1080- value,
1081- onSuccess: () {
1082- final linkText = '${className .toLowerCase ()}_theme_colors' ;
1083- final link = MetroConsole .hyperlink (linkText, filePath);
1084- MetroConsole .writeInGreen ('[Theme Colors] $link created 🎉' );
1085- },
1086- );
1087- }
1088-
1089990 /// Check if a file exist by passing in a [path] .
1090991 static Future <bool > hasFile (String path) async => await File (path).exists ();
1091992
@@ -1245,18 +1146,6 @@ final Map<Type, NyApiService> apiDecoders = {$match
12451146 );
12461147 break ;
12471148 }
1248- case themesFolder:
1249- {
1250- if (templateName.contains ("_theme" )) {
1251- templateName = templateName.replaceAll ("_theme" , "" );
1252- }
1253- await makeTheme (
1254- templateName,
1255- template.stub,
1256- forceCreate: (hasForceFlag ?? false ),
1257- );
1258- break ;
1259- }
12601149 case providerFolder:
12611150 {
12621151 if (templateName.contains ("_provider" )) {
@@ -1296,18 +1185,6 @@ final Map<Type, NyApiService> apiDecoders = {$match
12961185 );
12971186 break ;
12981187 }
1299- case themeColorsFolder:
1300- {
1301- if (templateName.contains ("_theme_colors" )) {
1302- templateName = templateName.replaceAll ("_theme_colors" , "" );
1303- }
1304- await makeThemeColors (
1305- templateName,
1306- template.stub,
1307- forceCreate: (hasForceFlag ?? false ),
1308- );
1309- break ;
1310- }
13111188 case formsFolder:
13121189 {
13131190 if (templateName.contains ("_form" )) {
0 commit comments