mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 18:38:36 +08:00
Allow sharing of notes
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gitjournal/core/note.dart';
|
import 'package:gitjournal/core/note.dart';
|
||||||
|
import 'package:share/share.dart';
|
||||||
|
|
||||||
typedef NoteCallback = void Function(Note);
|
typedef NoteCallback = void Function(Note);
|
||||||
|
|
||||||
@ -16,7 +17,7 @@ abstract class EditorState {
|
|||||||
Note getNote();
|
Note getNote();
|
||||||
}
|
}
|
||||||
|
|
||||||
enum DropDownChoices { Rename, MoveToFolder, DiscardChanges }
|
enum DropDownChoices { Rename, MoveToFolder, DiscardChanges, Share }
|
||||||
|
|
||||||
AppBar buildEditorAppBar(
|
AppBar buildEditorAppBar(
|
||||||
Editor editor,
|
Editor editor,
|
||||||
@ -66,6 +67,11 @@ AppBar buildEditorAppBar(
|
|||||||
var note = editorState.getNote();
|
var note = editorState.getNote();
|
||||||
editor.discardChangesSelected(note);
|
editor.discardChangesSelected(note);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case DropDownChoices.Share:
|
||||||
|
var note = editorState.getNote();
|
||||||
|
Share.share(note.body);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
itemBuilder: (BuildContext context) =>
|
itemBuilder: (BuildContext context) =>
|
||||||
@ -82,6 +88,10 @@ AppBar buildEditorAppBar(
|
|||||||
value: DropDownChoices.DiscardChanges,
|
value: DropDownChoices.DiscardChanges,
|
||||||
child: Text('Discard Changes'),
|
child: Text('Discard Changes'),
|
||||||
),
|
),
|
||||||
|
const PopupMenuItem<DropDownChoices>(
|
||||||
|
value: DropDownChoices.Share,
|
||||||
|
child: Text('Share Note'),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
Reference in New Issue
Block a user