1-
21import 'dart:io' ;
32
43import 'package:corecoder_develop/settings.dart' ;
@@ -14,14 +13,14 @@ import 'package:permission_handler/permission_handler.dart';
1413import 'util/cc_project_structure.dart' ;
1514import 'package:corecoder_develop/util/modules_manager.dart'
1615 show Module, ModulesManager, Template;
16+ import 'package:font_awesome_flutter/font_awesome_flutter.dart' ;
1717void loadSolution (
1818 CCSolution solution, BuildContext context, ModulesManager modulesManager) {
1919 /// Load the project
2020 // var template = modulesManager.getTemplateByIdentifier(solution.identifier);
2121 Navigator .pushNamed (context, EditorPage .routeName, arguments: solution);
2222}
2323
24-
2524class RecentProjectsManager {
2625 List <CCSolution > projects = List .empty (growable: true );
2726
@@ -46,7 +45,6 @@ class RecentProjectsManager {
4645 }
4746}
4847
49-
5048class HomePage extends StatefulWidget {
5149 HomePage ({Key ? key}) : super (key: key);
5250
@@ -60,9 +58,10 @@ class _HomePageState extends State<HomePage> {
6058 final Future <SharedPreferences > _pref = SharedPreferences .getInstance ();
6159 var projectsWidgets = < Widget > [];
6260
63- void showSettings (){
61+ void showSettings () {
6462 Navigator .pushNamed (context, SettingsPage .routeName);
6563 }
64+
6665 Future <void > showCreateProjectDialog () async {
6766 /// -------------------------------------------------
6867 /// Template Selection
@@ -134,7 +133,7 @@ class _HomePageState extends State<HomePage> {
134133
135134 /// Add it to recent projects
136135 CCSolution ? project =
137- await rpm.addSolution (slnPath);
136+ await rpm.addSolution (slnPath);
138137 if (project != null ) {
139138 await rpm.commit (_pref);
140139 Navigator .pop (context, 3 );
@@ -162,7 +161,7 @@ class _HomePageState extends State<HomePage> {
162161 children: [
163162 Image (
164163 image:
165- ResizeImage .resizeIfNeeded (48 , 48 , t.icon.image)),
164+ ResizeImage .resizeIfNeeded (48 , 48 , t.icon.image)),
166165 Column (
167166 crossAxisAlignment: CrossAxisAlignment .start,
168167 children: [
@@ -190,14 +189,14 @@ class _HomePageState extends State<HomePage> {
190189 );
191190 })) {
192191 case 0 :
193- // Let's go.
194- // ...
192+ // Let's go.
193+ // ...
195194 break ;
196195 case 1 :
197- // ...
196+ // ...
198197 break ;
199198 case null :
200- // dialog dismissed
199+ // dialog dismissed
201200 break ;
202201 }
203202 }
@@ -245,21 +244,24 @@ class _HomePageState extends State<HomePage> {
245244 setState (() {
246245 projectsWidgets.clear ();
247246 for (CCSolution p in rpm.projects) {
248- if (p.name == "" ) continue ; // TODO: add better way to check if project is corrupt
247+ if (p.name == "" )
248+ continue ; // TODO: add better way to check if project is corrupt
249249 debugPrint (p.name);
250- projectsWidgets.add (Container (
251- constraints:
252- const BoxConstraints (minWidth: 128.0 , minHeight: 128.0 ),
253- padding: const EdgeInsets .all (4.0 ),
254- child: ElevatedButton (
255- onPressed: () {
256- loadSolution (p, context, mm);
257- },
258- child: Column (children: [
259- if (p.image != null )
260- Image (image: ResizeImage .resizeIfNeeded (48 , 48 , p.image! .image)),
261- Text (p.name)
262- ]))));
250+ projectsWidgets.add (ListTile (
251+ onTap: () {
252+ loadSolution (p, context, mm);
253+ },
254+ leading: p.image != null
255+ ? Image (image: ResizeImage .resizeIfNeeded (48 , 48 , p.image! .image))
256+ : const Icon (
257+ Icons .insert_drive_file,
258+ size: 48 ,
259+ ),
260+ title: Text (p.name),
261+ subtitle:
262+ Text (p.desc + " Last Modified: " + p.dateModified.toString ()),
263+ trailing: IconButton (onPressed: () { }, icon: const Icon (FontAwesomeIcons .ellipsisV),)
264+ ));
263265 }
264266 });
265267 }
@@ -268,21 +270,19 @@ class _HomePageState extends State<HomePage> {
268270 Widget build (BuildContext context) {
269271 final page = Center (
270272 child: Container (
271- padding: const EdgeInsets .all (16.0 ),
272- constraints: BoxConstraints (
273- minHeight: MediaQuery .of (context).size.height,
274- minWidth: double .infinity),
275- child: Column (crossAxisAlignment: CrossAxisAlignment .start, children: [
276- const Text (
277- "Recent Projects" ,
278- ),
279- Wrap (
280- children: projectsWidgets,
281- direction: Axis .horizontal,
282- alignment: WrapAlignment .start,
283- )
284- ]),
285- ));
273+ padding: const EdgeInsets .all (16.0 ),
274+ constraints: BoxConstraints (
275+ minHeight: MediaQuery .of (context).size.height,
276+ minWidth: double .infinity),
277+ child: Column (crossAxisAlignment: CrossAxisAlignment .stretch, children: [
278+ const Text (
279+ "Recent Projects" ,
280+ ),
281+ Column (
282+ children: projectsWidgets,
283+ )
284+ ]),
285+ ));
286286 return Scaffold (
287287 appBar: AppBar (
288288 title: const Text ("CoreCoder Develop" ),
0 commit comments