Last active
March 6, 2020 04:26
-
-
Save xinthink/55c8d5ee739d729e4556ba78e53af4fc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The editor of a [Note], also shows every detail about a single note. | |
class NoteEditor extends StatefulWidget { | |
/// Create a [NoteEditor], | |
/// provides an existed [note] in edit mode, or `null` to create a new one. | |
const NoteEditor({Key key, this.note}) : super(key: key); | |
final Note note; | |
@override | |
State<StatefulWidget> createState() => _NoteEditorState(note); | |
} | |
class _NoteEditorState extends State<NoteEditor> { | |
_NoteEditorState(Note note) | |
: this._note = note ?? Note(), | |
_originNote = note?.copy() ?? Note(), | |
this._titleTextController = TextEditingController(text: note?.title), | |
this._contentTextController = TextEditingController(text: note?.content); | |
... | |
/// Returns `true` if the note is modified. | |
bool get _isDirty => _note != _originNote; | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment