|
1 | 1 | import 'dart:io'; |
| 2 | +import 'package:corecoder_develop/screens/homepage/homepage_project_wizard.dart'; |
2 | 3 | import 'package:corecoder_develop/util/cc_project_structure.dart'; |
3 | 4 | import 'package:corecoder_develop/util/modules_manager.dart'; |
4 | 5 | import 'package:corecoder_develop/util/theme_manager.dart'; |
@@ -42,86 +43,7 @@ class HomePageProjectCreate extends StatelessWidget { |
42 | 43 | subtitle: Text(t.desc), |
43 | 44 | tileColor: ThemeManager.getThemeData().backgroundColor, |
44 | 45 | onTap: () async { |
45 | | - /// The options changed later after the window closed |
46 | | - Map<String, dynamic> values = {}; |
47 | | - await showDialog<int>( |
48 | | - context: context, |
49 | | - builder: (BuildContext context) { |
50 | | - List<Widget> controls = List.empty(growable: true); |
51 | | - |
52 | | - /// Add Options |
53 | | - for (var argName in t.options.keys) { |
54 | | - controls.add(Row(children: [ |
55 | | - const Icon(Icons.subdirectory_arrow_right_outlined), |
56 | | - Text( |
57 | | - argName, |
58 | | - textAlign: TextAlign.start, |
59 | | - ) |
60 | | - ])); |
61 | | - var optionVal = (t.options[argName] ?? ""); |
62 | | - if (optionVal.startsWith("String")) { |
63 | | - var splt = optionVal.split("|"); |
64 | | - var hint = splt.length > 1? splt[1] : argName; |
65 | | - controls.add(Padding( |
66 | | - padding: const EdgeInsets.only(bottom: 16.0), |
67 | | - child: TextField( |
68 | | - decoration: InputDecoration(hintText: hint), |
69 | | - maxLines: 1, |
70 | | - autofocus: true, |
71 | | - onChanged: (change) { |
72 | | - values[argName] = change; |
73 | | - }))); |
74 | | - values[argName] = ""; |
75 | | - } |
76 | | - } |
77 | | - |
78 | | - /// Add Buttons |
79 | | - var row = Row( |
80 | | - mainAxisAlignment: MainAxisAlignment.end, |
81 | | - children: [ |
82 | | - TextButton( |
83 | | - child: const Text("Cancel"), |
84 | | - onPressed: () { |
85 | | - Navigator.pop(context, 1); |
86 | | - }, |
87 | | - ), |
88 | | - ElevatedButton( |
89 | | - child: const Text("Create"), |
90 | | - onPressed: () async { |
91 | | - /// Go Ahead and create project asynchronously |
92 | | - var slnPath = await t.onCreated( |
93 | | - values); //TODO: This is prone to error (not checking if the file existed first) |
94 | | - if (slnPath == null) return; |
95 | | - |
96 | | - /// Add it to recent projects |
97 | | - CCSolution? project = await RecentProjectsManager |
98 | | - .instance |
99 | | - .addSolution(slnPath); |
100 | | - if (project != null) { |
101 | | - await RecentProjectsManager.instance.commit(_pref); |
102 | | - Navigator.pop(context, 3); |
103 | | - refreshProjects(); |
104 | | - loadSolution(project, context); |
105 | | - } |
106 | | - }, |
107 | | - ) |
108 | | - ], |
109 | | - ); |
110 | | - controls.add(row); |
111 | | - // Return the dialog to be opened |
112 | | - return SimpleDialog( |
113 | | - title: Text('Create ${t.title}'), |
114 | | - children: <Widget>[ |
115 | | - Padding( |
116 | | - padding: const EdgeInsets.symmetric(horizontal: 16.0), |
117 | | - child: Column( |
118 | | - children: controls, |
119 | | - crossAxisAlignment: CrossAxisAlignment.stretch, |
120 | | - )) |
121 | | - ], |
122 | | - ); |
123 | | - }, |
124 | | - barrierDismissible: true); |
| 46 | + Navigator.push(context, MaterialPageRoute(builder: (BuildContext context) => ProjectWizard(t,refreshProjects))); |
125 | 47 | }, |
126 | 48 | ))); |
127 | 49 | } |
|
0 commit comments