From 783eef32e54c21d10626985910e1601da961c8f4 Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Fri, 15 Feb 2019 15:16:08 +0100 Subject: [PATCH] HomeScreen: Show some text when we have no journal entries Ideally, I would want something way prettier, but this is a good enough start. --- lib/screens/home_screen.dart | 39 +++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart index b88ee274..1d1fa060 100644 --- a/lib/screens/home_screen.dart +++ b/lib/screens/home_screen.dart @@ -20,18 +20,33 @@ class HomeScreen extends StatelessWidget { child: Icon(Icons.add), ); - var journalList = JournalList( - notes: appState.notes, - noteSelectedFunction: (noteIndex) { - var route = MaterialPageRoute( - builder: (context) => NoteBrowsingScreen( - notes: appState.notes, - noteIndex: noteIndex, - ), - ); - Navigator.of(context).push(route); - }, - ); + Widget journalList; + if (appState.notes.isNotEmpty) { + journalList = JournalList( + notes: appState.notes, + noteSelectedFunction: (noteIndex) { + var route = MaterialPageRoute( + builder: (context) => NoteBrowsingScreen( + notes: appState.notes, + noteIndex: noteIndex, + ), + ); + Navigator.of(context).push(route); + }, + ); + } else { + journalList = Center( + child: Text( + "Why not add your first\n Journal Entry?", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 28.0, + fontWeight: FontWeight.w300, + color: Colors.grey[350], + ), + ), + ); + } bool shouldShowBadge = !appState.remoteGitRepoConfigured && appState.hasJournalEntries;