diff --git a/lib/editors/common.dart b/lib/editors/common.dart index 69f9ea9e..dcc737f6 100644 --- a/lib/editors/common.dart +++ b/lib/editors/common.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:gitjournal/core/note.dart'; +import 'package:share/share.dart'; typedef NoteCallback = void Function(Note); @@ -16,7 +17,7 @@ abstract class EditorState { Note getNote(); } -enum DropDownChoices { Rename, MoveToFolder, DiscardChanges } +enum DropDownChoices { Rename, MoveToFolder, DiscardChanges, Share } AppBar buildEditorAppBar( Editor editor, @@ -66,6 +67,11 @@ AppBar buildEditorAppBar( var note = editorState.getNote(); editor.discardChangesSelected(note); return; + + case DropDownChoices.Share: + var note = editorState.getNote(); + Share.share(note.body); + return; } }, itemBuilder: (BuildContext context) => @@ -82,6 +88,10 @@ AppBar buildEditorAppBar( value: DropDownChoices.DiscardChanges, child: Text('Discard Changes'), ), + const PopupMenuItem( + value: DropDownChoices.Share, + child: Text('Share Note'), + ), ], ), ],