Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-035-CoviDefender
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-035
2021-035-CoviDefender
Commits
ed9ff109
Commit
ed9ff109
authored
Aug 01, 2021
by
Indika NK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added smart notificator with 2 functions , local and push notifications
parent
a5f54e55
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
486 additions
and
7 deletions
+486
-7
android/app/src/main/AndroidManifest.xml
android/app/src/main/AndroidManifest.xml
+6
-0
android/app/src/main/res/drawable-v21/app_notf_icon.png
android/app/src/main/res/drawable-v21/app_notf_icon.png
+0
-0
android/app/src/main/res/drawable/app_notf_icon.png
android/app/src/main/res/drawable/app_notf_icon.png
+0
-0
lib/I_GUIDER/i_guider.dart
lib/I_GUIDER/i_guider.dart
+2
-1
lib/pages/notificator/model/Notification_plugin.dart
lib/pages/notificator/model/Notification_plugin.dart
+310
-0
lib/pages/notificator/ui/LocalNotificationUI.dart
lib/pages/notificator/ui/LocalNotificationUI.dart
+67
-0
lib/pages/notificator/ui/MainNotificationUI.dart
lib/pages/notificator/ui/MainNotificationUI.dart
+70
-0
lib/pages/notificator/ui/NotificationUI.dart
lib/pages/notificator/ui/NotificationUI.dart
+25
-0
lib/pages/notificator/ui/notificator.dart
lib/pages/notificator/ui/notificator.dart
+2
-1
pubspec.yaml
pubspec.yaml
+4
-5
No files found.
android/app/src/main/AndroidManifest.xml
View file @
ed9ff109
...
@@ -36,6 +36,12 @@
...
@@ -36,6 +36,12 @@
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
</intent-filter>
</intent-filter>
</activity>
</activity>
<receiver
android:name=
"com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver"
>
<intent-filter>
<action
android:name=
"android.intent.action.BOOT_COMPLETED"
></action>
</intent-filter>
</receiver>
<receiver
android:name=
"com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver"
/>
<!-- Don't delete the meta-data below.
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
<meta-data
...
...
android/app/src/main/res/drawable-v21/app_notf_icon.png
0 → 100644
View file @
ed9ff109
364 Bytes
android/app/src/main/res/drawable/app_notf_icon.png
0 → 100644
View file @
ed9ff109
364 Bytes
lib/I_GUIDER/i_guider.dart
View file @
ed9ff109
import
'package:covidefender/pages/heart_rate/heart_rate_screen.dart'
;
import
'package:covidefender/pages/heart_rate/heart_rate_screen.dart'
;
import
'package:covidefender/pages/mask_detect/invoker.dart'
;
import
'package:covidefender/pages/mask_detect/invoker.dart'
;
import
'package:covidefender/pages/notificator/ui/MainNotificationUI.dart'
;
import
'package:covidefender/pages/notificator/ui/notificator.dart'
;
import
'package:covidefender/pages/notificator/ui/notificator.dart'
;
import
'package:covidefender/pages/self_carer/sc_main_screen.dart'
;
import
'package:covidefender/pages/self_carer/sc_main_screen.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/cupertino.dart'
;
...
@@ -66,7 +67,7 @@ class I_guider extends StatelessWidget {
...
@@ -66,7 +67,7 @@ class I_guider extends StatelessWidget {
label:
Text
(
''
,
label:
Text
(
''
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
)),
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
)),
onPressed:
()
{
onPressed:
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
M
essagingWidget
()
));
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
M
ainNotificationUI
()
));
},
},
shape:
RoundedRectangleBorder
(
shape:
RoundedRectangleBorder
(
...
...
lib/pages/notificator/model/Notification_plugin.dart
0 → 100644
View file @
ed9ff109
This diff is collapsed.
Click to expand it.
lib/pages/notificator/ui/LocalNotificationUI.dart
0 → 100644
View file @
ed9ff109
import
'package:covidefender/pages/notificator/model/Notification_plugin.dart'
;
import
'package:flutter/material.dart'
;
import
'NotificationUI.dart'
;
class
LocalNotificationScreen
extends
StatefulWidget
{
@override
_LocalNotificationScreenState
createState
()
=>
_LocalNotificationScreenState
();
}
class
_LocalNotificationScreenState
extends
State
<
LocalNotificationScreen
>
{
//
int
count
=
0
;
@override
void
initState
()
{
super
.
initState
();
notificationPlugin
.
setListenerForLowerVersions
(
onNotificationInLowerVersions
);
notificationPlugin
.
setOnNotificationClick
(
onNotificationClick
);
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
backgroundColor:
Colors
.
green
,
title:
Text
(
'Local Notifications'
),
),
body:
Center
(
child:
FlatButton
(
onPressed:
()
async
{
await
notificationPlugin
.
showNotification
();
// await notificationPlugin.scheduleNotification();
// await notificationPlugin.showNotificationWithAttachment();
await
notificationPlugin
.
repeatNotification
();
// await notificationPlugin.showDailyAtTime();
// await notificationPlugin.showWeeklyAtDayTime();
// count = await notificationPlugin.getPendingNotificationCount();
// print('Count $count');
// await notificationPlugin.cancelNotification();
// count = await notificationPlugin.getPendingNotificationCount();
// print('Count $count');
},
child:
Text
(
'Send Notification'
),
),
),
);
}
onNotificationInLowerVersions
(
ReceivedNotification
receivedNotification
)
{
print
(
'Notification Received
${receivedNotification.id}
'
);
}
onNotificationClick
(
String
payload
)
{
print
(
'Payload
$payload
'
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
coontext
)
{
return
NotificationScreen
(
payload:
payload
,
);
}));
}
}
lib/pages/notificator/ui/MainNotificationUI.dart
0 → 100644
View file @
ed9ff109
import
'package:flutter/material.dart'
;
import
'LocalNotificationUI.dart'
;
import
'notificator.dart'
;
class
MainNotificationUI
extends
StatefulWidget
{
//
final
String
payload
;
MainNotificationUI
({
this
.
payload
});
@override
_NotificationScreenState
createState
()
=>
_NotificationScreenState
();
}
class
_NotificationScreenState
extends
State
<
MainNotificationUI
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
backgroundColor:
Colors
.
green
,
title:
Text
(
'Smart Notifier'
),
),
body:
Center
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
mainAxisAlignment:
MainAxisAlignment
.
end
,
children:
[
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
8
,
8
,
8
,
8
),
child:
SizedBox
(
child:
ElevatedButton
(
style:
ElevatedButton
.
styleFrom
(
primary:
Colors
.
green
[
300
],
elevation:
15
,
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
12
)
)
),
onPressed:
(){
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
LocalNotificationScreen
()
));
},
child:
Text
(
"Local Notifications"
)),
),
),
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
8
,
8
,
8
,
100
),
child:
SizedBox
(
child:
ElevatedButton
(
style:
ElevatedButton
.
styleFrom
(
primary:
Colors
.
green
[
300
],
elevation:
15
,
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
12
)
)
),
onPressed:
(){
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
MessagingWidget
()
));
},
child:
Text
(
"Push Notifications"
)),
),
)
],
),
),
);
}
}
lib/pages/notificator/ui/NotificationUI.dart
0 → 100644
View file @
ed9ff109
import
'package:flutter/material.dart'
;
class
NotificationScreen
extends
StatefulWidget
{
//
final
String
payload
;
NotificationScreen
({
this
.
payload
});
@override
_NotificationScreenState
createState
()
=>
_NotificationScreenState
();
}
class
_NotificationScreenState
extends
State
<
NotificationScreen
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'Notifications Screen'
),
),
body:
Center
(
child:
Text
(
widget
.
payload
),
),
);
}
}
lib/pages/notificator/ui/notificator.dart
View file @
ed9ff109
...
@@ -51,6 +51,7 @@ class _MessagingWidgetState extends State<MessagingWidget> {
...
@@ -51,6 +51,7 @@ class _MessagingWidgetState extends State<MessagingWidget> {
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
return
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
backgroundColor:
Colors
.
green
,
title:
Text
(
"Smart - Notificator "
),
title:
Text
(
"Smart - Notificator "
),
),
),
body:
Container
(
body:
Container
(
...
@@ -64,7 +65,7 @@ class _MessagingWidgetState extends State<MessagingWidget> {
...
@@ -64,7 +65,7 @@ class _MessagingWidgetState extends State<MessagingWidget> {
spreadRadius:
5
)
spreadRadius:
5
)
],
],
gradient:
LinearGradient
(
gradient:
LinearGradient
(
colors:
[
Colors
.
blue
[
600
],
Colors
.
white
],
colors:
[
Colors
.
green
[
600
],
Colors
.
white
],
begin:
Alignment
.
centerLeft
,
begin:
Alignment
.
centerLeft
,
end:
Alignment
.
centerRight
,
end:
Alignment
.
centerRight
,
),
),
...
...
pubspec.yaml
View file @
ed9ff109
...
@@ -36,7 +36,9 @@ dependencies:
...
@@ -36,7 +36,9 @@ dependencies:
google_fonts
:
^1.1.2
google_fonts
:
^1.1.2
flutter_sms
:
^2.1.1
flutter_sms
:
^2.1.1
firebase_messaging
:
^4.0.0+1
firebase_messaging
:
^4.0.0+1
rxdart
:
^0.24.1
path_provider
:
^1.6.11
flutter_local_notifications
:
^1.4.4+1
# The following adds the Cupertino Icons font to your application.
# The following adds the Cupertino Icons font to your application.
...
@@ -44,11 +46,8 @@ dependencies:
...
@@ -44,11 +46,8 @@ dependencies:
cupertino_icons
:
^1.0.2
cupertino_icons
:
^1.0.2
http
:
^0.12.2
http
:
^0.12.2
#add dependencies for heart rate module
#add dependencies for heart rate module
camera
:
camera
:
git
:
git
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment