From d607bad299a89f8585e24c76c9736fd3e1d78d20 Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Wed, 4 Dec 2019 01:25:31 +0100 Subject: [PATCH] JournalListing: Only show the notes in that folder Do not show all notes recursively, by default. The default screen will now only show the notes in the root folder. --- lib/screens/home_screen.dart | 3 ++- lib/screens/journal_listing.dart | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart index 410d8952..777c4688 100644 --- a/lib/screens/home_screen.dart +++ b/lib/screens/home_screen.dart @@ -10,6 +10,7 @@ class HomeScreen extends StatelessWidget { final container = StateContainer.of(context); final appState = container.appState; - return JournalListingScreen(appState.notes); + return JournalListingScreen(noteFolder: appState.noteFolder); + // return FolderListingScreen(); } } diff --git a/lib/screens/journal_listing.dart b/lib/screens/journal_listing.dart index 4648f418..992ce68a 100644 --- a/lib/screens/journal_listing.dart +++ b/lib/screens/journal_listing.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:gitjournal/note.dart'; +import 'package:gitjournal/note_folder.dart'; import 'package:gitjournal/utils.dart'; import 'package:gitjournal/apis/git.dart'; import 'package:gitjournal/screens/journal_editor.dart'; @@ -11,9 +12,10 @@ import 'package:gitjournal/widgets/journal_list.dart'; import 'package:gitjournal/themes.dart'; class JournalListingScreen extends StatelessWidget { - final List allNotes; + final NoteFolder noteFolder; + final bool recursive; - JournalListingScreen(this.allNotes); + JournalListingScreen({@required this.noteFolder, this.recursive = false}); @override Widget build(BuildContext context) { @@ -25,6 +27,8 @@ class JournalListingScreen extends StatelessWidget { child: Icon(Icons.add), ); + var allNotes = recursive ? noteFolder.getAllNotes() : noteFolder.getNotes(); + Widget journalList = JournalList( notes: allNotes, noteSelectedFunction: (noteIndex) {