HomeScreen: Show some text when we have no journal entries

Ideally, I would want something way prettier, but this is a good
enough start.
This commit is contained in:
Vishesh Handa
2019-02-15 15:16:08 +01:00
parent 8593f79445
commit 783eef32e5

View File

@ -20,18 +20,33 @@ class HomeScreen extends StatelessWidget {
child: Icon(Icons.add), child: Icon(Icons.add),
); );
var journalList = JournalList( Widget journalList;
notes: appState.notes, if (appState.notes.isNotEmpty) {
noteSelectedFunction: (noteIndex) { journalList = JournalList(
var route = MaterialPageRoute( notes: appState.notes,
builder: (context) => NoteBrowsingScreen( noteSelectedFunction: (noteIndex) {
notes: appState.notes, var route = MaterialPageRoute(
noteIndex: noteIndex, builder: (context) => NoteBrowsingScreen(
), notes: appState.notes,
); noteIndex: noteIndex,
Navigator.of(context).push(route); ),
}, );
); 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 = bool shouldShowBadge =
!appState.remoteGitRepoConfigured && appState.hasJournalEntries; !appState.remoteGitRepoConfigured && appState.hasJournalEntries;