Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
IsuruBRanapana committed Oct 12, 2019
1 parent e71a12f commit b54ef2e
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 0 deletions.
52 changes: 52 additions & 0 deletions New/Section04/note_keeper/lib/models/note.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
class Note{
int _id;
String _title;
String _description;
String _date;
int _priority;

Note(this._title,this._date,this._priority,[this._description]);
Note.withId(this._id,this._title,this._date,this._priority,[this._description]);

int get id=>_id;
String get title=>_title;
String get description => _description;
String get date => _date;
int get priority => _priority;

set title(String newTitle){
if(newTitle.length<=255){
this._title=newTitle;
}
}

set description(String newDescription){
if(newDescription.length<=255){
this._description=newDescription;
}
}

set (String newDate){
this._date=newDate;
}


set priority(int newPriority){
if(newPriority>=1 && newPriority<=2){
this._priority=newPriority;
}
}

Map<String,dynamic> toMap(){
var map=Map<String,dynamic>();
if(_id!=null){
map['id']=_id;
}
map['title']=_title;
map['description']=_description;
map['date']=_date;
map['priority']=_priority;

return map;
}
}
4 changes: 4 additions & 0 deletions New/Section04/note_keeper/lib/screens/note_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class NoteListState extends State<NoteList> {
Widget build(BuildContext context) {
// TODO: implement build
return WillPopScope(
onWillPop: (){
gotoBackScreen();
},
child: Scaffold(
appBar: AppBar(
title: Text("Notes"),
Expand All @@ -35,6 +38,7 @@ class NoteListState extends State<NoteList> {
child: Icon(Icons.add),
),
),

);
}

Expand Down
36 changes: 36 additions & 0 deletions New/Section04/note_keeper/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
intl:
dependency: "direct main"
description:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.0"
matcher:
dependency: transitive
description:
Expand All @@ -67,13 +74,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.2"
path_provider:
dependency: "direct main"
description:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
quiver:
dependency: transitive
description:
Expand All @@ -93,6 +114,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.5"
sqflite:
dependency: "direct main"
description:
name: sqflite
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6+5"
stack_trace:
dependency: transitive
description:
Expand All @@ -114,6 +142,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
synchronized:
dependency: transitive
description:
name: synchronized
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0+1"
term_glyph:
dependency: transitive
description:
Expand Down Expand Up @@ -144,3 +179,4 @@ packages:
version: "2.0.8"
sdks:
dart: ">=2.2.2 <3.0.0"
flutter: ">=1.2.1 <2.0.0"
3 changes: 3 additions & 0 deletions New/Section04/note_keeper/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ environment:
dependencies:
flutter:
sdk: flutter
sqflite: any
path_provider: any
intl: ^0.16.0

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
Expand Down

0 comments on commit b54ef2e

Please sign in to comment.