@@ -4,6 +4,7 @@ import 'package:corecoder_develop/screens/settings/plugins_browser.dart';
44import 'package:corecoder_develop/screens/settings/settings.dart' ;
55import 'package:corecoder_develop/util/cc_project_structure.dart' ;
66import 'package:corecoder_develop/util/desktop_tabbar.dart' ;
7+ import 'package:corecoder_develop/util/theme_manager.dart' ;
78import 'package:flutter/material.dart' ;
89
910import '../editor/editor.dart' ;
@@ -271,105 +272,107 @@ class _HomePageState extends State<HomePage> {
271272 builder: (BuildContext context) {
272273 List <Widget > options = List .empty (growable: true );
273274 for (Module m in ModulesManager .modules) {
274- options.add (Text (
275- m.name,
276- style: const TextStyle (fontSize: 21 ),
277- ));
275+ options.add (
276+ Padding (
277+ padding: const EdgeInsets .fromLTRB (5 , 5 , 5 , 5 ),
278+ child: Text (m.name,
279+ style: const TextStyle (fontSize: 18 , fontWeight: FontWeight .bold))
280+ )
281+ );
278282 for (Template t in m.templates) {
279283 /// -------------------------------------------------
280284 /// Project Options
281285 /// -------------------------------------------------
282- options.add (ListTile (
283- leading: t.icon,
284- trailing: Text (t.version),
285- title: Text (t.title),
286- subtitle: Text (t.desc),
287- onTap: () async {
288- /// The options changed later after the window closed
289- Map <String , dynamic > values = {};
290- await showDialog <int >(
291- context: context,
292- builder: (BuildContext context) {
293- List <Widget > controls = List .empty (growable: true );
294-
295- /// Add Options
296- for (var argName in t.options.keys) {
297- controls.add (Text (
298- argName,
299- textAlign: TextAlign .end,
300- ));
301- if (t.options[argName] == "String" ) {
302- controls.add (TextField (
303- maxLines: 1 ,
304- autofocus: true ,
305- onChanged: (change) {
306- values[argName] = change;
307- }));
308- values[argName] = "" ;
309- }
310- }
311-
312- /// Add Buttons
313- var row = Row (
314- children: [
315- TextButton (
316- child: const Text ("Cancel" ),
317- onPressed: () {
318- Navigator .pop (context, 1 );
319- },
320- ),
321- TextButton (
322- child: const Text ("Create" ),
323- onPressed: () async {
324- /// Go Ahead and create project asynchronously
325- var slnPath = await t.onCreated (
326- values); //TODO: This is prone to error (not checking if the file existed first)
327- if (slnPath == null ) return ;
328-
329- /// Add it to recent projects
330- CCSolution ? project =
331- await RecentProjectsManager .instance
332- .addSolution (slnPath);
333- if (project != null ) {
334- await RecentProjectsManager .instance
335- .commit (_pref);
336- Navigator .pop (context, 3 );
337- refreshRecentProjects ();
338- loadSolution (project, context);
339- }
340- },
341- )
342- ],
343- );
344- controls.add (row);
345- // Return the dialog to be opened
346- return SimpleDialog (
347- title: Text ('Create ${t .title }' ),
348- children: < Widget > [
349- Padding (
350- padding:
351- const EdgeInsets .symmetric (horizontal: 8.0 ),
352- child: Column (children: controls))
353- ],
354- );
355- },
356- barrierDismissible: true );
357- },
358- ));
286+ options.add (
287+ Card (
288+ child: ListTile (
289+ leading: t.icon,
290+ title: Text (t.title),
291+ subtitle: Text (t.desc),
292+ tileColor: ThemeManager .getThemeData ().backgroundColor,
293+ onTap: () async {
294+ /// The options changed later after the window closed
295+ Map <String , dynamic > values = {};
296+ await showDialog <int >(
297+ context: context,
298+ builder: (BuildContext context) {
299+ List <Widget > controls = List .empty (growable: true );
300+
301+ /// Add Options
302+ for (var argName in t.options.keys) {
303+ controls.add (Text (
304+ argName,
305+ textAlign: TextAlign .end,
306+ ));
307+ if (t.options[argName] == "String" ) {
308+ controls.add (TextField (
309+ maxLines: 1 ,
310+ autofocus: true ,
311+ onChanged: (change) {
312+ values[argName] = change;
313+ }));
314+ values[argName] = "" ;
315+ }
316+ }
317+
318+ /// Add Buttons
319+ var row = Row (
320+ children: [
321+ TextButton (
322+ child: const Text ("Cancel" ),
323+ onPressed: () {
324+ Navigator .pop (context, 1 );
325+ },
326+ ),
327+ TextButton (
328+ child: const Text ("Create" ),
329+ onPressed: () async {
330+ /// Go Ahead and create project asynchronously
331+ var slnPath = await t.onCreated (
332+ values); //TODO: This is prone to error (not checking if the file existed first)
333+ if (slnPath == null ) return ;
334+
335+ /// Add it to recent projects
336+ CCSolution ? project =
337+ await RecentProjectsManager .instance
338+ .addSolution (slnPath);
339+ if (project != null ) {
340+ await RecentProjectsManager .instance
341+ .commit (_pref);
342+ Navigator .pop (context, 3 );
343+ refreshRecentProjects ();
344+ loadSolution (project, context);
345+ }
346+ },
347+ )
348+ ],
349+ );
350+ controls.add (row);
351+ // Return the dialog to be opened
352+ return SimpleDialog (
353+ title: Text ('Create ${t .title }' ),
354+ children: < Widget > [
355+ Padding (
356+ padding:
357+ const EdgeInsets .symmetric (horizontal: 8.0 ),
358+ child: Column (children: controls))
359+ ],
360+ );
361+ },
362+ barrierDismissible: true );
363+ },
364+ )
365+ )
366+ );
359367 }
360368 }
361369 return SimpleDialog (
362- title: const Text ('Create new project' ),
370+ title: const Center (child : Text ('Create new project' ) ),
363371 children: options,
372+ contentPadding: const EdgeInsets .fromLTRB (5 , 5 , 5 , 5 ),
373+ backgroundColor: ThemeManager .getThemeData ().canvasColor,
364374 );
365375 })) {
366- case 0 :
367- // Let's go.
368- // ...
369- break ;
370- case 1 :
371- // ...
372- break ;
373376 case null :
374377 // dialog dismissed
375378 break ;
0 commit comments