diff --git a/.vs/ProjectSettings.json b/.vs/ProjectSettings.json new file mode 100644 index 0000000..f8b4888 --- /dev/null +++ b/.vs/ProjectSettings.json @@ -0,0 +1,3 @@ +{ + "CurrentProjectSetting": null +} \ No newline at end of file diff --git a/.vs/Selection-Project/FileContentIndex/1b7968bb-0617-4b63-9ecc-93c8c98fd7aa.vsidx b/.vs/Selection-Project/FileContentIndex/1b7968bb-0617-4b63-9ecc-93c8c98fd7aa.vsidx new file mode 100644 index 0000000..8e58bb1 Binary files /dev/null and b/.vs/Selection-Project/FileContentIndex/1b7968bb-0617-4b63-9ecc-93c8c98fd7aa.vsidx differ diff --git a/.vs/Selection-Project/v17/.wsuo b/.vs/Selection-Project/v17/.wsuo new file mode 100644 index 0000000..f210fc3 Binary files /dev/null and b/.vs/Selection-Project/v17/.wsuo differ diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json new file mode 100644 index 0000000..85b19e0 --- /dev/null +++ b/.vs/VSWorkspaceState.json @@ -0,0 +1,10 @@ +{ + "ExpandedNodes": [ + "", + "\\src", + "\\src\\core", + "\\src\\models" + ], + "SelectedNode": "\\src\\core\\note_app.dart", + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite new file mode 100644 index 0000000..5e49de9 Binary files /dev/null and b/.vs/slnx.sqlite differ diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..6355088 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,13 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Dart & Flutter", + "request": "launch", + "type": "dart" + } + ] +} \ No newline at end of file diff --git a/src/core/Note.dart b/src/core/Note.dart new file mode 100644 index 0000000..3973896 --- /dev/null +++ b/src/core/Note.dart @@ -0,0 +1,128 @@ +import 'note_app.dart'; +class Note { + + String? Title, Content; + + + + Note(String? title, String? content){ + this.Title= title; + this.Content=content; + } + + + void setTtile(String? Title){ + this.Title=Title; + } + + void setContent(String? Content){ + this.Content=Content; + } + + String? getTitle(){ + return Title; + } + + String? getContent(){ + return Content; + } + +static List NotesList =[]; + + static void CreateNote(Note newNote){ + + NotesList.add(newNote); + print("Note added sucessfuly"); + + } + + static void deleteNoteM(String? delNoteV){ + bool found=false; + for (int i =0; i0 && operation <7){ + switch (operation) { + + case 1: + //create a note + try{ + String? newNoteTitle; + String? newNoteContent; + + print("Title: \n ****"); + newNoteTitle = stdin.readLineSync(); + + print ("content: \n ****"); + newNoteContent = stdin.readLineSync(); + +Note newNote= Note(newNoteTitle,newNoteContent); + Note.CreateNote(newNote); + break;} catch (e){ + print ("invalid input"); + } + case 2: { + //Edit a note's title or content + + print("To edit the title press (1), Content press (2)"); + try { + int editSwitch= int.parse(stdin.readLineSync()!); + switch (editSwitch) { + case 1 : print ("Enter the title of the note to edit: ") ; + toEdit=stdin.readLineSync(); + print ("enter the new title: "); + editNoteV= stdin.readLineSync(); + Note.editTitleM(toEdit,editNoteV); + break; + + case 2: + print ("Enter the title of the note to edit: ") ; + toEdit=stdin.readLineSync(); + print ("enter the new Cotent: "); + editNoteV= stdin.readLineSync(); + Note.editContentM(toEdit,editNoteV); + break; + + default: + print ("invalid input"); + }} catch(e){ + print ("invalid input"); + }} + break; + + case 3: + //Delete a note + try{ + print("Write the title of the note to delete: "); + delNoteV= stdin.readLineSync(); + Note.deleteNoteM(delNoteV); + break; + } catch (e){ + print ("invalid input"); + } + case 4: + // print all notes + try{ + print("\n All Notes:"); +print(" _______________________ "); + +for (var i = 0; i < Note.NotesList.length; i++) { + print(" | |"); + print(" | Title: ${Note.NotesList[i].Title}"); + print(" | Content: ${Note.NotesList[i].Content} "); + print(" | | "); + print(" |______________________| "); +} +break;} +catch (e){ + print ("invalid input"); +} + case 5: + //searsh BY titile OR content + + print("To search by title press (1) and to search by Content press (2)"); + try { + int searchSwitch= int.parse(stdin.readLineSync()!); + switch (searchSwitch) { + case 1 : + print ("Enter the title of the note: ") ; + toEdit=stdin.readLineSync(); + Note.searchByTitleM(toEdit); + break; + + case 2: + print ("Enter the content of the note: ") ; + toEdit=stdin.readLineSync(); + Note.searchByContentM(toEdit); + break; + + default: + print("Invalid choice"); + + }} catch(e){ + print ("invalid input"); + } + break; + + + default: + exit; + + }} + } while ( operation!=6); + } } diff --git a/src/core/tempCodeRunnerFile.dart b/src/core/tempCodeRunnerFile.dart new file mode 100644 index 0000000..e69de29 diff --git a/src/main.dart b/src/main.dart index 88398d1..883405c 100644 --- a/src/main.dart +++ b/src/main.dart @@ -1,5 +1,14 @@ import 'core/note_app.dart'; + + + void main(List args) { + + + NoteApp().run(); + + + } diff --git a/src/models/note_model.dart b/src/models/note_model.dart index 788b69e..2b83096 100644 --- a/src/models/note_model.dart +++ b/src/models/note_model.dart @@ -1,2 +1,14 @@ //TODO: Define a note model class -class NoteModel {} +class NoteModel { + String? name; + String? content; + + + NoteModel({this.name, this.content}); + + String? Create (String name , String content){ + + return name+content; +} + + } diff --git a/src/tempCodeRunnerFile.dart b/src/tempCodeRunnerFile.dart new file mode 100644 index 0000000..e69de29