1
0
mirror of https://github.com/GitJournal/GitJournal.git synced 2025-07-11 13:03:34 +08:00

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.
This commit is contained in:
Vishesh Handa
2019-12-04 01:25:31 +01:00
parent c8bfa0e2a0
commit d607bad299
2 changed files with 8 additions and 3 deletions

@ -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();
}
}

@ -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<Note> 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) {