mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 18:03:14 +08:00
Show +1 notification badge after user has made a journal entry
This commit is contained in:
@ -9,6 +9,8 @@ class AppState {
|
|||||||
String remoteGitRepoPath = "";
|
String remoteGitRepoPath = "";
|
||||||
bool remoteGitRepoConfigured = false;
|
bool remoteGitRepoConfigured = false;
|
||||||
|
|
||||||
|
bool hasJournalEntries = false;
|
||||||
|
|
||||||
// FIXME: Make final
|
// FIXME: Make final
|
||||||
String gitBaseDirectory = "";
|
String gitBaseDirectory = "";
|
||||||
|
|
||||||
|
@ -33,9 +33,11 @@ class HomeScreen extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
bool shouldShowBadge =
|
||||||
|
!appState.remoteGitRepoConfigured && appState.hasJournalEntries;
|
||||||
var appBarMenuButton = BadgeIconButton(
|
var appBarMenuButton = BadgeIconButton(
|
||||||
icon: const Icon(Icons.menu),
|
icon: const Icon(Icons.menu),
|
||||||
itemCount: appState.remoteGitRepoConfigured ? 0 : 1,
|
itemCount: shouldShowBadge ? 1 : 0,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_scaffoldKey.currentState.openDrawer();
|
_scaffoldKey.currentState.openDrawer();
|
||||||
},
|
},
|
||||||
|
@ -97,6 +97,7 @@ class StateContainerState extends State<StateContainer> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
appState.isLoadingFromDisk = false;
|
appState.isLoadingFromDisk = false;
|
||||||
appState.notes = loadedNotes;
|
appState.notes = loadedNotes;
|
||||||
|
appState.hasJournalEntries = loadedNotes.isNotEmpty;
|
||||||
});
|
});
|
||||||
}).catchError((err, stack) {
|
}).catchError((err, stack) {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -121,6 +122,7 @@ class StateContainerState extends State<StateContainer> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
appState.isLoadingFromDisk = false;
|
appState.isLoadingFromDisk = false;
|
||||||
appState.notes = loadedNotes;
|
appState.notes = loadedNotes;
|
||||||
|
appState.hasJournalEntries = loadedNotes.isNotEmpty;
|
||||||
});
|
});
|
||||||
} catch (err, stack) {
|
} catch (err, stack) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
Reference in New Issue
Block a user