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

View File

@ -10,6 +10,7 @@ class HomeScreen extends StatelessWidget {
final container = StateContainer.of(context); final container = StateContainer.of(context);
final appState = container.appState; final appState = container.appState;
return JournalListingScreen(appState.notes); return JournalListingScreen(noteFolder: appState.noteFolder);
// return FolderListingScreen();
} }
} }

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gitjournal/note.dart'; import 'package:gitjournal/note.dart';
import 'package:gitjournal/note_folder.dart';
import 'package:gitjournal/utils.dart'; import 'package:gitjournal/utils.dart';
import 'package:gitjournal/apis/git.dart'; import 'package:gitjournal/apis/git.dart';
import 'package:gitjournal/screens/journal_editor.dart'; import 'package:gitjournal/screens/journal_editor.dart';
@ -11,9 +12,10 @@ import 'package:gitjournal/widgets/journal_list.dart';
import 'package:gitjournal/themes.dart'; import 'package:gitjournal/themes.dart';
class JournalListingScreen extends StatelessWidget { 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -25,6 +27,8 @@ class JournalListingScreen extends StatelessWidget {
child: Icon(Icons.add), child: Icon(Icons.add),
); );
var allNotes = recursive ? noteFolder.getAllNotes() : noteFolder.getNotes();
Widget journalList = JournalList( Widget journalList = JournalList(
notes: allNotes, notes: allNotes,
noteSelectedFunction: (noteIndex) { noteSelectedFunction: (noteIndex) {