Move empty text inside the JournalList

This commit is contained in:
Vishesh Handa
2019-05-01 23:59:00 +02:00
parent 954573bcce
commit 6e5a6255a3
2 changed files with 26 additions and 27 deletions

View File

@ -21,33 +21,18 @@ class HomeScreen extends StatelessWidget {
child: Icon(Icons.add), child: Icon(Icons.add),
); );
Widget journalList; Widget journalList = JournalList(
if (appState.notes.isNotEmpty) { notes: appState.notes,
journalList = JournalList( noteSelectedFunction: (noteIndex) {
notes: appState.notes, var route = MaterialPageRoute(
noteSelectedFunction: (noteIndex) { builder: (context) => NoteBrowsingScreen(
var route = MaterialPageRoute( notes: appState.notes,
builder: (context) => NoteBrowsingScreen( noteIndex: noteIndex,
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;

View File

@ -19,6 +19,20 @@ class JournalList extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (notes.isEmpty) {
return 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],
),
),
);
}
return ListView.separated( return ListView.separated(
separatorBuilder: (context, index) { separatorBuilder: (context, index) {
return Divider( return Divider(