Skip to content

Commit 960dfa3

Browse files
committed
Homepage: Add text for no projects
1 parent 1145210 commit 960dfa3

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lib/homepage.dart

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,12 +285,20 @@ class _HomePageState extends State<HomePage> {
285285
RecentProjectsManager.instance.projects.sort((CCSolution a, CCSolution b) {
286286
return b.dateModified.compareTo(a.dateModified);
287287
});
288+
if (RecentProjectsManager.instance.projects.isEmpty) {
289+
projectsWidgets.add(
290+
const Text(
291+
'No recent projects found. Create one using the button below!',
292+
)
293+
);
294+
}
295+
else {
288296
for (CCSolution p in RecentProjectsManager.instance.projects) {
289297
if (p.name == "") {
290298
continue;
291299
} // TODO: add better way to check if project is corrupt
292300
//debugPrint(p.name);
293-
projectsWidgets.add(Card(
301+
projectsWidgets.add(Card( //TODO: refactor this as a widget elsewhere, then reference that widget from here
294302
child: ListTile(
295303
onTap: () {
296304
touchFile(File(p.slnPath), p);
@@ -387,6 +395,8 @@ class _HomePageState extends State<HomePage> {
387395
// icon: const Icon(FontAwesomeIcons.ellipsisV),
388396
// )));
389397
}
398+
399+
}
390400
});
391401
}
392402

@@ -439,7 +449,7 @@ class _HomePageState extends State<HomePage> {
439449
body: SingleChildScrollView(child: page),
440450
floatingActionButton: FloatingActionButton(
441451
onPressed: () => showCreateProjectDialog(),
442-
child: const Icon(Icons.create_new_folder)
452+
child: const Icon(Icons.create_new_folder),
443453
)
444454
);
445455
}

0 commit comments

Comments
 (0)